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

Update npm dependencies (especially @wordpress) #7695

Draft
wants to merge 30 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
997d43b
Update WP dependencies: api-fetch
renatho Oct 29, 2024
50fb1fc
Update WP dependencies: block-editor, blocks and element
renatho Oct 29, 2024
ac9f91b
Update WP dependencies: blocks, compose, and core-data
renatho Oct 29, 2024
049ac84
Update WP dependencies: data
renatho Oct 29, 2024
710033b
Update WP dependencies: data-controls, dom-ready
renatho Oct 29, 2024
4ec6f50
Update WP dependencies: escape-html, hooks
renatho Oct 29, 2024
74c28c2
Update WP dependencies: html-entities, keycodes, plugins, token-list,…
renatho Oct 29, 2024
2c0dcb4
Update WP dependencies: i18n
renatho Oct 29, 2024
21c0b6f
Replace calypso-build with wp-scripts
renatho Oct 30, 2024
971f3f2
Fix key
renatho Oct 30, 2024
6ca3cf5
Install specific version of sass and sass-loader
renatho Oct 31, 2024
6b09ac8
Update some dev dependencies
renatho Oct 31, 2024
31bc767
Point the renderHook to the new dependency
renatho Oct 31, 2024
d4d1f7e
Solve some dependency issues
renatho Nov 1, 2024
0b4e592
Update babel dependencies
m1r0 Nov 5, 2024
5c7e889
Fix tests failing because of `userEvent`
m1r0 Nov 5, 2024
ab5f7be
Fix JS unit tests
m1r0 Nov 5, 2024
0256973
Fix linters
m1r0 Nov 6, 2024
e98cc75
Remove unused lodash type
m1r0 Nov 6, 2024
65cd943
Update `@wordpress/base-styles`
m1r0 Nov 7, 2024
f04df1d
Update the rest of the wordpress packages
m1r0 Nov 7, 2024
d92b556
Add changelog
m1r0 Nov 7, 2024
8ab8e3e
Update `@automattic/components` and `@automattic/tour-kit`
m1r0 Nov 11, 2024
b3bb3ca
Merge branch 'trunk' into update/wordpress-dependencies
m1r0 Jan 15, 2025
8665b07
Downgrade packages to minimum supported WP version - `wp-6.5`
m1r0 Jan 15, 2025
ac8eb55
Fix eslint parser
m1r0 Jan 15, 2025
0435314
Remove old eslint rule
m1r0 Jan 15, 2025
5f45252
Fix eslint error
m1r0 Jan 15, 2025
2767fb7
Fix lodash lint-types
m1r0 Jan 15, 2025
3594025
Fix multiple versions of `@wordpress/private-apis` causing tests to fail
m1r0 Jan 16, 2025
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
2 changes: 1 addition & 1 deletion assets/admin/editor-wizard/helpers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe( 'useWizardOpenState', () => {
expect( await findByText( 'closed' ) ).toBeTruthy();

document.body.classList.remove( 'modal-open' );
expect( findByText( 'open' ) ).toBeTruthy();
expect( await findByText( 'open' ) ).toBeTruthy();
} );

it( 'Should be closed when wizard is done', async () => {
Expand Down
22 changes: 12 additions & 10 deletions assets/admin/exit-survey/form.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,50 +18,52 @@ describe( '<ExitSurveyForm />', () => {
skip: () => screen.getByRole( 'button', { name: 'Skip Feedback' } ),
};

it( 'Submit is disabled until an item is selected and details filled out (if provided)', () => {
it( 'Submit is disabled until an item is selected and details filled out (if provided)', async () => {
const { getByLabelText, getByPlaceholderText } = render(
<ExitSurveyForm />
);

expect( buttons.submit() ).toBeDisabled();

// This reason does not require details.
userEvent.click( getByLabelText( 'I no longer need the plugin' ) );
await userEvent.click(
getByLabelText( 'I no longer need the plugin' )
);
expect( buttons.submit() ).not.toBeDisabled();

// This reason does expect details.
userEvent.click( getByLabelText( 'I found a better plugin' ) );
await userEvent.click( getByLabelText( 'I found a better plugin' ) );
expect( buttons.submit() ).toBeDisabled();
userEvent.type(
await userEvent.type(
getByPlaceholderText( "What's the name of the plugin?" ),
'Test detail'
);

expect( buttons.submit() ).not.toBeDisabled();
} );

it( 'Skip button skips submission', () => {
it( 'Skip button skips submission', async () => {
const skip = jest.fn();
const submit = jest.fn();
render( <ExitSurveyForm submit={ submit } skip={ skip } /> );
userEvent.click( buttons.skip() );
await userEvent.click( buttons.skip() );

expect( skip ).toHaveBeenCalled();
expect( submit ).not.toHaveBeenCalled();
} );

it( 'Submits selected reason and details', () => {
it( 'Submits selected reason and details', async () => {
const submit = jest.fn();
const { getByLabelText, getByPlaceholderText } = render(
<ExitSurveyForm submit={ submit } />
);

userEvent.click( getByLabelText( 'I found a better plugin' ) );
userEvent.type(
await userEvent.click( getByLabelText( 'I found a better plugin' ) );
await userEvent.type(
getByPlaceholderText( "What's the name of the plugin?" ),
'Test detail'
);
userEvent.click( buttons.submit() );
await userEvent.click( buttons.submit() );

expect( submit ).toHaveBeenCalledWith( {
reason: 'found-better-plugin',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useAbortController from '.';
/**
* External dependencies
*/
import { cleanup, renderHook } from '@testing-library/react-hooks';
import { cleanup, renderHook } from '@testing-library/react';

describe( 'useAbortController', () => {
it( 'Should return signal to be used on async operations', () => {
Expand Down
14 changes: 8 additions & 6 deletions assets/admin/students/student-bulk-action-button/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ describe( '<StudentBulkActionButton />', () => {
expect( button ).toBeDisabled();
} );

it( 'Should render the `Add to course` modal', () => {
it( 'Should render the `Add to course` modal', async () => {
setupSelector( [
{ value: 'enrol_restore_enrolment', selected: true },
{ value: 'remove_progress' },
{ value: 'remove_enrolment' },
] );
render( <StudentBulkActionButton isDisabled={ false } /> );

selectActionButton().click();
await selectActionButton().click();

expect(
screen.getByText(
ignoreInlineTags(
Expand All @@ -80,15 +81,15 @@ describe( '<StudentBulkActionButton />', () => {
).toBeInTheDocument();
} );

it( 'Should render the `Reset Progress` modal', () => {
it( 'Should render the `Reset Progress` modal', async () => {
setupSelector( [
{ value: 'enrol_restore_enrolment' },
{ value: 'remove_progress', selected: true },
{ value: 'remove_enrolment' },
] );
render( <StudentBulkActionButton isDisabled={ false } /> );

selectActionButton().click();
await selectActionButton().click();

expect(
screen.getByText(
Expand All @@ -98,15 +99,16 @@ describe( '<StudentBulkActionButton />', () => {
)
).toBeInTheDocument();
} );
it( 'Should render the `Remove from Course` modal', () => {
it( 'Should render the `Remove from Course` modal', async () => {
setupSelector( [
{ value: 'enrol_restore_enrolment' },
{ value: 'remove_progress' },
{ value: 'remove_enrolment', selected: true },
] );
render( <StudentBulkActionButton isDisabled={ false } /> );

selectActionButton().click();
await selectActionButton().click();

expect(
screen.getByText(
ignoreInlineTags(
Expand Down
26 changes: 14 additions & 12 deletions assets/admin/students/student-modal/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,14 @@ describe( '<StudentModal />', () => {
/>
);

fireEvent.click( await courseOptionAt( 0 ) );
fireEvent.click( await buttonByLabel( 'Add to Course' ) );
await fireEvent.click( await courseOptionAt( 0 ) );
await fireEvent.click( await buttonByLabel( 'Add to Course' ) );

expect(
await findAllByText(
'Unable to add student. Please try again.'
)
).toHaveLength( 2 ); // ARIA + notice
).toBeTruthy();
} );

it( 'Should display an error message when removing a student from a course', async () => {
Expand All @@ -363,7 +363,7 @@ describe( '<StudentModal />', () => {
await findAllByText(
'Unable to remove student. Please try again.'
)
).toHaveLength( 2 ); // ARIA + notice
).toBeTruthy();
} );

it( 'Should display an error message when resetting progress for a single student', async () => {
Expand All @@ -383,7 +383,7 @@ describe( '<StudentModal />', () => {
await findAllByText(
'Unable to reset progress for this student. Please try again.'
)
).toHaveLength( 2 ); // ARIA + notice
).toBeTruthy();
} );
} );

Expand Down Expand Up @@ -437,14 +437,14 @@ describe( '<StudentModal />', () => {
/>
);

fireEvent.click( await courseOptionAt( 0 ) );
fireEvent.click( await buttonByLabel( 'Add to Course' ) );
await fireEvent.click( await courseOptionAt( 0 ) );
await fireEvent.click( await buttonByLabel( 'Add to Course' ) );

expect(
await findAllByText(
'Unable to add students. Please try again.'
)
).toHaveLength( 2 ); // ARIA + notice
).toBeTruthy();
} );

it( 'Should display an error message when removing multiple students from a course', async () => {
Expand All @@ -456,14 +456,16 @@ describe( '<StudentModal />', () => {
/>
);

fireEvent.click( await courseOptionAt( 0 ) );
fireEvent.click( await buttonByLabel( 'Remove from Course' ) );
await fireEvent.click( await courseOptionAt( 0 ) );
await fireEvent.click(
await buttonByLabel( 'Remove from Course' )
);

expect(
await findAllByText(
'Unable to remove students. Please try again.'
)
).toHaveLength( 2 ); // ARIA + notice
).toBeTruthy();
} );

it( 'Should display an error message when resetting progress for multiple students', async () => {
Expand All @@ -482,7 +484,7 @@ describe( '<StudentModal />', () => {
await findAllByText(
'Unable to reset progress for these students. Please try again.'
)
).toHaveLength( 2 ); // ARIA + notice
).toBeTruthy();
} );
} );
} );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@testing-library/react';
/**
* Internal dependencies
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@testing-library/react';
import { when } from 'jest-when';
/**
* WordPress dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,21 @@
expect( getByText( 'Start with blank' ) ).toBeVisible();

expect( getByText( 'Generate with AI' ) ).toBeVisible();
} );

Check failure on line 37 in assets/blocks/course-outline/outline-block/outline-placeholder.test.js

View workflow job for this annotation

GitHub Actions / JS Testing

TestingLibraryElementError: Found multiple elements with the text: You can use modules to group related lessons together. Here are the matching elements: Ignored nodes: comments, script, style <div aria-atomic="true" aria-live="polite" aria-relevant="additions text" class="a11y-speak-region" id="a11y-speak-polite" style="position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;" > Build and display a course outline. A course is made up of modules (optional) and lessons. You can use modules to group related lessons together. </div> Ignored nodes: comments, script, style <div class="components-placeholder__instructions" > Build and display a course outline. A course is made up of modules (optional) and lessons. You can use modules to group related lessons together. </div> (If this is intentional, then use the `*AllBy*` variant of the query (like `queryAllByText`, `getAllByText`, or `findAllByText`)). Ignored nodes: comments, script, style <body> <p class="a11y-speak-intro-text" id="a11y-speak-intro-text" style="position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;" > Notifications </p> <div aria-atomic="true" aria-live="assertive" aria-relevant="additions text" class="a11y-speak-region" id="a11y-speak-assertive" style="position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;" /> <div aria-atomic="true" aria-live="polite" aria-relevant="additions text" class="a11y-speak-region" id="a11y-speak-polite" style="position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;" > Build and display a course outline. A course is made up of modules (optional) and lessons. You can use modules to group related lessons together. </div> <div> <div class="components-placeholder wp-block-***-lms-course-outline__placeholder" > <div aria-hidden="true" style="position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; pointer-events: none; opacity: 0; overflow: hidden; z-index: -1;" /> <div class="components-placeholder__label" > <span class="block-editor-block-icon has-colors" > <span size="24" /> </span> Course Outline </div> <div class="components-placeholder__instructions" > Build and display a course outline. A course is made up of modules (optional) and lessons. You can use modules to group related lessons together. </div> <div

it( 'Should create empty lessons', () => {
it( 'Should create empty lessons', async () => {
const { getByRole } = render(
<OutlinePlaceholder addBlocks={ addBlocksMock } />
);

userEvent.click( getByRole( 'button', { name: 'Start with blank' } ) );
await userEvent.click(
getByRole( 'button', { name: 'Start with blank' } )
);

expect( addBlocksMock ).toHaveBeenCalled();
} );

it( 'Should open the tailored modal', () => {
it( 'Should open the tailored modal', async () => {
const openTailoredModalMock = jest.fn();

const { getByRole } = render(
Expand All @@ -56,7 +58,7 @@
/>
);

userEvent.click(
await userEvent.click(
getByRole( 'button', { name: 'Generate with AI Pro' } )
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@testing-library/react';
/**
* Internal dependencies
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ describe( '<StatusControl />', () => {
setStatus={ setStatusMock }
/>
);
userEvent.click( getByLabelText( 'Completed' ) );
await userEvent.click( getByLabelText( 'Completed' ) );
expect( setStatusMock ).toBeCalledWith( Status.COMPLETED );

userEvent.click( getByLabelText( 'In Progress' ) );
await userEvent.click( getByLabelText( 'In Progress' ) );
expect( setStatusMock ).toBeCalledWith( Status.IN_PROGRESS );
} );
} );
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { renderHook, act } from '@testing-library/react-hooks';
import { renderHook, act } from '@testing-library/react';

/**
* Internal dependencies
Expand Down Expand Up @@ -34,16 +34,15 @@ describe( 'useConfirmDialogProps()', () => {
const { result } = renderHook( () => useConfirmDialogProps() );
let [ props, confirm ] = result.current;
expect( props.isOpen ).toBe( false );
const confirmResponse = act( () =>
act( () => {
// eslint-disable-next-line jest/valid-expect
expect(
confirm( 'Hey Content', { title: 'Hey Title' } )
).resolves.toBe( true )
);
).resolves.toBe( true );
} );
[ props, confirm ] = result.current;
expect( props.isOpen ).toBe( true );
act( () => props.onConfirm() );
// We need to verify AFTER calling the props.on* callback, otherwise, the promise won't be resolved yet.
await confirmResponse;
[ props, confirm ] = result.current;
expect( props.isOpen ).toBe( false );
} );
Expand All @@ -52,16 +51,15 @@ describe( 'useConfirmDialogProps()', () => {
const { result } = renderHook( () => useConfirmDialogProps() );
let [ props, confirm ] = result.current;
expect( props.isOpen ).toBe( false );
const confirmResponse = act( () =>
act( () => {
// eslint-disable-next-line jest/valid-expect
expect(
confirm( 'Hey Content', { title: 'Hey Title' } )
).resolves.toBe( false )
);
).resolves.toBe( false );
} );
[ props, confirm ] = result.current;
expect( props.isOpen ).toBe( true );
act( () => props.onCancel() );
// We need to verify AFTER calling the props.on* callback, otherwise, the promise won't be resolved yet.
await confirmResponse;
[ props, confirm ] = result.current;
expect( props.isOpen ).toBe( false );
} );
Expand Down
Loading
Loading