Skip to content

Commit 070ef86

Browse files
authored
test: add visual tests for buttons with icons in base theme (#9497)
1 parent 5d30d5f commit 070ef86

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

packages/button/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"devDependencies": {
4747
"@vaadin/chai-plugins": "25.0.0-alpha4",
4848
"@vaadin/icon": "25.0.0-alpha4",
49+
"@vaadin/icons": "25.0.0-alpha4",
4950
"@vaadin/test-runner-commands": "25.0.0-alpha4",
5051
"@vaadin/testing-helpers": "^2.0.0",
5152
"sinon": "^18.0.0"

packages/button/test/visual/base/button.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { resetMouse, sendKeys, sendMouseToElement } from '@vaadin/test-runner-commands';
22
import { fixtureSync, mousedown } from '@vaadin/testing-helpers';
33
import { visualDiff } from '@web/test-runner-visual-regression';
4+
import '@vaadin/icon/src/vaadin-icon.js';
5+
import '@vaadin/icons/vaadin-iconset.js';
46
import '../../../src/vaadin-button.js';
57

68
describe('button', () => {
@@ -50,4 +52,25 @@ describe('button', () => {
5052
});
5153
});
5254
});
55+
56+
describe('icon', () => {
57+
const PREFIX_ICON = '<vaadin-icon icon="vaadin:reply" slot="prefix"></vaadin-icon>';
58+
const SUFFIX_ICON = '<vaadin-icon icon="vaadin:reply" slot="suffix"></vaadin-icon>';
59+
60+
it('before text', async () => {
61+
element.insertAdjacentHTML('afterbegin', PREFIX_ICON);
62+
await visualDiff(div, 'icon-before-text');
63+
});
64+
65+
it('after text', async () => {
66+
element.insertAdjacentHTML('beforeend', SUFFIX_ICON);
67+
await visualDiff(div, 'icon-after-text');
68+
});
69+
70+
it('without text', async () => {
71+
element.textContent = '';
72+
element.insertAdjacentHTML('afterbegin', PREFIX_ICON);
73+
await visualDiff(div, 'icon-without-text');
74+
});
75+
});
5376
});
Loading
Loading
Loading

0 commit comments

Comments
 (0)