Skip to content

Commit

Permalink
Update .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Evans committed Apr 13, 2020
1 parent 568b328 commit 3de99b3
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 7 deletions.
9 changes: 2 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/node_modules/
/lib/
/test/

# top level source
my-element.js
my-element.js.map
my-element.d.ts
my-element.d.ts.map
# only generated for size check
my-element.bundled.js
50 changes: 50 additions & 0 deletions test/my-element_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import {MyElement} from '../my-element.js';
import {fixture, html} from '@open-wc/testing';

const assert = chai.assert;

suite('my-element', () => {
test('is defined', () => {
const el = document.createElement('my-element');
assert.instanceOf(el, MyElement);
});

test('renders with default values', async () => {
const el = await fixture(html`<my-element></my-element>`);
assert.shadowDom.equal(
el,
`
<h1>Hello, World!</h1>
<button part="button">Click Count: 0</button>
<slot></slot>
`
);
});

test('renders with a set name', async () => {
const el = await fixture(html`<my-element name="Test"></my-element>`);
assert.shadowDom.equal(
el,
`
<h1>Hello, Test!</h1>
<button part="button">Click Count: 0</button>
<slot></slot>
`
);
});

test('handles a click', async () => {
const el = await fixture(html`<my-element></my-element>`);
const button = el.shadowRoot.querySelector('button');
button.click();
await el.updateComplete;
assert.shadowDom.equal(
el,
`
<h1>Hello, World!</h1>
<button part="button">Click Count: 1</button>
<slot></slot>
`
);
});
});

0 comments on commit 3de99b3

Please sign in to comment.