Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1,607 changes: 869 additions & 738 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
"jest": "^29.7.0",
"jest-axe": "^9.0.0",
"jest-canvas-mock": "^2.5.2",
"jest-environment-jsdom": "^29.6.1",
"jest-environment-jsdom": "^30.0.0",
"jest-extended": "^4.0.0",
"jest-fetch-mock": "^3.0.3",
"jest-matcher-deep-close-to": "^3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/activation-notice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
},
"devDependencies": {
"@storybook/addon-essentials": "^8.6.12",
"@testing-library/react": "^14.0.0"
"@testing-library/react": "^16.3.0"
}
}
2 changes: 1 addition & 1 deletion packages/stories-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@
"prop-types": "^15.8.1"
},
"devDependencies": {
"@testing-library/react": "^14.0.0"
"@testing-library/react": "^16.3.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const Autocomplete = ({
label={label}
placeholder={placeholder}
__nextHasNoMarginBottom
__next40pxDefaultSize
/>
</div>
)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ import { getStoryAmpValidationErrors } from '../storyAmpValidationErrors';

describe('getStoryAmpValidationErrors', () => {
const fetchSpy = jest.spyOn(window, 'fetch');
const windowSpy = jest.spyOn(window, 'window', 'get');

beforeAll(() => {
fetchSpy.mockResolvedValue({
text: () => ({
status: 200,
}),
});

delete window.amp;
});

afterAll(() => {
fetchSpy.mockClear();
windowSpy.mockRestore();
delete window.amp;
});

it('should return false if no link', async () => {
Expand All @@ -43,16 +44,14 @@ describe('getStoryAmpValidationErrors', () => {
});

it('should return false if there are no violations', async () => {
windowSpy.mockImplementation(() => ({
amp: {
validator: {
validateString: () => ({
status: 'PASS',
errors: [],
}),
},
window.amp = {
validator: {
validateString: () => ({
status: 'PASS',
errors: [],
}),
},
}));
};

await expect(
getStoryAmpValidationErrors({
Expand All @@ -63,25 +62,23 @@ describe('getStoryAmpValidationErrors', () => {
});

it('should return true if there are AMP violations', async () => {
windowSpy.mockImplementation(() => ({
amp: {
validator: {
init: () => {},
validateString: () => ({
status: 'FAIL',
errors: [
{ code: 'INVALID_URL_PROTOCOL', severity: 'ERROR' },
{ code: 'TAG_REQUIRED_BY_MISSING', severity: 'ERROR' },
{
code: 'MISSING_URL',
severity: 'ERROR',
params: ['poster-portrait-src'],
},
],
}),
},
window.amp = {
validator: {
init: () => {},
validateString: () => ({
status: 'FAIL',
errors: [
{ code: 'INVALID_URL_PROTOCOL', severity: 'ERROR' },
{ code: 'TAG_REQUIRED_BY_MISSING', severity: 'ERROR' },
{
code: 'MISSING_URL',
severity: 'ERROR',
params: ['poster-portrait-src'],
},
],
}),
},
}));
};

await expect(
getStoryAmpValidationErrors({
Expand All @@ -92,19 +89,17 @@ describe('getStoryAmpValidationErrors', () => {
});

it('should return false if there are no ERROR severity errors', async () => {
windowSpy.mockImplementation(() => ({
amp: {
validator: {
validateString: () => ({
status: 'FAIL',
errors: [
{ severity: 'WARNING' },
{ code: 'LOREM IPSUM', severity: 'WARNING' },
],
}),
},
window.amp = {
validator: {
validateString: () => ({
status: 'FAIL',
errors: [
{ severity: 'WARNING' },
{ code: 'LOREM IPSUM', severity: 'WARNING' },
],
}),
},
}));
};

await expect(
getStoryAmpValidationErrors({
Expand All @@ -115,22 +110,20 @@ describe('getStoryAmpValidationErrors', () => {
});

it('should return false if MISSING URL is the only AMP Violation', async () => {
windowSpy.mockImplementation(() => ({
amp: {
validator: {
validateString: () => ({
status: 'FAIL',
errors: [
{
code: 'MISSING_URL',
severity: 'ERROR',
params: ['poster-portrait-src'],
},
],
}),
},
window.amp = {
validator: {
validateString: () => ({
status: 'FAIL',
errors: [
{
code: 'MISSING_URL',
severity: 'ERROR',
params: ['poster-portrait-src'],
},
],
}),
},
}));
};

await expect(
getStoryAmpValidationErrors({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('MediaElement', () => {
});
const { container } = renderMediaElement(IMAGE_RESOURCE, 'local');

const results = await axe(container);
const results = await axe(container, { preload: false });
expect(results).toHaveNoViolations();
}, 30000);

Expand All @@ -137,7 +137,7 @@ describe('MediaElement', () => {
});
const { container } = renderMediaElement(GIF_RESOURCE, 'local');

const results = await axe(container);
const results = await axe(container, { preload: false });
expect(results).toHaveNoViolations();
}, 30000);

Expand All @@ -148,7 +148,7 @@ describe('MediaElement', () => {
});
const { container } = renderMediaElement(VIDEO_RESOURCE, 'local');

const results = await axe(container);
const results = await axe(container, { preload: false });
expect(results).toHaveNoViolations();
}, 30000);

Expand Down
2 changes: 1 addition & 1 deletion packages/tinymce-button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
"prop-types": "^15.8.1"
},
"devDependencies": {
"@testing-library/react": "^14.0.0"
"@testing-library/react": "^16.3.0"
}
}
3 changes: 3 additions & 0 deletions tests/js/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ export default {
'<rootDir>/packages/stories-block/node_modules/react/index.js',
'^react-dom(/.*)$':
'<rootDir>/packages/stories-block/node_modules/react-dom/$1',
// Ditto for React Testing Library.
'^@testing-library/react$':
'<rootDir>/packages/stories-block/node_modules/@testing-library/react/dist/index.js',
},
testMatch: [
'<rootDir>/packages/activation-notice/**/test/**/*.{js,jsx,ts,tsx}',
Expand Down