-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcheckbox.test.aria.ts
123 lines (95 loc) · 3.26 KB
/
checkbox.test.aria.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import { expect, test } from '@playwright/test';
import type GlideCoreCheckbox from './checkbox.js';
test('checked=${true}', async ({ page }, test) => {
await page.goto('?id=checkbox--checkbox');
await page
.locator('glide-core-checkbox')
.evaluate<void, GlideCoreCheckbox>((element) => {
element.checked = true;
});
await expect(page.locator('glide-core-checkbox')).toMatchAriaSnapshot({
name: `${test.titlePath.join('.')}.yml`,
});
});
test('checked=${false}', async ({ page }, test) => {
await page.goto('?id=checkbox--checkbox');
await expect(page.locator('glide-core-checkbox')).toMatchAriaSnapshot({
name: `${test.titlePath.join('.')}.yml`,
});
});
test('disabled=${true}', async ({ page }, test) => {
await page.goto('?id=checkbox--checkbox');
await page
.locator('glide-core-checkbox')
.evaluate<void, GlideCoreCheckbox>((element) => {
element.disabled = true;
});
await expect(page.locator('glide-core-checkbox')).toMatchAriaSnapshot({
name: `${test.titlePath.join('.')}.yml`,
});
});
test('disabled=${false}', async ({ page }, test) => {
await page.goto('?id=checkbox--checkbox');
await expect(page.locator('glide-core-checkbox')).toMatchAriaSnapshot({
name: `${test.titlePath.join('.')}.yml`,
});
});
test('hide-label', async ({ page }, test) => {
await page.goto('?id=checkbox--checkbox');
await page
.locator('glide-core-checkbox')
.evaluate<void, GlideCoreCheckbox>((element) => {
element.hideLabel = true;
});
await expect(page.locator('glide-core-checkbox')).toMatchAriaSnapshot({
name: `${test.titlePath.join('.')}.yml`,
});
});
test('indeterminate', async ({ page }, test) => {
await page.goto('?id=checkbox--checkbox');
await page
.locator('glide-core-checkbox')
.evaluate<void, GlideCoreCheckbox>((element) => {
element.indeterminate = true;
});
await expect(page.locator('glide-core-checkbox')).toMatchAriaSnapshot({
name: `${test.titlePath.join('.')}.yml`,
});
});
test('slot="description"', async ({ page }, test) => {
await page.goto('?id=checkbox--checkbox');
await page
.locator('glide-core-checkbox')
.evaluate<void, GlideCoreCheckbox>((element) => {
const div = document.createElement('div');
div.textContent = 'Description';
div.slot = 'description';
element.append(div);
});
await expect(page.locator('glide-core-checkbox')).toMatchAriaSnapshot({
name: `${test.titlePath.join('.')}.yml`,
});
});
test('summary', async ({ page }, test) => {
await page.goto('?id=checkbox--checkbox');
await page
.locator('glide-core-checkbox')
.evaluate<void, GlideCoreCheckbox>((element) => {
element.summary = 'Summary';
});
await expect(page.locator('glide-core-checkbox')).toMatchAriaSnapshot({
name: `${test.titlePath.join('.')}.yml`,
});
});
test('tooltip', async ({ page }, test) => {
await page.goto('?id=checkbox--checkbox');
await page
.locator('glide-core-checkbox')
.evaluate<void, GlideCoreCheckbox>((element) => {
element.tooltip = 'Tooltip';
});
await page.locator('glide-core-tooltip').getByRole('button').focus();
await expect(page.locator('glide-core-checkbox')).toMatchAriaSnapshot({
name: `${test.titlePath.join('.')}.yml`,
});
});