Skip to content
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

Upgrade from MUI4 to MUI5 [breaking changes] #3648

Merged
merged 227 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
227 commits
Select commit Hold shift + click to select a range
87ea094
Update to MUI 5.x and run npx @mui/codemod v5.0.0/preset-safe over th…
cbeer Mar 29, 2023
863ebcd
Add the MUI theme provider to the custom renderer
cbeer Mar 29, 2023
53c3908
Update tests for MUI 5
cbeer Mar 29, 2023
a2e1e1f
Replace srOnly class with visually-hidden style
cbeer Mar 29, 2023
f3baf99
Update to latest MUI 5.x
Jun 14, 2023
44699af
Add babel plugin dev dependency
Jun 14, 2023
6924bb3
Add mui/utils dependency
Jun 21, 2023
be17ab4
Restructure component definitions
Jun 21, 2023
68c3629
Delete 'tReady' parameter from menu props
Jun 21, 2023
c12a3d6
Address linting errors
Jun 28, 2023
5533d95
Merge branch 'master' into mui5
Aug 1, 2023
f4ae9c9
Add useWidth method
Aug 3, 2023
696085f
Fix scripts import order
Aug 3, 2023
7b2396e
Fix scripts import order
Aug 3, 2023
d4cf246
Add PrimaryWindow test id
Aug 7, 2023
4949711
Merge branch 'master' into mui5
Aug 22, 2023
8dc0ab5
Migrate components to MUI v5 with sx/styled API
Sep 12, 2023
a516b79
Migrate WorkspaceOptionsButton to MUI v5 with styled API
Sep 13, 2023
53b9b16
Migrate MenuButtons to MUI v5 with sx/styled API
Sep 14, 2023
4726ec9
Migrate components to MUI v5 with sx/styled API
Sep 14, 2023
261ebb4
Migrate components to MUI v5 with sx/styled API
Sep 14, 2023
9c8185b
Fix linting errors
Sep 14, 2023
e9effd9
Adjust GalleryViewThumbnail config
Sep 14, 2023
c763673
Migrate components to MUI v5 with sx/styled API
Sep 18, 2023
fb9634c
align mui5 styled / sx naming
Sep 18, 2023
c5603a4
Migrate components to MUI v5 with sx/styled API
Sep 18, 2023
1c35c9d
Migrate components to MUI v5 with sx/styled API
Sep 19, 2023
7800c41
Fix linting errors
Sep 19, 2023
1945f31
Migrate components to MUI v5 with sx/styled API
Sep 19, 2023
c6936cc
Migrate components to MUI v5 with sx/styled API
Sep 20, 2023
160b26d
Fix padding/margin theme values
Sep 20, 2023
788ea70
Fix conditional sx styling
Sep 20, 2023
c47e70c
Fix sx backgroundcolor strings
Sep 21, 2023
1916280
Enable color for dark mode
Sep 21, 2023
4b2aab6
Fix styled component syntax
Sep 21, 2023
6fa7934
Adjust naming for styled/sx components
Sep 26, 2023
7d64191
Remove test reference to classes for SanitizedHtml component
marlo-longley Oct 27, 2023
3b0f441
Remove test reference to classes for CompanionArea component
marlo-longley Oct 27, 2023
8ef6810
Add ns back as prefix for CompanionArea component
marlo-longley Oct 27, 2023
f1c0d24
Remove test reference to classes for CompanionWindow component
marlo-longley Oct 27, 2023
bbe3af9
Remove test reference to classes and unnecessary tests for GalleryVie…
marlo-longley Oct 27, 2023
f03b79f
Use updated selectors in LocalePicker component tests
marlo-longley Oct 27, 2023
4ac5f58
Use data attribute to test for active status in ManifestListItem comp…
marlo-longley Oct 27, 2023
54b3a47
Remove reference to classes in SearchHit component test
marlo-longley Oct 27, 2023
de4c766
Test for function call rather than style in ThumbnailCanvasGrouping
marlo-longley Oct 27, 2023
3f5c65e
Remove reference to classes for WindowSideBar test
marlo-longley Oct 27, 2023
c428b57
Remove reference to classes in WindowSideBarCanvasPanel test
marlo-longley Oct 27, 2023
0e9d28d
Test for attribute rather than class in WindowTopMenuButton component
marlo-longley Oct 27, 2023
6eec7f0
Don't test for classes in WorkspaceElasticWindow component
marlo-longley Oct 27, 2023
d03635d
Use a testable method to check for divider in ZoomControls
marlo-longley Oct 27, 2023
05ce84b
Don't double nest h2 components in Workspace dialogs
marlo-longley Oct 27, 2023
5b47597
Remove getContentAnchorEl prop as it is unsupported in MUI5
marlo-longley Oct 27, 2023
efc3ed2
Remove reference to flakey 404 manifest
marlo-longley Oct 27, 2023
52822b8
Use valid color variable for WorkspaceArea background
marlo-longley Oct 27, 2023
8932afd
Migrate MUI Tree View from labs to mui-x
marlo-longley Nov 9, 2023
bbab594
Address linter errors
marlo-longley Nov 9, 2023
9b53dff
Avoid nesting h2 elements
marlo-longley Nov 9, 2023
d348a06
Merge pull request #3793 from marlo-longley/mui5-tests
phil-plencner-hl Nov 9, 2023
38c36a6
Fix styling in companion window panels
marlo-longley Nov 10, 2023
2627f47
Remove invalid prop from CanvasAnnotations
marlo-longley Nov 10, 2023
f48d5e1
Merge pull request #3803 from ProjectMirador/companion-fixes
cbeer Nov 20, 2023
9b069eb
Fix linting errors
Nov 21, 2023
00b8980
Add mui5 emotion right-to-left support
Nov 21, 2023
863aea1
Run CI tests when making PRs against the mui5 branch
marlo-longley Oct 26, 2023
63a8419
selected Thumbnails have class 'selected'
barmintor Oct 26, 2023
51eb3d4
ManifestListItem component sets selected from active prop, has class …
barmintor Oct 26, 2023
472cadd
SearchHit component ListItems have class 'windowSelected' if inidicat…
barmintor Oct 26, 2023
8fbe37c
CompanionArea component uses namespaced position class and includes c…
barmintor Oct 26, 2023
359570c
CompanionWindow component renders layout and size classes configured …
barmintor Oct 26, 2023
8825332
SanitizedHtml component renders root class configured in props
barmintor Oct 26, 2023
a6473fe
ScrollIndicatedDialogContent component renders configured shadowScrol…
barmintor Oct 27, 2023
179b227
WindowSideBar component renders configured drawer class name from pro…
barmintor Oct 27, 2023
8366596
ZoomControls renders divider with configured className from props if …
barmintor Oct 27, 2023
df39388
WindowTopMenuButton renders configured ctrlBtnSelected from props on …
barmintor Oct 27, 2023
aa828e5
WorkspaceElasticWindow renders configured focused className if given …
barmintor Oct 27, 2023
072702b
remove cn and use namespaced class on Window component
barmintor Oct 27, 2023
0847e2a
Merge pull request #3804 from ProjectMirador/3795-mui5-tests-rebased
cbeer Nov 21, 2023
8d9481d
Decrease the margin for window menu buttons
cbeer Nov 21, 2023
d59382c
Use the dense Toolbar variant to get a better height toolbar
cbeer Nov 21, 2023
8dd435f
Center the companionArea expand/collapse toggle icon
cbeer Nov 21, 2023
03e7962
Use the outlined paper variant for the sidebar, but suppress other bo…
cbeer Nov 21, 2023
9e62462
Add a custom background color for annotation + search chips in the ga…
cbeer Nov 21, 2023
9bee625
Pass sx properties through MiradorMenuButton
cbeer Nov 21, 2023
ea9e419
Align the collapsable section controls
cbeer Nov 21, 2023
2a4d1d1
Give the workspace add resource button a little spacing
cbeer Nov 21, 2023
c73d29a
Restore spacing to the collection modal dialog
cbeer Nov 21, 2023
ea639fa
Apply styles to the ToC nodes
cbeer Nov 21, 2023
0d1a938
Merge pull request #3811 from ProjectMirador/mui5-toc-style
jcoyne Nov 21, 2023
92998c0
Merge pull request #3812 from ProjectMirador/mui5-collection-dialog
jcoyne Nov 21, 2023
c307773
Merge pull request #3810 from ProjectMirador/mui5-spacing
jcoyne Nov 21, 2023
3d1947f
Merge pull request #3809 from ProjectMirador/mui5-gallery-chips
jcoyne Nov 21, 2023
83e207d
Merge pull request #3808 from ProjectMirador/mui5-companion-window
jcoyne Nov 21, 2023
866cd8a
Merge pull request #3807 from ProjectMirador/center-collapse-icon
jcoyne Nov 21, 2023
c79062b
Merge pull request #3806 from ProjectMirador/paper-border
jcoyne Nov 21, 2023
9e998e3
Merge pull request #3805 from ProjectMirador/window-top-menu-button-m…
cbeer Nov 21, 2023
a45039a
Fix layer drag handle spacing
cbeer Nov 21, 2023
555f091
Merge pull request #3813 from ProjectMirador/mui5-layer-drag
jcoyne Nov 21, 2023
6a4fa53
Update CI to use current LTS node releases
cbeer Nov 22, 2023
e43d334
Restore auth banner colors
cbeer Nov 21, 2023
1d9f208
Remove unnecessary value for boolean property
cbeer Nov 22, 2023
d21c4d5
Always give the title controls some space
cbeer Nov 22, 2023
f793ee5
Merge pull request #3814 from ProjectMirador/mui5-auth-bar
marlo-longley Nov 22, 2023
07f1a73
Merge pull request #3815 from ProjectMirador/mui5-bool
marlo-longley Nov 22, 2023
f5a087f
Merge pull request #3816 from ProjectMirador/mui5-title-controls
marlo-longley Nov 22, 2023
4ea1ae9
Remove unused classes propType
marlo-longley Nov 22, 2023
40db475
Use an explicit dom ref for handling scrolling to dom elements
cbeer Nov 27, 2023
bf8ba15
Merge pull request #3819 from ProjectMirador/mui5-scrollto
jcoyne Nov 27, 2023
5ff6a3b
Merge pull request #3818 from ProjectMirador/remove-unused-proptypes
cbeer Nov 27, 2023
0b5121f
Extract a styled CompanionWindowSection
cbeer Nov 27, 2023
ea70a21
Merge pull request #3820 from ProjectMirador/mui5-companion-windo
jcoyne Nov 28, 2023
785ba3b
Use an MUI accordion for the sidebar collapsing sections
cbeer Nov 28, 2023
de50dc1
Create a MenuItem variant instead of using inline sx styles
cbeer Nov 28, 2023
ee69853
Merge pull request #3823 from ProjectMirador/mui5-menu-item-variant
marlo-longley Nov 29, 2023
729a8fa
Merge pull request #3822 from ProjectMirador/mui5-accordion
jcoyne Nov 29, 2023
11ad6cc
Push the styled element closer to the DOM
cbeer Nov 29, 2023
92db8c3
Push IIIFThumbnail styling into slots + variants
cbeer Nov 29, 2023
e1869d7
Refactor WindowCanvasNavigationControls to pull stacking + alignment up
cbeer Nov 29, 2023
7a59d5c
Merge pull request #3825 from ProjectMirador/mui5-window-canvas-controls
jcoyne Nov 29, 2023
ef80ab0
Merge pull request #3824 from ProjectMirador/mui5-iiif-thumbnail
jcoyne Nov 29, 2023
d5f2e94
Refactor ErrorContent to use styled slots
cbeer Nov 29, 2023
e383dcd
Create a Dialog variant to contain a modal within a mirador window
cbeer Nov 29, 2023
277f4b1
Pull button margins up to its container
cbeer Nov 29, 2023
101d3ba
Merge pull request #3828 from ProjectMirador/button-margins
jcoyne Nov 29, 2023
c938312
Merge pull request #3827 from ProjectMirador/mui5-dialog
jcoyne Nov 29, 2023
346c7f9
Fix the CSS selector for restoring a focus state to the Fab
cbeer Nov 30, 2023
d319e2f
Use MenuItem divider prop instead of styling it ourselves
cbeer Nov 30, 2023
62de377
Merge pull request #3830 from ProjectMirador/mui5-fab-css
jcoyne Nov 30, 2023
c2fbccb
Merge pull request #3829 from ProjectMirador/mui5-divider
jcoyne Nov 30, 2023
3ff4055
Restyle the WorkspaceExport form
cbeer Nov 30, 2023
532df4e
Merge pull request #3826 from ProjectMirador/mui5-error-content
jcoyne Nov 30, 2023
7088754
Remove unnecessary StyledMiradorMenuButton
cbeer Nov 30, 2023
fa3a15b
Merge pull request #3832 from ProjectMirador/mui5-styled-button
jcoyne Dec 1, 2023
0ea8c42
Get rid of nested h2s by pulling the styling up to the DialogTitle
cbeer Dec 1, 2023
079c2a2
Pull theme selection styles up to settings
cbeer Dec 1, 2023
a4be725
Extract WorkspaceDialog for styling workspace-level dialogs
cbeer Dec 1, 2023
0a218e6
Merge pull request #3833 from ProjectMirador/mui5-workspace-dialogs
jcoyne Dec 1, 2023
05d418d
Push companion window styles up to settings
cbeer Dec 4, 2023
04cf98a
Pull companion area styling up
cbeer Dec 4, 2023
0493ad5
Pull SanitizedHtml styling up
cbeer Dec 4, 2023
b858fbf
Merge pull request #3836 from ProjectMirador/sanitized-html
jcoyne Dec 4, 2023
0876087
Pull Window styles up
cbeer Dec 4, 2023
279fe49
Pull workspace styles up
cbeer Dec 4, 2023
493f984
Merge pull request #3838 from ProjectMirador/mui5-workspace
jcoyne Dec 5, 2023
1d9ea50
Pull WorkspaceControlPanel styles up
cbeer Dec 5, 2023
f7727f0
Create a common selected style for mirador buttons
cbeer Dec 5, 2023
9b3a49e
Merge pull request #3839 from ProjectMirador/mui5-workspace
jcoyne Dec 5, 2023
9d9a20f
Pull window options selection styles up
cbeer Dec 5, 2023
dd48269
Pull WindowTopBar styles up
cbeer Dec 5, 2023
ea6a128
Merge pull request #3841 from ProjectMirador/mui5-window-top-bar
jcoyne Dec 5, 2023
95d12e4
Merge pull request #3842 from ProjectMirador/mui5-window-options
jcoyne Dec 5, 2023
e0b9228
Use Badge color instead of custom styling
cbeer Dec 5, 2023
1e57133
Run tests using the Mirador MUI theme
cbeer Dec 5, 2023
8ff56d6
Merge pull request #3843 from ProjectMirador/mui5-badge-color
marlo-longley Dec 5, 2023
bb44477
Restore minWidth styling for left companion windows; fixes #3844
cbeer Dec 5, 2023
abbe2c8
Merge pull request #3835 from ProjectMirador/companion-area
jcoyne Dec 6, 2023
20e79b6
Merge pull request #3840 from ProjectMirador/mui5-mirador-button
marlo-longley Dec 6, 2023
01383ef
Merge pull request #3834 from ProjectMirador/mui5-cw-styles
jcoyne Dec 6, 2023
ef5808e
Remove apparently unused styles
cbeer Dec 6, 2023
b4aca3a
Fix ManifestListItem border state
cbeer Dec 6, 2023
ac7f634
Merge pull request #3845 from ProjectMirador/mui5-locale-picker-unused
marlo-longley Dec 6, 2023
08143b3
Merge pull request #3846 from ProjectMirador/mui5-border-state
jcoyne Dec 7, 2023
4628f25
Remove unnecessary styling on cancel button
cbeer Dec 7, 2023
2de12b0
Apply font-family with the correct selector
cbeer Dec 7, 2023
14129ab
Merge pull request #3847 from ProjectMirador/mui5-import-button
jcoyne Dec 7, 2023
beaa36f
Only nudge over badge content for the WindowListButton; it needs spec…
cbeer Dec 8, 2023
6575cab
Pull GalleryViewThumbnail styles up
cbeer Dec 8, 2023
0b543a3
Pull GalleryView styles up
cbeer Dec 8, 2023
30776dd
Merge pull request #3848 from ProjectMirador/mui5-gallery
jcoyne Dec 8, 2023
a1c52e2
Pull window sidebar styles up
cbeer Dec 8, 2023
3db2052
The Fab ripple is what gives it a focused state; instead of disabling…
cbeer Dec 8, 2023
b00ac10
Merge pull request #3849 from ProjectMirador/mui5-window-sidebar
jcoyne Dec 10, 2023
b96144b
Merge pull request #3850 from ProjectMirador/mui5-fab-ripple
jcoyne Dec 10, 2023
3afd10b
Style the workspace sidebar with flexbox
cbeer Dec 11, 2023
9fe8f71
Remove unnecessary button margin
cbeer Dec 12, 2023
10ac7d3
Merge pull request #3853 from ProjectMirador/mui5-button-margin
jcoyne Dec 12, 2023
c03eb24
Merge pull request #3852 from ProjectMirador/mui5-flex
jcoyne Dec 12, 2023
55e7161
Pull ManifestListItem styles up
cbeer Dec 11, 2023
342ff4e
Pull ScrollIndicatedDialogContent styles up
cbeer Dec 11, 2023
22aadde
Use MUIs built in divider styling
cbeer Dec 11, 2023
d547ebf
Create a new button variant for our 'button but look like regular tex…
cbeer Dec 11, 2023
06ae079
Pull search styles up and use built-in MUI components when possible
cbeer Dec 11, 2023
752d5fc
Pull search hit styling up
cbeer Dec 11, 2023
58e6f77
Merge pull request #3851 from ProjectMirador/mui5-search
jcoyne Dec 12, 2023
a77b850
Update ScrollTo to wrap the list/menu items without injecting additio…
cbeer Dec 12, 2023
d47c82a
Allow canvas labels to wrap
cbeer Dec 12, 2023
93751f7
Pull sidebar index styles up
cbeer Dec 12, 2023
cc276c5
Continue to apply custom tooltip margins
cbeer Dec 12, 2023
fa85ab8
Merge pull request #3855 from ProjectMirador/mui5-tooltip-margin
jcoyne Dec 12, 2023
66bce43
Merge pull request #3854 from ProjectMirador/mui5-sidebar-list-styles
jcoyne Dec 12, 2023
b924302
Merge pull request #3837 from ProjectMirador/mui5-window
jcoyne Dec 12, 2023
dd478de
Merge pull request #3831 from ProjectMirador/mui5-export
jcoyne Dec 12, 2023
90bbf2d
Fix branding alignment
cbeer Dec 12, 2023
7c0af08
Merge pull request #3856 from ProjectMirador/mui5-branding-alignment
marlo-longley Dec 13, 2023
dc66a10
Use the special dark mode dialog background color calculation
cbeer Dec 13, 2023
a9e082e
Reset the collection collapsible section background color for collect…
cbeer Dec 13, 2023
d55df5d
Wrap the empty workspace in paper to get the right background in dark…
cbeer Dec 13, 2023
40c9adc
Update annotation tags to avoid improperly nested HTML tags
cbeer Dec 13, 2023
7f9a0d7
Merge pull request #3857 from ProjectMirador/mui5-dark-mode
jcoyne Dec 13, 2023
8e8bf35
Merge pull request #3858 from ProjectMirador/mui5-empty-dark
jcoyne Dec 13, 2023
36908dd
Update jest-dom
cbeer Dec 13, 2023
fe66214
Use the new-style headless browser for testing
cbeer Dec 13, 2023
9760796
Allow new versions of i18next
cbeer Dec 13, 2023
c6c30db
Update puppeteer
cbeer Dec 14, 2023
b102c9e
Update react-i18next
cbeer Dec 14, 2023
ceaa8a0
Update jsdom
cbeer Dec 14, 2023
a08aa6a
Update glob
cbeer Dec 14, 2023
10863f2
Merge pull request #3860 from ProjectMirador/mui5-update
jcoyne Dec 14, 2023
bb3e763
remove unused clsx dependency
cbeer Dec 14, 2023
8d7178f
Replace redux-devtools-extension with @redux-devtools/extension
cbeer Dec 14, 2023
d23f628
Remove deprecated @mui/styles package
cbeer Dec 14, 2023
36730ab
Merge pull request #3861 from ProjectMirador/no-clsx
marlo-longley Dec 14, 2023
5513b9d
Merge pull request #3859 from ProjectMirador/mui5-span-tags
marlo-longley Dec 14, 2023
cc7330d
Merge pull request #3863 from ProjectMirador/mui5-redux-devtools
marlo-longley Dec 14, 2023
68e29d5
Merge pull request #3862 from ProjectMirador/no-mui-styles
jcoyne Dec 14, 2023
2514469
Don't hold space for companion windows if there aren't any.
cbeer Dec 18, 2023
ec6b764
Merge pull request #3867 from ProjectMirador/companion-window-size
jcoyne Dec 18, 2023
b481ead
Clean up WindowSideBar styling
cbeer Dec 19, 2023
2250f69
Make sure the CompanionArea styled root receives props necessary for …
cbeer Dec 19, 2023
589a51e
Trim wrapping divs where possible
cbeer Dec 19, 2023
8923572
Name Window slots
cbeer Dec 19, 2023
5ebf51f
Name the WorkspaceArea root component
cbeer Dec 20, 2023
1961328
Use flexbox to lay out the workspace
cbeer Dec 20, 2023
7306b0e
Use the palette shade for the workspace background
cbeer Dec 20, 2023
45ecb49
Use a consistent root styled component for the workspace
cbeer Dec 20, 2023
a476b2d
Fix elastic workspace panning
cbeer Dec 20, 2023
bc0cc02
Pull WorkspaceElastic styles up
cbeer Dec 20, 2023
afe3a3a
Merge pull request #3868 from ProjectMirador/mui5-clean-up-wrappers
jcoyne Dec 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
branches: [ master, mui5 ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 19.x]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v3
Expand Down
5 changes: 3 additions & 2 deletions __tests__/integration/mirador/thumbnail-navigation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ describe('Thumbnail navigation', () => {
await expect(page).toMatchElement('.mirador-window', { polling: 'mutation', timeout: 5000 });
});

it('navigates a manifest using thumbnail navigation', async () => {
// TODO: pick a new url; this Harvard one is 404
xit('navigates a manifest using thumbnail navigation', async () => {
await expect(page).toMatchElement('.mirador-thumb-navigation');
let windows = await page.evaluate(() => (
miradorInstance.store.getState().windows
Expand All @@ -20,7 +21,7 @@ describe('Thumbnail navigation', () => {
));
expect(Object.values(windows)[0].canvasId).toBe('https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-18737483'); // canvas @ index 1
});
it('displays on right side', async () => {
xit('displays on right side', async () => {
await expect(page).toMatchElement('.mirador-thumb-navigation');
await expect(page).toMatchElement('.mirador-companion-area-far-bottom .mirador-thumb-navigation');
const windowId = await page.evaluate(() => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/src/components/AppProviders.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Button from '@material-ui/core/Button';
import Button from '@mui/material/Button';
import { render, screen } from 'test-utils';
import { useTranslation } from 'react-i18next';
import { useDrop } from 'react-dnd';
Expand Down
6 changes: 3 additions & 3 deletions __tests__/src/components/CollapsibleSection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ describe('CollapsibleSection', () => {
expect(screen.getByRole('button')).toHaveAttribute('aria-label', 'expandSection');
});

it('renders children based on the open state', async () => {
expect(screen.getByTestId('child')).toBeInTheDocument();
it('displays children based on the open state', async () => {
expect(screen.getByTestId('child')).toBeVisible();
await userEvent.click(screen.getByRole('button'));
expect(screen.queryByTestId('child')).not.toBeInTheDocument();
expect(screen.queryByTestId('child')).not.toBeVisible();
});
});
2 changes: 1 addition & 1 deletion __tests__/src/components/CompanionArea.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('CompanionArea', () => {
it('should add the appropriate classes when the companion area fills the full width', () => {
const { container } = createWrapper({ position: 'bottom' });

expect(container.querySelector('.mirador-companion-area-bottom')).toHaveClass('horizontal'); // eslint-disable-line testing-library/no-node-access, testing-library/no-container
expect(container.querySelector('.mirador-companion-area-bottom')).toBeInTheDocument(); // eslint-disable-line testing-library/no-node-access, testing-library/no-container
});

it('renders the appropriate <CompanionWindow> components', () => {
Expand Down
12 changes: 3 additions & 9 deletions __tests__/src/components/CompanionWindow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ function createWrapper(props) {
isDisplayed
direction="ltr"
windowId="x"
classes={{ horizontal: 'horizontal', small: 'small', vertical: 'vertical' }}
companionWindow={{}}
position="right"
{...props}
Expand Down Expand Up @@ -96,9 +95,10 @@ describe('CompanionWindow', () => {
updateCompanionWindow,
});

expect(screen.getByRole('complementary')).toHaveClass('vertical');
expect(screen.getByRole('complementary')).toHaveClass('mirador-companion-window-right');

await user.click(screen.getByRole('button', { name: 'moveCompanionWindowToBottom' }));

expect(updateCompanionWindow).toHaveBeenCalledWith({ position: 'bottom' });
});
});
Expand All @@ -113,7 +113,7 @@ describe('CompanionWindow', () => {
updateCompanionWindow,
});

expect(screen.getByRole('complementary')).toHaveClass('horizontal');
expect(screen.getByRole('complementary')).toHaveClass('mirador-companion-window-bottom ');

await user.click(screen.getByRole('button', { name: 'moveCompanionWindowToRight' }));

Expand All @@ -127,12 +127,6 @@ describe('CompanionWindow', () => {
expect(screen.getByTestId('xyz')).toBeInTheDocument();
});

it('adds a small class when the component width is small', () => {
const { container } = createWrapper({ size: { width: 369 } });

expect(container.querySelector('.MuiToolbar-root')).toHaveClass('small'); // eslint-disable-line testing-library/no-node-access, testing-library/no-container
});

it('has a resize handler', () => {
const { container } = createWrapper();

Expand Down
21 changes: 0 additions & 21 deletions __tests__/src/components/GalleryViewThumbnail.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ function createWrapper(props) {
return render(
<GalleryViewThumbnail
canvas={Utils.parseManifest(manifestJson).getSequences()[0].getCanvases()[0]}
classes={{ selected: 'selected' }}
focusOnCanvas={() => {}}
setCanvas={() => {}}
{...props}
Expand All @@ -23,26 +22,6 @@ describe('GalleryView', () => {
beforeEach(() => {
window.HTMLElement.prototype.scrollIntoView = jest.fn();
});
it('sets a mirador-current-canvas-grouping class when the canvas is selected', () => {
createWrapper({ selected: true });
expect(screen.getByRole('button')).toBeInTheDocument();
expect(screen.getByRole('button')).toHaveClass('selected');
});
it('does not set a mirador-current-canvas-grouping class when the canvas is not selected', () => {
createWrapper({ selected: false });
expect(screen.getByRole('button')).toBeInTheDocument();
expect(screen.getByRole('button')).not.toHaveClass('selected');
});
it('sets a mirador-current-canvas-grouping class when the canvas is selected', () => {
createWrapper({ selected: true });
expect(screen.getByRole('button')).toBeInTheDocument();
expect(screen.getByRole('button')).toHaveClass('selected');
});
it('does not set a mirador-current-canvas-grouping class when the canvas is not selected', () => {
createWrapper({ selected: false });
expect(screen.getByRole('button')).toBeInTheDocument();
expect(screen.getByRole('button')).not.toHaveClass('selected');
});
it('renders the thumbnail', () => {
createWrapper({ config: { height: 55 } });
expect(screen.getByRole('presentation')).toBeInTheDocument();
Expand Down
15 changes: 7 additions & 8 deletions __tests__/src/components/IIIFAuthentication.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,15 @@ describe('IIIFAuthentication', () => {
describe('without an auth service', () => {
it('renders nothing', () => {
createWrapper({ authServiceId: null });
expect(screen.queryByText('login', { selector: 'span' })).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: 'login' })).not.toBeInTheDocument();
expect(screen.queryByRole('button')).not.toBeInTheDocument();
});
});
describe('with an available auth service', () => {
it('renders a login bar', async () => {
const handleAuthInteraction = jest.fn();
createWrapper({ handleAuthInteraction });
const confirmBtn = screen.getByText('login', { selector: 'span' });
expect(confirmBtn).toBeInTheDocument();
await user.click(confirmBtn);
await user.click(screen.getByRole('button', { name: 'login' }));
expect(handleAuthInteraction).toHaveBeenCalledWith('w', 'http://example.com/auth');
});
it('renders nothing for a non-interactive login', () => {
Expand All @@ -55,7 +53,8 @@ describe('IIIFAuthentication', () => {
it('renders with an error message', async () => {
const handleAuthInteraction = jest.fn();
createWrapper({ handleAuthInteraction, status: 'failed' });
const confirmBtn = await screen.findByText('retry', { selector: 'span' });
await user.click(screen.getByRole('button', { name: 'continue' }));
const confirmBtn = screen.getByRole('button', { name: /retry/ });
expect(screen.getByText('Login failed')).toBeInTheDocument();
expect(screen.getByText('cancel')).toBeInTheDocument();
expect(screen.getByText('... and this is why.')).toBeInTheDocument();
Expand All @@ -71,7 +70,7 @@ describe('IIIFAuthentication', () => {
window.open = mockWindowOpen;
const resolveCookieMock = jest.fn();
createWrapper({ resolveAuthenticationRequest: resolveCookieMock, status: 'cookie' });
expect(screen.getByText('login', { selector: 'span' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'login' })).toBeInTheDocument();
expect(mockWindowOpen).toHaveBeenCalledWith(`http://example.com/auth?origin=${window.origin}`, 'IiifLoginSender', 'centerscreen');
mockWindow.closed = true;
jest.runOnlyPendingTimers();
Expand All @@ -81,7 +80,7 @@ describe('IIIFAuthentication', () => {
it('does the IIIF access token behavior', async () => {
const resolveTokenMock = jest.fn();
createWrapper({ resolveAccessTokenRequest: resolveTokenMock, status: 'token' });
expect(screen.getByText('login', { selector: 'span' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'login' })).toBeInTheDocument();
window.dispatchEvent(new MessageEvent('message', {
data: { messageId: 'http://example.com/token' },
}));
Expand All @@ -100,7 +99,7 @@ describe('IIIFAuthentication', () => {
resetAuthenticationState,
status: 'ok',
});
const confirmBtn = await screen.findByText('exit', { selector: 'span' });
const confirmBtn = await screen.findByRole('button', { name: 'exit' });
await user.click(confirmBtn);
await waitFor(() => expect(resetAuthenticationState).toHaveBeenCalledWith({
authServiceId: 'http://example.com/auth', tokenServiceId: 'http://example.com/token',
Expand Down
7 changes: 0 additions & 7 deletions __tests__/src/components/LanguageSettings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ describe('LanguageSettings', () => {
expect(screen.getAllByRole('menuitem')).toHaveLength(2);
});

it('non-active list items are buttons (and active are not)', () => {
createWrapper({ languages });

expect(screen.getByRole('menuitem', { name: 'Deutsch' })).not.toHaveClass('MuiButtonBase-root');
expect(screen.getByRole('menuitem', { name: 'English' })).toHaveClass('MuiButtonBase-root');
});

it('renders the check icon when the active prop returns true', () => {
createWrapper({ languages });

Expand Down
38 changes: 22 additions & 16 deletions __tests__/src/components/LocalePicker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import userEvent from '@testing-library/user-event';
import { LocalePicker } from '../../../src/components/LocalePicker';

/**
* Helper function to create a shallow wrapper around LanguageSettings
* Helper function to create a shallow wrapper around LocalePicker
*/
function createWrapper(props) {
return render(
Expand All @@ -24,36 +24,42 @@ describe('LocalePicker', () => {
});

it('renders a select with the current value', () => {
createWrapper({ availableLocales: ['en', 'de'], locale: 'en' });

expect(screen.getByRole('button')).toHaveTextContent('en');
createWrapper({ availableLocales: ['en', 'de'], locale: 'de' });
// The option to expand the dropdown menu is rendered by a CompanionWindow titleControls prop in WindowSideBarInfoPanel, which is a combobox
const dropdownTitle = screen.getByRole('combobox');
expect(dropdownTitle).toHaveTextContent('de');
});

it('renders a select with a list item for each language passed in props', async () => {
it('renders a select with both options and sets the current value', async () => {
const user = userEvent.setup();

createWrapper({ availableLocales: ['en', 'de'], locale: 'en' });

await user.click(screen.getByRole('button'));

expect(screen.getAllByRole('option')).toHaveLength(2);
createWrapper({ availableLocales: ['en', 'de'], locale: 'de' });
const dropdownTitle = screen.getByRole('combobox');
// Open the menu
await user.click(dropdownTitle);
// The dropddown menu is not nested within the combobox, it is a sibling in the DOM, an MuiMenu
const menu = screen.getByRole('listbox');
// Assert that the menu element has 2 children (2 options)
expect(menu.children).toHaveLength(2); // eslint-disable-line testing-library/no-node-access
// Verify that the select element has the correct value ('de')
const deOption = screen.getByRole('option', { name: 'de' });
expect(deOption).toHaveAttribute('aria-selected', 'true');
// Verify en is also an option
expect(screen.getByRole('option', { name: 'en' })).toBeInTheDocument();
expect(screen.getByRole('option', { name: 'de' })).toBeInTheDocument();
});

it('triggers setLocale prop when clicking a list item', async () => {
const user = userEvent.setup();
const setLocale = jest.fn();

createWrapper({
availableLocales: ['en', 'de'],
locale: 'en',
setLocale,
});

await user.click(screen.getByRole('button'));
const dropdownTitle = screen.getByRole('combobox');
// Open the Select component
await user.click(dropdownTitle);
// Change the locale to 'de'
await user.click(screen.getByRole('option', { name: 'de' }));

expect(setLocale).toHaveBeenCalledTimes(1);
expect(setLocale).toHaveBeenCalledWith('de');
});
Expand Down
7 changes: 6 additions & 1 deletion __tests__/src/components/ManifestListItem.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,23 @@ describe('ManifestListItem', () => {
createWrapper({ buttonRef: 'ref' });

expect(screen.getByRole('listitem')).toHaveAttribute('data-manifestid', 'http://example.com');
expect(screen.getByRole('listitem')).toHaveClass('MuiListItem-root');
expect(screen.getByRole('button')).toHaveTextContent('xyz');
});
it('adds a class when the item is active', () => {
createWrapper({ active: true, classes: { active: 'active' } });

// If this is true, we can assume the proper styling classes are being applied
expect(screen.getByRole('listitem')).toHaveAttribute('data-active', 'true');

expect(screen.getByRole('listitem')).toHaveClass('active');
expect(screen.getByRole('listitem')).toHaveClass('Mui-selected');
});
it('renders a placeholder element until real data is available', () => {
const { container } = createWrapper({ ready: false });

expect(screen.queryByRole('button')).not.toBeInTheDocument();
expect(container.querySelectorAll('.MuiSkeleton-rect').length).toBeGreaterThan(0); // eslint-disable-line testing-library/no-node-access, testing-library/no-container
expect(container.querySelectorAll('.MuiSkeleton-rectangular').length).toBeGreaterThan(0); // eslint-disable-line testing-library/no-node-access, testing-library/no-container
});
it('renders an error message if fetching the manifest failed', () => {
createWrapper({ error: 'This is an error message' });
Expand Down
4 changes: 2 additions & 2 deletions __tests__/src/components/PrimaryWindow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function createWrapper(props) {
describe('PrimaryWindow', () => {
it('should render expected elements', async () => {
createWrapper({ isFetching: false });
await screen.findByRole('region', { accessibleName: 'item' });
await screen.findByTestId('test-window');
expect(document.querySelector('.mirador-primary-window')).toBeInTheDocument(); // eslint-disable-line testing-library/no-node-access
expect(document.querySelector('.mirador-companion-area-left')).toBeInTheDocument(); // eslint-disable-line testing-library/no-node-access
});
Expand All @@ -30,7 +30,7 @@ describe('PrimaryWindow', () => {
});
it('should render <GalleryView> if fetching is complete and view is gallery', async () => {
createWrapper({ isFetching: false, view: 'gallery' });
await screen.findByRole('region', { accessibleName: 'gallery section' });
await screen.findByTestId('test-window');
expect(document.querySelector('#xyz-gallery')).toBeInTheDocument(); // eslint-disable-line testing-library/no-node-access
});
it('should render <CollectionDialog> and <SelectCollection> if manifest is collection and isCollectionDialogVisible', async () => {
Expand Down
2 changes: 0 additions & 2 deletions __tests__/src/components/SanitizedHtml.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ describe('SanitizedHtml', () => {
render(
<SanitizedHtml
data-testid="subject"
classes={{ root: 'root' }}
htmlString="<script>doBadThings()</script><b>Don't worry!</b><a>Some link</a>"
ruleSet="iiif"
/>,
Expand All @@ -18,7 +17,6 @@ describe('SanitizedHtml', () => {
});

it('should pass correct class name to root element', () => {
expect(screen.getByTestId('subject')).toHaveClass('root');
expect(screen.getByTestId('subject')).toHaveClass('mirador-third-party-html');
});

Expand Down
9 changes: 0 additions & 9 deletions __tests__/src/components/ScrollIndicatedDialogContent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ function createWrapper(props) {
return render(
<ScrollIndicatedDialogContent
data-testid="subject"
classes={{ shadowScrollDialog: 'shadowScrollDialog' }}
{...props}
/>,
);
Expand All @@ -19,16 +18,8 @@ describe('ScrollIndicatedDialogContent', () => {
expect(screen.getByTestId('subject')).toHaveAttribute('randomprop', 'randomPropValue');
});

it('provides a className to the DialogContent prop to style it', () => {
createWrapper();

expect(screen.getByTestId('subject')).toHaveClass('shadowScrollDialog');
});

it('joins an incoming className prop with our className', () => {
createWrapper({ className: 'upstreamClassName' });

expect(screen.getByTestId('subject')).toHaveClass('shadowScrollDialog');
expect(screen.getByTestId('subject')).toHaveClass('upstreamClassName');
});
});
Loading