Skip to content

Commit

Permalink
test(rounded): add test for rounded button #212
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanjones243 committed Jun 8, 2023
1 parent 5f8c80b commit 7f6961d
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion test/auro-button.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
/* eslint-disable lit/attribute-value-entities */
/* eslint-disable one-var */
/* eslint-disable no-undef */
import { fixture, html, expect } from '@open-wc/testing';
import { fixture, html, expect, elementUpdated } from '@open-wc/testing';
import { AuroButton } from '../src/auro-button.js';
import { registerComponent } from '../index.js';
import '../index.js';

describe('auro-button', () => {
Expand All @@ -30,6 +32,12 @@ describe('auro-button', () => {
expect(classList.includes('auro-button')).to.be.true;
});

it('successfully registers custom component', async () => {
registerComponent('test-button');

expect(typeof customElements.get('test-button')).to.equal(typeof AuroButton);
});

it('tests setting autofocus', async () => {
const el = await fixture(html`
<auro-button autofocus>Click Me!</auro-button>
Expand Down Expand Up @@ -203,4 +211,18 @@ describe('auro-button', () => {

await expect(el).to.be.true;
});

it('toggleText event toggles value of hideText attribute', async () => {
const el = await fixture(html`
<auro-button rounded>Click Me!</auro-button>
`);

await expect(el.hideText).to.be.false;

el.dispatchEvent(new CustomEvent('auroButton-toggledText'));

await elementUpdated(el);

await expect(el.hideText).to.be.true;
})
});

0 comments on commit 7f6961d

Please sign in to comment.