-
-
Notifications
You must be signed in to change notification settings - Fork 55
Feature - TIDE Dashboard v2 #1977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
henry-tp
wants to merge
227
commits into
develop
Choose a base branch
from
feat/tide-v2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
227 commits
Select commit
Hold shift + click to select a range
e8b5f2b
WEB-4654 initial scaffolding for ActiveFiltersBar and AppliedFilters
henry-tp 2680f37
WEB-4654 rename items to chips
henry-tp b54fc49
WEB-4654 refactor to get rid of one-off functions
henry-tp 056fe0a
WEB-4654 update chip styling
henry-tp f583d39
WEB-4654 remove FilterResetBar and replace
henry-tp e4a29c1
WEB-4654 fix visual styling for applied filters
henry-tp b18c1f4
WEB-4654 fix Summarizing Period label and positioning
henry-tp 8706f0b
WEB-4654 simplify Data Recency button
henry-tp ef612ae
WEB-4654 change order of filters in Pop Health
henry-tp e52b5af
WEB-4654 AppliedFilters takes search argument
henry-tp 4ce23e7
WEB-4654 simplify chipgroup prefix
henry-tp 9b2b4f4
WEB-4654 rename dropdown to Clinic Sites
henry-tp 39f59b2
WEB-4654 AppliedFilters accepts rightContent
henry-tp cb8b216
WEB-4654 fix font sizing & spacing
henry-tp 690abf4
WEB-4654 remove default case from AppliedFiltersAdapter
henry-tp 8d3f1ec
WEB-4654 revert ordering
henry-tp 6a22b4e
WEB-4526 filter enhancements initial commit
henry-tp 7b8f0f5
WEB-4654 abstract ClearFilterButtons
henry-tp 0c49625
WEB-4654 fix prop name bug
henry-tp b102784
WEB-4654 abstract tags filter into own component TagFilterDropdown
henry-tp 988bb7c
WEB-4654 abstract tags filter
henry-tp 9697697
WEB-4654 extract sites filter
henry-tp a8f3ff7
WEB-4654 remove prefixPopHealthMetric from abstracted components
henry-tp bafce2c
Merge branch 'feat/filter-enhancements' into WEB-4654-filter-bar
henry-tp 71310fd
WEB-4654 fix missing print fn
henry-tp ae860b6
Merge branch 'WEB-4654-filter-bar' into WEB-4654-tags
henry-tp be84197
WEB-4654 remove unused popup state hooks
henry-tp 1785b26
WEB-4654 abstract out Data Recency
henry-tp dcb6cd4
WEB-4654 restyle tags and sites dropdown to new UI design
henry-tp e6d9b41
Merge branch 'WEB-4654-tags' into WEB-4654-data-recency
henry-tp cefcc39
WEB-4654 update Data Recency visual styles
henry-tp 1601f39
WEB-4654 fix margins
henry-tp fbb5f87
WEB-4654 fix minor spacing issue
henry-tp 43d0e72
WEB-4654 add safety in case of missing label
henry-tp 46fdaae
WEB-4654 revert changes to SummaryPeriod filter
henry-tp c576f4e
WEB-4654 revert changes to SummaryPeriod filter
henry-tp 330081c
Merge branch 'WEB-4654-filter-bar' into WEB-4654-tags
henry-tp 693b5e7
Merge branch 'WEB-4654-tags' into WEB-4654-data-recency
henry-tp 9a06326
WEB-4654 restyle SummaryPeriod
henry-tp f860429
WEB-4654 connect summary period filter
henry-tp 4fe2700
WEB-4654 revert erroneous changes to ClinicPatients
henry-tp 133c0d5
WEB-4654 minor styling fix
henry-tp 68d4eb0
WEB-4654 rename to ActiveFiltersTray
henry-tp b932de2
WEB-4654 re-add comments for `SPECIAL_FILTER_STATES`
henry-tp 5ae947a
WEB-4654 abstract out TIR range filter
henry-tp a4d7133
WEB-4654 adjust styling of TIR dropdown
henry-tp 69ce56b
WEB-4654 reposition FilterByTIR to after CGM Use
henry-tp d5aeef1
WEB-4654 abstract out CGM Use filter
henry-tp 84a9a30
WEB-4654 change directory for AppliedFiltersList
henry-tp 14c5cbd
WEB-4654 put tray-hiding behaviour into adapter component instead of …
henry-tp e4f1c9f
Merge branch 'WEB-4654-filter-bar' into WEB-4654-tags
henry-tp 26b52b4
WEB-4654 change directory for FilterBySites & FilterByTags
henry-tp e86968e
Merge branch 'WEB-4654-tags' into WEB-4654-data-recency
henry-tp 453560b
WEB-4654 change directory for FilterByDataRecency
henry-tp 4a1c63c
Merge branch 'WEB-4654-data-recency' into WEB-4654-summary-period
henry-tp 13dac8a
WEB-4654 change directory for FilterBySummaryPeriod
henry-tp d3cd1db
Merge branch 'WEB-4654-summary-period' into WEB-4654-time-in-range
henry-tp 4100d98
WEB-4654 change directory for FilterByTIR
henry-tp 3911e1f
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp 75e0462
WEB-4654 change directory for FilterByCGMUse
henry-tp 14195bb
WEB-4654 remove unused tests
henry-tp 40980f8
WEB-4654 move ClearFilterButtons rendering into AppliedFiltersList
henry-tp 65c2d02
WEB-4654 write tests for AppliedFiltersList
henry-tp d4930a8
WEB-4654 write tests for ActiveFilterTray
henry-tp 44f608d
WEB-4654 change empty tag/site copy per new requirements
henry-tp f904994
WEB-4654 fix copy per new requirements
henry-tp 2f75d56
WEB-4654 use circle-add icon
henry-tp a09b9c2
WEB-4654 pass in custom filter options from adapter component
henry-tp f3407da
WEB-4654 clear unneeded props
henry-tp 1a1180a
WEB-4654 clear unneeded props
henry-tp 48a5316
WEB-4654 clear unneeded props
henry-tp c12d0e9
WEB-4654 clear unneeded props
henry-tp 7257c07
WEB-4654 clear unneeded props
henry-tp 2db2bfe
WEB-4654 update trackMetric fn calls
henry-tp c01fd80
WEB-4654 use dedicated file for useClinicMetricsPageName
henry-tp bde85e8
WEB-4654 add tests for adapter components
henry-tp c13309c
WEB-4654 add tests for TagFilterDropdown
henry-tp 4d585cb
WEB-4654 re-add in top-level integration test for filtering
henry-tp bf7d7ac
WEB-4654 update copy text for no tag / no site in ActiveFiltersTray
henry-tp 7739eb0
Merge branch 'WEB-4654-tags' into WEB-4654-data-recency
henry-tp 7fee3e6
WEB-4654 add tests for Data Recency filter
henry-tp 675d246
WEB-4654 remove unnecessary tests
henry-tp ed5f52f
WEB-4654 add tests for FilterBySummaryPeriod
henry-tp 4ba9521
Merge branch 'WEB-4654-data-recency' into WEB-4654-summary-period
henry-tp 7261efb
WEB-4654 add tests for dropdown components
henry-tp 3d8fe0e
Merge branch 'WEB-4654-summary-period' into WEB-4654-time-in-range
henry-tp b5b6699
WEB-4654 add tests for FilterByTimeInRange
henry-tp 265160e
WEB-4654 add tests for time-in-range
henry-tp 4a2ca4e
WEB-4654 add testid to summary period dropdown
henry-tp e0d8a32
WEB-4654 add tests for dropdown
henry-tp 53c73a7
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp df238e9
WEB-4654 add correct symbol for cgm us
henry-tp 747ee5b
WEB-4654 rename reset filters button
henry-tp 47b21f5
WEB-4654 clean up logic for label determination
henry-tp ff3be8d
WEB-4654 fix breaking test
henry-tp 8bcd604
Merge branch 'WEB-4654-filter-bar' into WEB-4654-tags
henry-tp 332a835
Merge branch 'WEB-4654-tags' into WEB-4654-data-recency
henry-tp fa78178
Merge branch 'WEB-4654-data-recency' into WEB-4654-summary-period
henry-tp a97d665
Merge branch 'WEB-4654-summary-period' into WEB-4654-time-in-range
henry-tp ef670d2
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp db493a6
WEB-4654 optimize tag icon
henry-tp 168b43a
WEB-4654 abstract out summary period options
henry-tp aa3d53c
WEB-4654 fix prefixpophealthmetric
henry-tp a9b544d
WEB-4654 fix metrics tracking
henry-tp a3dc964
WEB-4654 fix metrics tracking
henry-tp 0a58dae
WEB-4654 fix SummaryPeriod tests
henry-tp 800407a
Merge branch 'WEB-4654-summary-period' into WEB-4654-time-in-range
henry-tp 3963a49
WEB-4654 fix tests for WEB-4654-time-in-range
henry-tp 0901ffe
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp 65123c3
WEB-4654 fix tests
henry-tp b7c5d26
WEB-4654 fix tests
henry-tp d4d3821
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp dfecb45
WEB-4654 use MemoryRouter instead of mocking out location hook
henry-tp 41a107a
Merge branch 'WEB-4654-tags' into WEB-4654-data-recency
henry-tp b8087c9
WEB-4654 use MemoryRouter instead of mocking out location hook
henry-tp 467774d
Merge branch 'WEB-4654-data-recency' into WEB-4654-summary-period
henry-tp c2de335
WEB-4654 use MemoryRouter instead of mocking out location hook
henry-tp c857c03
Merge branch 'WEB-4654-summary-period' into WEB-4654-time-in-range
henry-tp 3ec296b
WEB-4654 use MemoryRouter instead of mocking out location hook
henry-tp fc2614e
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp e0edb0c
WEB-4654 use MemoryRouter instead of mocking out location hook
henry-tp d6f0e85
WEB-4654 autofocus search on mount
henry-tp 50bfacd
WEB-4654 dropdown mounts from top right
henry-tp dac1fd5
WEB-4654 remove unused var
henry-tp 9424e83
Merge branch 'WEB-4654-filter-bar' into WEB-4654-tags
henry-tp 1d01fc2
WEB-4654 remove unused var
henry-tp 1023fb1
Merge branch 'WEB-4654-tags' into WEB-4654-data-recency
henry-tp c384324
WEB-4654 remove unused var
henry-tp 66bc00f
WEB-4654 remove unused var
henry-tp 4dd906f
Merge branch 'WEB-4654-data-recency' into WEB-4654-summary-period
henry-tp afd2442
WEB-4654 remove unused var
henry-tp f4768d4
Merge branch 'WEB-4654-summary-period' into WEB-4654-time-in-range
henry-tp 17ef2fb
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp 33961fe
WEB-4654 remove unused vars
henry-tp 23c9bc2
WEB-4654 add missing pluralization strings
henry-tp a150632
WEb-4654 sort tags/sites alphabetically in tray
henry-tp ff50288
WEB-4654 remove pendingFilters dead state
henry-tp 279c4f0
Merge branch 'WEB-4654-filter-bar' into WEB-4654-cgm-use
henry-tp 9e6056b
WEB-4654 remove unnecessary comments in tests
henry-tp 5279bce
WEB-4654 fix jumping issue
henry-tp e749547
WEB-4654 use overflow clip to prevent jump
henry-tp 552162d
Merge branch 'WEB-4654-tags' into WEB-4654-cgm-use
henry-tp 331634c
WEB-4654 revert reverse order of TIR dropdown
henry-tp 8582105
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp 69c3cd8
WEB-4654 fix not meeting TIR label
henry-tp 0c205fd
WEB-4654 fix trackMetric calls
henry-tp a4dcf28
WEB-4654 fix missing metric update
henry-tp 6ac7ce4
WEB-4654 fix missing metric update
henry-tp b48f56c
WEB-4654 update pageName
henry-tp f5b10dc
WEB-4654 update pageName
henry-tp 7db9b8e
WEB-4654 update pageName
henry-tp 94c7db8
WEB-4654 update pageName
henry-tp 30d791a
WEB-4654 fix missing CGM use clear case
henry-tp 822e03b
Merge branch 'WEB-4654-filter-bar' into WEB-4654-tags
henry-tp 7e337a1
Merge branch 'WEB-4654-tags' into WEB-4654-data-recency
henry-tp 5a1e32c
Merge branch 'WEB-4654-data-recency' into WEB-4654-summary-period
henry-tp a59de3b
Merge branch 'WEB-4654-summary-period' into WEB-4654-time-in-range
henry-tp 10c09bf
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp 7ac0870
WEB-4654 update imports for consistency
henry-tp aee5467
Merge branch 'WEB-4654-filter-bar' into WEB-4654-tags
henry-tp 88e3baf
Merge branch 'WEB-4654-tags' into WEB-4654-data-recency
henry-tp f29a164
Merge branch 'WEB-4654-data-recency' into WEB-4654-summary-period
henry-tp 36dab83
Merge branch 'WEB-4654-summary-period' into WEB-4654-time-in-range
henry-tp 741c5f9
WEB-4654 abstract timeInRangeFilterThresholds for consistency
henry-tp 79841f6
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp 990ffa4
WEB-4654 fix tests
henry-tp 7a8b72d
Merge branch 'WEB-4654-data-recency' into WEB-4654-summary-period
henry-tp 11d2e79
Merge branch 'WEB-4654-summary-period' into WEB-4654-time-in-range
henry-tp 5235683
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp b5f2665
WEB-4654 fix render condition
henry-tp a3dedb5
WEB-4654 add new NoSearchResults component
henry-tp 1fa6143
WEB-4654 update range labels per design
henry-tp ef528e7
Merge branch 'WEB-4654-tags' into WEB-4654-data-recency
henry-tp 3f70e8f
Merge branch 'WEB-4654-data-recency' into WEB-4654-summary-period
henry-tp 07aca9a
Merge branch 'WEB-4654-summary-period' into WEB-4654-time-in-range
henry-tp b1f9230
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp 9df79f9
WEB-4654 change to Extreme High label
henry-tp 20348b9
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp d2966cb
Revert "WEB-4654 change to Extreme High label"
henry-tp 7a3c66d
Revert "WEB-4654 update range labels per design"
henry-tp afb4730
WEB-4654 revert changes for ExtremeHigh
henry-tp 5f8d975
WEb-4654 fix option id
henry-tp b7a46f0
WEB-4654 add subtext for tags & sites
henry-tp b02c3a7
Merge branch 'WEB-4654-tags' into WEB-4654-data-recency
henry-tp af4f879
WEB-4654 fix data recency title
henry-tp 952e2b2
Merge branch 'WEB-4654-data-recency' into WEB-4654-summary-period
henry-tp 43c3311
WEB-4654 fix summary period dropdown label
henry-tp b6090c5
Merge branch 'WEB-4654-summary-period' into WEB-4654-time-in-range
henry-tp 1331c1a
WEB-4654 fix TIR dropdown label
henry-tp d833622
WEB-4654 fix cgm use label
henry-tp e74810a
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp bdc2ee0
WEB-4654 expand clickable area of Filter Tray
henry-tp d8a552c
WEB-4654 fix Not in Range label in ActiveFiltersTray
henry-tp d7de2dd
WEB-4654 make X keyboard tabbable
henry-tp a33b3e4
WEB-4654 modify use of i18next
henry-tp fb6a1b1
WEB-4654 add propTypes
henry-tp 01eed27
WEB-4654 add propTypes
henry-tp be63d11
WEb-4654 add propTypes
henry-tp ac1f324
WEB-4654 add propTypes for summary period
henry-tp 52d49ad
WEB-4654 add propTypes
henry-tp 40ba25c
WEB-4654 add propTypes for CGM use
henry-tp 9467d98
WEb-4654 fix add tag/site button position
henry-tp 86d3268
WEB-4654 fix tests
henry-tp e8e227b
Merge branch 'WEB-4654-tags' into WEB-4654-data-recency
henry-tp 909ff85
WEB-4654 remove unused imports, harmonize useIsClinicAdmin use
henry-tp b9ec180
WEB-4654 fix color import
henry-tp 005e795
WEB-4654 remove unused imports
henry-tp 4ce2906
WEB-4654 remove unused imports
henry-tp 2697f1c
WEB-4654 remove unused imports
henry-tp d7dc5c8
WEB-4654 remove unused imports
henry-tp 684bb38
Merge pull request #1980 from tidepool-org/WEB-4654-filter-bar
henry-tp 08a49c8
Merge pull request #1985 from tidepool-org/WEB-4654-tags
henry-tp 95d82c0
WEB-4654 remove unused state piece
henry-tp bf624a7
Merge pull request #1986 from tidepool-org/WEB-4654-data-recency
henry-tp 236096d
Merge branch 'feat/filter-enhancements' into WEB-4654-summary-period
henry-tp 639fe1b
WEB-4654 address review formatting and propType feedback
henry-tp a0143d5
WEB-4654 resolve code duplication for labelling
henry-tp 35f09a0
WEB-4654 use tie proptype enum to options definition
henry-tp ca01d1c
Merge branch 'WEB-4654-summary-period' into WEB-4654-time-in-range
henry-tp 217a552
Merge branch 'WEB-4654-time-in-range' into WEB-4654-cgm-use
henry-tp 0348548
Merge pull request #1989 from tidepool-org/WEB-4654-summary-period
henry-tp fd71f21
WEB-4654 abstract out label definition
henry-tp f9aa7f6
WEB-4654 fix reset filters key
henry-tp 187f974
WEB-4654 address review feedback
henry-tp e7331ec
Merge pull request #1990 from tidepool-org/WEB-4654-time-in-range
henry-tp dd30a22
Merge pull request #2000 from tidepool-org/WEB-4654-cgm-use
henry-tp a0c185e
Merge branch 'develop' into feat/filter-enhancements
henry-tp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 162 additions & 0 deletions
162
__tests__/unit/app/pages/clinicworkspace/clinicPatientsFilters/AppliedFiltersList.test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| import React from 'react'; | ||
| import { render, screen } from '@testing-library/react'; | ||
| import userEvent from '@testing-library/user-event'; | ||
| import configureStore from 'redux-mock-store'; | ||
| import { thunk } from 'redux-thunk'; | ||
| import { Provider } from 'react-redux'; | ||
| import { ThemeProvider } from 'theme-ui'; | ||
|
|
||
| import theme from '@app/themes/baseTheme'; | ||
| import AppliedFiltersList from '@app/pages/clinicworkspace/clinicPatientsFilters/AppliedFiltersList'; | ||
| import { defaultFilterState, SPECIAL_FILTER_STATES } from '@app/pages/clinicworkspace/useClinicPatientsFilters'; | ||
|
|
||
| const mockStore = configureStore([thunk]); | ||
|
|
||
| const FULLY_ACTIVE_FILTERS = { | ||
| ...defaultFilterState, | ||
| lastData: 14, | ||
| lastDataType: 'cgm', | ||
| timeInRange: ['timeInTargetPercent', 'timeInVeryLowPercent'], | ||
| patientTags: ['tag1', 'tag2'], | ||
| clinicSites: ['site1', 'site2'], | ||
| }; | ||
|
|
||
| const buildState = ({ | ||
| fetchedPatientCount = 5, | ||
| patientListSearchTextInput = '', | ||
| } = {}) => ({ | ||
| blip: { | ||
| selectedClinicId: 'clinic123', | ||
| clinics: { | ||
| 'clinic123': { | ||
| id: 'clinic123', | ||
| fetchedPatientCount, | ||
| patientTags: [ | ||
| { id: 'tag1', name: 'Tag One' }, | ||
| { id: 'tag2', name: 'Tag Two' }, | ||
| ], | ||
| sites: [ | ||
| { id: 'site1', name: 'Site Alpha' }, | ||
| { id: 'site2', name: 'Site Bravo' }, | ||
| ], | ||
| }, | ||
| }, | ||
| patientListFilters: { patientListSearchTextInput }, | ||
| }, | ||
| }); | ||
|
|
||
| const renderList = ({ | ||
| activeFilters = defaultFilterState, | ||
| setActiveFilters = jest.fn(), | ||
| onClearSearch = jest.fn(), | ||
| onResetFilters = jest.fn(), | ||
| state = buildState(), | ||
| } = {}) => { | ||
| const store = mockStore(state); | ||
|
|
||
| const utils = render( | ||
| <Provider store={store}> | ||
| <ThemeProvider theme={theme}> | ||
| <AppliedFiltersList | ||
| activeFilters={activeFilters} | ||
| setActiveFilters={setActiveFilters} | ||
| onClearSearch={onClearSearch} | ||
| onResetFilters={onResetFilters} | ||
| /> | ||
| </ThemeProvider> | ||
| </Provider> | ||
| ); | ||
|
|
||
| return { ...utils, setActiveFilters, onClearSearch, onResetFilters }; | ||
| }; | ||
|
|
||
| describe('AppliedFiltersList', () => { | ||
| describe('clear/reset controls', () => { | ||
| it('shows a "Reset Filters" control that fires onResetFilters when only filters are active', async () => { | ||
| const { onResetFilters, onClearSearch } = renderList({ | ||
| activeFilters: { ...defaultFilterState, timeInRange: ['timeInTargetPercent'] }, | ||
| }); | ||
|
|
||
| await userEvent.click(screen.getByRole('button', { name: 'Reset All Filters' })); | ||
|
|
||
| expect(onResetFilters).toHaveBeenCalledTimes(1); | ||
| expect(onClearSearch).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it('shows a "Clear Search" control that fires onClearSearch when only a search is active', async () => { | ||
| const { onClearSearch, onResetFilters } = renderList({ | ||
| activeFilters: defaultFilterState, | ||
| state: buildState({ patientListSearchTextInput: 'john' }), | ||
| }); | ||
|
|
||
| await userEvent.click(screen.getByRole('button', { name: 'Clear Search' })); | ||
|
|
||
| expect(onClearSearch).toHaveBeenCalledTimes(1); | ||
| expect(onResetFilters).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it('shows both controls, each wired to its own callback, when a filter and a search are both active', async () => { | ||
| const { onClearSearch, onResetFilters } = renderList({ | ||
| activeFilters: { ...defaultFilterState, timeInRange: ['timeInTargetPercent'] }, | ||
| state: buildState({ patientListSearchTextInput: 'john' }), | ||
| }); | ||
|
|
||
| await userEvent.click(screen.getByRole('button', { name: 'Reset All Filters' })); | ||
| await userEvent.click(screen.getByRole('button', { name: 'Clear Search' })); | ||
|
|
||
| expect(onResetFilters).toHaveBeenCalledTimes(1); | ||
| expect(onClearSearch).toHaveBeenCalledTimes(1); | ||
| }); | ||
| }); | ||
|
|
||
| describe('removing filters fires setActiveFilters correctly', () => { | ||
| it('resets lastData and lastDataType to their defaults when the data-recency chip is removed', async () => { | ||
| const { setActiveFilters } = renderList({ activeFilters: FULLY_ACTIVE_FILTERS }); | ||
|
|
||
| await userEvent.click(screen.getByLabelText('Remove CGM data within 14 days filter')); | ||
|
|
||
| expect(setActiveFilters).toHaveBeenCalledTimes(1); | ||
| expect(setActiveFilters).toHaveBeenCalledWith({ | ||
| ...FULLY_ACTIVE_FILTERS, | ||
| lastData: defaultFilterState.lastData, | ||
| lastDataType: defaultFilterState.lastDataType, | ||
| }); | ||
| }); | ||
|
|
||
| it('removes only the clicked time-in-range value, preserving the others', async () => { | ||
| const { setActiveFilters } = renderList({ activeFilters: FULLY_ACTIVE_FILTERS }); | ||
|
|
||
| await userEvent.click(screen.getByLabelText('Remove %TIR = Not in Range filter')); | ||
|
|
||
| expect(setActiveFilters).toHaveBeenCalledTimes(1); | ||
| expect(setActiveFilters).toHaveBeenCalledWith({ | ||
| ...FULLY_ACTIVE_FILTERS, | ||
| timeInRange: ['timeInVeryLowPercent'], | ||
| }); | ||
| }); | ||
|
|
||
| it('removes only the clicked patient tag, preserving the others', async () => { | ||
| const { setActiveFilters } = renderList({ activeFilters: FULLY_ACTIVE_FILTERS }); | ||
|
|
||
| await userEvent.click(screen.getByLabelText('Remove Tag One filter')); | ||
|
|
||
| expect(setActiveFilters).toHaveBeenCalledTimes(1); | ||
| expect(setActiveFilters).toHaveBeenCalledWith({ | ||
| ...FULLY_ACTIVE_FILTERS, | ||
| patientTags: ['tag2'], | ||
| }); | ||
| }); | ||
|
|
||
| it('removes only the clicked clinic site, preserving the others', async () => { | ||
| const { setActiveFilters } = renderList({ activeFilters: FULLY_ACTIVE_FILTERS }); | ||
|
|
||
| await userEvent.click(screen.getByLabelText('Remove Site Alpha filter')); | ||
|
|
||
| expect(setActiveFilters).toHaveBeenCalledTimes(1); | ||
| expect(setActiveFilters).toHaveBeenCalledWith({ | ||
| ...FULLY_ACTIVE_FILTERS, | ||
| clinicSites: ['site2'], | ||
| }); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Assert the 14-day span that the comment describes.
The comment states the test asserts the presence and the 14-day span of the bounds. The assertion checks only that both values are strings. Compute the difference so the test fails if the window changes.
💚 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents