From 7fdf3d82e1990f4b7b7fc86f67fe62b8a92e54ed Mon Sep 17 00:00:00 2001 From: Adam Levin Date: Wed, 7 Jul 2021 14:09:42 -0400 Subject: [PATCH 1/5] Added new topics --- frontend/src/pages/ActivityReport/constants.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/src/pages/ActivityReport/constants.js b/frontend/src/pages/ActivityReport/constants.js index 3e9cc9984d..0a50133666 100644 --- a/frontend/src/pages/ActivityReport/constants.js +++ b/frontend/src/pages/ActivityReport/constants.js @@ -74,10 +74,12 @@ export const topics = [ 'Data and Evaluation', 'ERSEA', 'Environmental Health and Safety', + 'Equity', 'Facilities', 'Family Support Services', 'Fiscal / Budget', 'Five-Year Grant', + 'Home Visiting', 'Human Resources', 'Leadership / Governance', 'Learning Environments', @@ -91,6 +93,7 @@ export const topics = [ 'QIP', 'Recordkeeping and Reporting', 'Safety Practices', + 'Staff Wellness', 'Teaching Practices / Teacher-Child Interactions', 'Technology and Information Systems', 'Transition Practices', From b5003d75a4e152d583efd7ba26c3a15f37d39366 Mon Sep 17 00:00:00 2001 From: Adam Levin Date: Wed, 7 Jul 2021 16:20:52 -0400 Subject: [PATCH 2/5] Added topics unit test. --- .../Pages/__tests__/topicsResources.js | 66 ++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/ActivityReport/Pages/__tests__/topicsResources.js b/frontend/src/pages/ActivityReport/Pages/__tests__/topicsResources.js index b43bb9cc06..379e81b394 100644 --- a/frontend/src/pages/ActivityReport/Pages/__tests__/topicsResources.js +++ b/frontend/src/pages/ActivityReport/Pages/__tests__/topicsResources.js @@ -1,10 +1,11 @@ /* eslint-disable react/jsx-props-no-spreading */ import '@testing-library/jest-dom'; -import { render, screen } from '@testing-library/react'; +import { render, screen, fireEvent } from '@testing-library/react'; import React from 'react'; import { FormProvider, useForm } from 'react-hook-form/dist/index.ie11'; import { Router } from 'react-router-dom'; import { createMemoryHistory } from 'history'; +import userEvent from '@testing-library/user-event'; import topics from '../topicsResources'; @@ -25,6 +26,21 @@ const RenderTopicsResourcesReview = ({ data }) => { ); }; +const RenderTopicsResources = () => { + const history = createMemoryHistory(); + const hookForm = useForm({ + mode: 'onChange', + }); + // eslint-disable-next-line react/prop-types + return ( + + + {topics.render()} + + + ); +}; + describe('Topics & resources', () => { const data = { attachments: [{ originalFileName: 'attachment', url: { url: 'http://localhost/attachment' }, status: 'APPROVED' }], @@ -42,4 +58,52 @@ describe('Topics & resources', () => { expect(await screen.findByText('topics')).toBeVisible(); }); }); + + describe('edit topics page', () => { + it('displays correct topics', async () => { + render(); + const topicsSelectBtn = screen.getByText(/topic\(s\) covered\. you may choose more than one\./i); + userEvent.click(topicsSelectBtn); + const topicSelect = screen.getByText(/select is focused ,type to refine list, press down to open the menu, press left to focus selected values/i); + fireEvent.focus(topicSelect); + fireEvent.keyDown(topicSelect, { key: 'ArrowDown', code: 40 }); + expect(await screen.findByText('Behavioral / Mental Health')).toBeVisible(); + expect(await screen.findByText('Child Assessment, Development, Screening')).toBeVisible(); + expect(await screen.findByText('CLASS: Classroom Management')).toBeVisible(); + expect(await screen.findByText('CLASS: Emotional Support')).toBeVisible(); + expect(await screen.findByText('CLASS: Instructional Support')).toBeVisible(); + expect(await screen.findByText('Coaching')).toBeVisible(); + expect(await screen.findByText('Communication')).toBeVisible(); + expect(await screen.findByText('Community and Self-Assessment')).toBeVisible(); + expect(await screen.findByText('Culture & Language')).toBeVisible(); + expect(await screen.findByText('Curriculum (Early Childhood or Parenting)')).toBeVisible(); + expect(await screen.findByText('Data and Evaluation')).toBeVisible(); + expect(await screen.findByText('ERSEA')).toBeVisible(); + expect(await screen.findByText('Environmental Health and Safety')).toBeVisible(); + expect(await screen.findByText('Equity')).toBeVisible(); + expect(await screen.findByText('Facilities')).toBeVisible(); + expect(await screen.findByText('Family Support Services')).toBeVisible(); + expect(await screen.findByText('Fiscal / Budget')).toBeVisible(); + expect(await screen.findByText('Five-Year Grant')).toBeVisible(); + expect(await screen.findByText('Home Visiting')).toBeVisible(); + expect(await screen.findByText('Human Resources')).toBeVisible(); + expect(await screen.findByText('Leadership / Governance')).toBeVisible(); + expect(await screen.findByText('Learning Environments')).toBeVisible(); + expect(await screen.findByText('Nutrition')).toBeVisible(); + expect(await screen.findByText('Oral Health')).toBeVisible(); + expect(await screen.findByText('Parent and Family Engagement')).toBeVisible(); + expect(await screen.findByText('Partnerships and Community Engagement')).toBeVisible(); + expect(await screen.findByText('Physical Health and Screenings')).toBeVisible(); + expect(await screen.findByText('Pregnancy Services / Expectant Families')).toBeVisible(); + expect(await screen.findByText('Program Planning and Services')).toBeVisible(); + expect(await screen.findByText('QIP')).toBeVisible(); + expect(await screen.findByText('Recordkeeping and Reporting')).toBeVisible(); + expect(await screen.findByText('Safety Practices')).toBeVisible(); + expect(await screen.findByText('Staff Wellness')).toBeVisible(); + expect(await screen.findByText('Teaching Practices / Teacher-Child Interactions')).toBeVisible(); + expect(await screen.findByText('Technology and Information Systems')).toBeVisible(); + expect(await screen.findByText('Transition Practices')).toBeVisible(); + expect(await screen.findByText('Transportation')).toBeVisible(); + }); + }); }); From 81cf8e7c33874e85899affc70fe144a43baeb5dc Mon Sep 17 00:00:00 2001 From: kryswisnaskas Date: Wed, 7 Jul 2021 16:42:35 -0400 Subject: [PATCH 3/5] Show tta overview widgets to admins only --- frontend/src/pages/Landing/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/Landing/index.js b/frontend/src/pages/Landing/index.js index 24322a6d28..090a12fba4 100644 --- a/frontend/src/pages/Landing/index.js +++ b/frontend/src/pages/Landing/index.js @@ -23,7 +23,7 @@ import 'uswds/dist/css/uswds.css'; import '@trussworks/react-uswds/lib/index.css'; import './index.css'; import MyAlerts from './MyAlerts'; -import { hasReadWrite, allRegionsUserHasPermissionTo } from '../../permissions'; +import isAdmin, { hasReadWrite, allRegionsUserHasPermissionTo } from '../../permissions'; import { REPORTS_PER_PAGE, ALERTS_PER_PAGE } from '../../Constants'; import Filter, { filtersToQueryString } from './Filter'; import ReportMenu from './ReportMenu'; @@ -493,7 +493,7 @@ function Landing() {

Activity Reports

- {getUserRegions(user).length > 1 + {isAdmin(user) && getUserRegions(user).length > 1 && ( + {isAdmin(user) && ( + )} From da6f6fa0e761ea622cf2a4e1b7d2eeae99050c43 Mon Sep 17 00:00:00 2001 From: kryswisnaskas Date: Wed, 7 Jul 2021 17:18:37 -0400 Subject: [PATCH 4/5] Adjust mock user in tests --- frontend/src/pages/Landing/__tests__/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/frontend/src/pages/Landing/__tests__/index.js b/frontend/src/pages/Landing/__tests__/index.js index 83e555109e..34b057155a 100644 --- a/frontend/src/pages/Landing/__tests__/index.js +++ b/frontend/src/pages/Landing/__tests__/index.js @@ -255,6 +255,10 @@ describe('Landing Page sorting', () => { scopeId: 3, regionId: 1, }, + { + scopeId: 2, + regionId: 1, + }, ], }; @@ -474,6 +478,10 @@ describe('Landing page table menus & selections', () => { scopeId: 3, regionId: 1, }, + { + scopeId: 2, + regionId: 1, + }, ], }; @@ -682,6 +690,10 @@ describe('Landing page table menus & selections', () => { scopeId: 3, regionId: 1, }, + { + scopeId: 2, + regionId: 1, + }, ], }; @@ -743,6 +755,10 @@ describe('My alerts sorting', () => { scopeId: 3, regionId: 1, }, + { + scopeId: 2, + regionId: 1, + }, ], }; From 92bc7cd4c42f9b3ee448f71a2abba0e4c9e62692 Mon Sep 17 00:00:00 2001 From: Adam Levin <84350609+AdamAdHocTeam@users.noreply.github.com> Date: Thu, 8 Jul 2021 09:24:02 -0400 Subject: [PATCH 5/5] Revert "Ttahub 182/add three new topics" --- .../Pages/__tests__/topicsResources.js | 66 +------------------ .../src/pages/ActivityReport/constants.js | 3 - 2 files changed, 1 insertion(+), 68 deletions(-) diff --git a/frontend/src/pages/ActivityReport/Pages/__tests__/topicsResources.js b/frontend/src/pages/ActivityReport/Pages/__tests__/topicsResources.js index 379e81b394..b43bb9cc06 100644 --- a/frontend/src/pages/ActivityReport/Pages/__tests__/topicsResources.js +++ b/frontend/src/pages/ActivityReport/Pages/__tests__/topicsResources.js @@ -1,11 +1,10 @@ /* eslint-disable react/jsx-props-no-spreading */ import '@testing-library/jest-dom'; -import { render, screen, fireEvent } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import React from 'react'; import { FormProvider, useForm } from 'react-hook-form/dist/index.ie11'; import { Router } from 'react-router-dom'; import { createMemoryHistory } from 'history'; -import userEvent from '@testing-library/user-event'; import topics from '../topicsResources'; @@ -26,21 +25,6 @@ const RenderTopicsResourcesReview = ({ data }) => { ); }; -const RenderTopicsResources = () => { - const history = createMemoryHistory(); - const hookForm = useForm({ - mode: 'onChange', - }); - // eslint-disable-next-line react/prop-types - return ( - - - {topics.render()} - - - ); -}; - describe('Topics & resources', () => { const data = { attachments: [{ originalFileName: 'attachment', url: { url: 'http://localhost/attachment' }, status: 'APPROVED' }], @@ -58,52 +42,4 @@ describe('Topics & resources', () => { expect(await screen.findByText('topics')).toBeVisible(); }); }); - - describe('edit topics page', () => { - it('displays correct topics', async () => { - render(); - const topicsSelectBtn = screen.getByText(/topic\(s\) covered\. you may choose more than one\./i); - userEvent.click(topicsSelectBtn); - const topicSelect = screen.getByText(/select is focused ,type to refine list, press down to open the menu, press left to focus selected values/i); - fireEvent.focus(topicSelect); - fireEvent.keyDown(topicSelect, { key: 'ArrowDown', code: 40 }); - expect(await screen.findByText('Behavioral / Mental Health')).toBeVisible(); - expect(await screen.findByText('Child Assessment, Development, Screening')).toBeVisible(); - expect(await screen.findByText('CLASS: Classroom Management')).toBeVisible(); - expect(await screen.findByText('CLASS: Emotional Support')).toBeVisible(); - expect(await screen.findByText('CLASS: Instructional Support')).toBeVisible(); - expect(await screen.findByText('Coaching')).toBeVisible(); - expect(await screen.findByText('Communication')).toBeVisible(); - expect(await screen.findByText('Community and Self-Assessment')).toBeVisible(); - expect(await screen.findByText('Culture & Language')).toBeVisible(); - expect(await screen.findByText('Curriculum (Early Childhood or Parenting)')).toBeVisible(); - expect(await screen.findByText('Data and Evaluation')).toBeVisible(); - expect(await screen.findByText('ERSEA')).toBeVisible(); - expect(await screen.findByText('Environmental Health and Safety')).toBeVisible(); - expect(await screen.findByText('Equity')).toBeVisible(); - expect(await screen.findByText('Facilities')).toBeVisible(); - expect(await screen.findByText('Family Support Services')).toBeVisible(); - expect(await screen.findByText('Fiscal / Budget')).toBeVisible(); - expect(await screen.findByText('Five-Year Grant')).toBeVisible(); - expect(await screen.findByText('Home Visiting')).toBeVisible(); - expect(await screen.findByText('Human Resources')).toBeVisible(); - expect(await screen.findByText('Leadership / Governance')).toBeVisible(); - expect(await screen.findByText('Learning Environments')).toBeVisible(); - expect(await screen.findByText('Nutrition')).toBeVisible(); - expect(await screen.findByText('Oral Health')).toBeVisible(); - expect(await screen.findByText('Parent and Family Engagement')).toBeVisible(); - expect(await screen.findByText('Partnerships and Community Engagement')).toBeVisible(); - expect(await screen.findByText('Physical Health and Screenings')).toBeVisible(); - expect(await screen.findByText('Pregnancy Services / Expectant Families')).toBeVisible(); - expect(await screen.findByText('Program Planning and Services')).toBeVisible(); - expect(await screen.findByText('QIP')).toBeVisible(); - expect(await screen.findByText('Recordkeeping and Reporting')).toBeVisible(); - expect(await screen.findByText('Safety Practices')).toBeVisible(); - expect(await screen.findByText('Staff Wellness')).toBeVisible(); - expect(await screen.findByText('Teaching Practices / Teacher-Child Interactions')).toBeVisible(); - expect(await screen.findByText('Technology and Information Systems')).toBeVisible(); - expect(await screen.findByText('Transition Practices')).toBeVisible(); - expect(await screen.findByText('Transportation')).toBeVisible(); - }); - }); }); diff --git a/frontend/src/pages/ActivityReport/constants.js b/frontend/src/pages/ActivityReport/constants.js index 0a50133666..3e9cc9984d 100644 --- a/frontend/src/pages/ActivityReport/constants.js +++ b/frontend/src/pages/ActivityReport/constants.js @@ -74,12 +74,10 @@ export const topics = [ 'Data and Evaluation', 'ERSEA', 'Environmental Health and Safety', - 'Equity', 'Facilities', 'Family Support Services', 'Fiscal / Budget', 'Five-Year Grant', - 'Home Visiting', 'Human Resources', 'Leadership / Governance', 'Learning Environments', @@ -93,7 +91,6 @@ export const topics = [ 'QIP', 'Recordkeeping and Reporting', 'Safety Practices', - 'Staff Wellness', 'Teaching Practices / Teacher-Child Interactions', 'Technology and Information Systems', 'Transition Practices',