Skip to content

Commit

Permalink
Create an example using the UMD distributable (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
danreeves authored May 5, 2018
1 parent e9c24e7 commit 85176b5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
<a id='commonjs' href="./tests/commonjs/index.html" />
<a id='esm' href="./tests/esm/index.html" />
<a id='typescript' href="./tests/typescript/index.html" />
<a id='umd' href="./tests/umd/index.html" />
</body>
</html>
10 changes: 10 additions & 0 deletions example/tests/umd/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>UMD example</title>
</head>
<body>
<div id="app"></div>
<script src="./index.js"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions example/tests/umd/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable import/extensions */
import React from '../../../node_modules/react/umd/react.production.min.js';
import { render } from '../../../node_modules/react-dom/umd/react-dom.production.min.js';
import ReactTether from '../../../dist/react-tether.min.js';

function App() {
return (
<div>
<h1>UMD Modules example</h1>
<ReactTether attachment="top left">
<span>Child 1</span>
<span>Child 2</span>
</ReactTether>
</div>
);
}

render(<App />, document.querySelector('#app'));
8 changes: 8 additions & 0 deletions tests/e2e/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,11 @@ test('TypeScript example works', async t => {
await t.expect(await app.hasChildElements).ok();
await t.navigateTo(home);
});

test('UMD distributable example works', async t => {
const tsc = new Selector('#umd');
const app = new Selector('#app');
await t.navigateTo((await tsc.attributes).href);
await t.expect(await app.hasChildElements).ok();
await t.navigateTo(home);
});

0 comments on commit 85176b5

Please sign in to comment.