chore(deps): update dependency @testing-library/dom to v8 (#5540)
This commit is contained in:
parent
c0bc24c2d1
commit
189e9d255d
@ -91,7 +91,7 @@
|
|||||||
"@storybook/addon-actions": "^5.3.6",
|
"@storybook/addon-actions": "^5.3.6",
|
||||||
"@storybook/addon-links": "^5.3.6",
|
"@storybook/addon-links": "^5.3.6",
|
||||||
"@storybook/react": "^5.3.6",
|
"@storybook/react": "^5.3.6",
|
||||||
"@testing-library/dom": "^7.24.1",
|
"@testing-library/dom": "^8.0.0",
|
||||||
"@testing-library/jest-dom": "^5.11.1",
|
"@testing-library/jest-dom": "^5.11.1",
|
||||||
"@testing-library/react": "^12.0.0",
|
"@testing-library/react": "^12.0.0",
|
||||||
"@types/common-tags": "^1.8.0",
|
"@types/common-tags": "^1.8.0",
|
||||||
|
@ -1,10 +1,20 @@
|
|||||||
import { queryHelpers, waitForElement } from '@testing-library/dom';
|
|
||||||
|
|
||||||
import cloudinary from '../index';
|
import cloudinary from '../index';
|
||||||
|
|
||||||
|
jest.mock('netlify-cms-lib-util');
|
||||||
|
|
||||||
|
describe('cloudinary exports', () => {
|
||||||
|
it('exports an object with expected properties', () => {
|
||||||
|
expect(cloudinary).toMatchInlineSnapshot(`
|
||||||
|
Object {
|
||||||
|
"init": [Function],
|
||||||
|
"name": "cloudinary",
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('cloudinary media library', () => {
|
describe('cloudinary media library', () => {
|
||||||
let mediaLibrary;
|
let mediaLibrary;
|
||||||
let cloudinaryScript;
|
|
||||||
let cloudinaryConfig;
|
let cloudinaryConfig;
|
||||||
let cloudinaryInsertHandler;
|
let cloudinaryInsertHandler;
|
||||||
|
|
||||||
@ -28,37 +38,16 @@ describe('cloudinary media library', () => {
|
|||||||
show: jest.fn(),
|
show: jest.fn(),
|
||||||
hide: jest.fn(),
|
hide: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* We load the Cloudinary library by injecting a script tag to the page
|
|
||||||
* head. Initialization waits for the script to load, so here we fake it.
|
|
||||||
* This also tests that the expected script is added to the DOM.
|
|
||||||
*/
|
|
||||||
waitForElement(() => {
|
|
||||||
const url = 'https://media-library.cloudinary.com/global/all.js';
|
|
||||||
return queryHelpers.queryByAttribute('src', document, url);
|
|
||||||
}).then(script => {
|
|
||||||
cloudinaryScript = script;
|
|
||||||
script.onreadystatechange();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
/**
|
const { loadScript } = require('netlify-cms-lib-util');
|
||||||
* Remove the script element from the dom after each test.
|
expect(loadScript).toHaveBeenCalledTimes(1);
|
||||||
*/
|
expect(loadScript).toHaveBeenCalledWith('https://media-library.cloudinary.com/global/all.js');
|
||||||
if (cloudinaryScript) {
|
|
||||||
document.head.removeChild(cloudinaryScript);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('exports an object with expected properties', () => {
|
|
||||||
expect(cloudinary).toMatchInlineSnapshot(`
|
|
||||||
Object {
|
|
||||||
"init": [Function],
|
|
||||||
"name": "cloudinary",
|
|
||||||
}
|
|
||||||
`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('configuration', () => {
|
describe('configuration', () => {
|
||||||
|
14
yarn.lock
14
yarn.lock
@ -3205,20 +3205,6 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
defer-to-connect "^1.0.1"
|
defer-to-connect "^1.0.1"
|
||||||
|
|
||||||
"@testing-library/dom@^7.24.1":
|
|
||||||
version "7.31.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-7.31.2.tgz#df361db38f5212b88555068ab8119f5d841a8c4a"
|
|
||||||
integrity sha512-3UqjCpey6HiTZT92vODYLPxTBWlM8ZOOjr3LX5F37/VRipW2M1kX6I/Cm4VXzteZqfGfagg8yXywpcOgQBlNsQ==
|
|
||||||
dependencies:
|
|
||||||
"@babel/code-frame" "^7.10.4"
|
|
||||||
"@babel/runtime" "^7.12.5"
|
|
||||||
"@types/aria-query" "^4.2.0"
|
|
||||||
aria-query "^4.2.2"
|
|
||||||
chalk "^4.1.0"
|
|
||||||
dom-accessibility-api "^0.5.6"
|
|
||||||
lz-string "^1.4.4"
|
|
||||||
pretty-format "^26.6.2"
|
|
||||||
|
|
||||||
"@testing-library/dom@^8.0.0":
|
"@testing-library/dom@^8.0.0":
|
||||||
version "8.0.0"
|
version "8.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.0.0.tgz#2bb994393c566aae021db86dd263ba06e8b71b38"
|
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.0.0.tgz#2bb994393c566aae021db86dd263ba06e8b71b38"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user