chore(deps): update dependency @testing-library/dom to v8 (#5540)

This commit is contained in:
renovate[bot] 2021-06-28 18:25:51 +03:00 committed by GitHub
parent c0bc24c2d1
commit 189e9d255d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 45 deletions

View File

@ -91,7 +91,7 @@
"@storybook/addon-actions": "^5.3.6",
"@storybook/addon-links": "^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/react": "^12.0.0",
"@types/common-tags": "^1.8.0",

View File

@ -1,10 +1,20 @@
import { queryHelpers, waitForElement } from '@testing-library/dom';
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', () => {
let mediaLibrary;
let cloudinaryScript;
let cloudinaryConfig;
let cloudinaryInsertHandler;
@ -28,37 +38,16 @@ describe('cloudinary media library', () => {
show: 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(() => {
/**
* Remove the script element from the dom after each test.
*/
if (cloudinaryScript) {
document.head.removeChild(cloudinaryScript);
}
});
it('exports an object with expected properties', () => {
expect(cloudinary).toMatchInlineSnapshot(`
Object {
"init": [Function],
"name": "cloudinary",
}
`);
const { loadScript } = require('netlify-cms-lib-util');
expect(loadScript).toHaveBeenCalledTimes(1);
expect(loadScript).toHaveBeenCalledWith('https://media-library.cloudinary.com/global/all.js');
});
describe('configuration', () => {

View File

@ -3205,20 +3205,6 @@
dependencies:
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":
version "8.0.0"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.0.0.tgz#2bb994393c566aae021db86dd263ba06e8b71b38"