adding bookmarklet
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Widget from './widget';
|
||||
import { waitForSelection } from './test-helpers';
|
||||
import { waitForSelection } from '../test-helpers';
|
||||
|
||||
describe('<Widget />', () => {
|
||||
test('open/close', async () => {
|
||||
12
src/outputs/bookmarklet.js
Normal file
12
src/outputs/bookmarklet.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import Widget from '../components/widget';
|
||||
|
||||
const component = <Widget />;
|
||||
const el = document.createElement('div');
|
||||
document.body.appendChild(el);
|
||||
console.log('running bookmarklet');
|
||||
ReactDOM.render(
|
||||
component,
|
||||
el,
|
||||
);
|
||||
15
src/outputs/bookmarklet.test.js
Normal file
15
src/outputs/bookmarklet.test.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import './bookmarklet';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
describe('bookmarklet', () => {
|
||||
afterEach(() => {
|
||||
const el = document.querySelectorAll('body > div');
|
||||
ReactDOM.unmountComponentAtNode(el[0]);
|
||||
el[0].parentNode.removeChild(el[0]);
|
||||
});
|
||||
|
||||
test('#mount document becomes ready', async () => {
|
||||
const el = document.querySelectorAll('body > div');
|
||||
expect(el).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import Widget from './widget';
|
||||
import Widget from '../components/widget';
|
||||
|
||||
export default class EmbeddableWidget {
|
||||
static el;
|
||||
@@ -1,5 +1,5 @@
|
||||
import EmbeddableWidget from './index';
|
||||
import { waitForSelection } from './test-helpers';
|
||||
import EmbeddableWidget from './embeddable-widget';
|
||||
import { waitForSelection } from '../test-helpers';
|
||||
|
||||
describe('EmbeddableWidget', () => {
|
||||
afterEach(() => {
|
||||
Reference in New Issue
Block a user