adding bookmarklet

This commit is contained in:
Benjamin Boudreau
2018-06-03 16:01:32 -04:00
parent 5a2184062e
commit 799221f411
11 changed files with 60 additions and 15 deletions

View File

@@ -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 () => {

View 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,
);

View 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);
});
});

View File

@@ -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;

View File

@@ -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(() => {