fixing tests for changed bookmark
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import EmbeddableWidget from './embeddable-widget';
|
||||
|
||||
(function bookmarklet() {
|
||||
export default function bookmarklet() {
|
||||
if (window.EmbeddableWidget) {
|
||||
return;
|
||||
}
|
||||
window.EmbeddableWidget = EmbeddableWidget;
|
||||
|
||||
EmbeddableWidget.mount();
|
||||
}());
|
||||
}
|
||||
|
||||
bookmarklet();
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
import './bookmarklet';
|
||||
import ReactDOM from 'react-dom';
|
||||
import bookmarklet from './bookmarklet';
|
||||
|
||||
describe('bookmarklet', () => {
|
||||
afterEach(() => {
|
||||
const el = document.querySelectorAll('body > div');
|
||||
ReactDOM.unmountComponentAtNode(el[0]);
|
||||
el[0].parentNode.removeChild(el[0]);
|
||||
window.EmbeddableWidget = null;
|
||||
});
|
||||
|
||||
test('#mount document becomes ready', async () => {
|
||||
expect(window.EmbeddableWidget).not.toBeNull();
|
||||
bookmarklet();
|
||||
const el = document.querySelectorAll('body > div');
|
||||
expect(el).toHaveLength(1);
|
||||
});
|
||||
|
||||
@@ -21,7 +21,6 @@ describe('EmbeddableWidget', () => {
|
||||
await waitForSelection(document, 'div');
|
||||
});
|
||||
|
||||
|
||||
test('#mount twice', async () => {
|
||||
EmbeddableWidget.mount();
|
||||
expect(() => EmbeddableWidget.mount()).toThrow('already mounted');
|
||||
|
||||
Reference in New Issue
Block a user