-
Notifications
You must be signed in to change notification settings - Fork 2
/
arv-button.spec.ts
65 lines (53 loc) · 1.96 KB
/
arv-button.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { TestWindow } from '@stencil/core/testing';
import { Button } from './arv-button';
describe('arv-flex', () => {
it('should build', () => {
expect(new Button()).toBeTruthy();
});
describe('rendering', () => {
let element: HTMLButtonElement;
let testWindow: TestWindow;
beforeEach(async () => {
testWindow = new TestWindow();
element = await testWindow.load({
components: [Button],
html: '<arv-button></arv-button>'
});
});
it('should work without parameters', async () => {
await testWindow.flush();
expect(element.lastElementChild.classList.value).toEqual('arv-button default medium flat');
});
it('should work with color', async () => {
element.color = 'primary';
await testWindow.flush();
expect(element.lastElementChild.classList.value).toEqual('arv-button medium flat primary');
});
it('should work with disabled', async () => {
element.disabled = true;
await testWindow.flush();
expect(element.lastElementChild.classList.value).toEqual('arv-button default medium flat disabled');
});
it('should work with full', async () => {
element.full = true;
await testWindow.flush();
expect(element.lastElementChild.classList.value).toEqual('arv-button default medium flat full');
});
it('should work with icon', async () => {
element.icon = 'standard';
await testWindow.flush();
const icon = element.querySelector('arv-icon');
expect(icon).toBeTruthy();
});
it('should work with size', async () => {
element.size = 'small';
await testWindow.flush();
expect(element.lastElementChild.classList.value).toEqual('arv-button default flat small');
});
it('should work with variant', async () => {
element.variant = 'raised';
await testWindow.flush();
expect(element.lastElementChild.classList.value).toEqual('arv-button default medium raised');
});
});
});