@@ -3,6 +3,7 @@ import { visualDiff } from '@web/test-runner-visual-regression';
33import '@vaadin/icon' ;
44import '@vaadin/icons' ;
55import '../../../src/vaadin-badge.js' ;
6+ import type { Icon } from '@vaadin/icon' ;
67import type { Badge } from '../../../src/vaadin-badge.js' ;
78
89window . Vaadin ??= { } ;
@@ -25,20 +26,42 @@ describe('badge', () => {
2526 await visualDiff ( div , 'basic' ) ;
2627 } ) ;
2728
28- it ( 'icon' , async ( ) => {
29- const icon = document . createElement ( 'vaadin-icon' ) ;
30- icon . setAttribute ( 'slot' , 'prefix' ) ;
31- icon . icon = 'vaadin:check' ;
32- element . appendChild ( icon ) ;
33- element . append ( 'Completed' ) ;
34- await visualDiff ( div , 'icon' ) ;
29+ it ( 'number' , async ( ) => {
30+ element . number = 5 ;
31+ await visualDiff ( div , 'number' ) ;
3532 } ) ;
3633
37- it ( 'icon-only' , async ( ) => {
38- const icon = document . createElement ( 'vaadin-icon' ) ;
39- icon . setAttribute ( 'slot' , 'prefix' ) ;
40- icon . icon = 'vaadin:check' ;
41- element . appendChild ( icon ) ;
42- await visualDiff ( div , 'icon-only' ) ;
34+ it ( 'number-content' , async ( ) => {
35+ element . number = 3 ;
36+ element . textContent = 'Messages' ;
37+ await visualDiff ( div , 'number-content' ) ;
38+ } ) ;
39+
40+ describe ( 'icon' , ( ) => {
41+ let icon : Icon ;
42+
43+ beforeEach ( ( ) => {
44+ icon = document . createElement ( 'vaadin-icon' ) ;
45+ icon . setAttribute ( 'slot' , 'prefix' ) ;
46+ icon . icon = 'vaadin:check' ;
47+ } ) ;
48+
49+ it ( 'icon' , async ( ) => {
50+ element . appendChild ( icon ) ;
51+ await visualDiff ( div , 'icon' ) ;
52+ } ) ;
53+
54+ it ( 'icon-content' , async ( ) => {
55+ element . appendChild ( icon ) ;
56+ element . append ( 'Completed' ) ;
57+ await visualDiff ( div , 'icon-content' ) ;
58+ } ) ;
59+
60+ it ( 'icon-number-content' , async ( ) => {
61+ element . number = 3 ;
62+ element . appendChild ( icon ) ;
63+ element . append ( 'Completed' ) ;
64+ await visualDiff ( div , 'icon-number-content' ) ;
65+ } ) ;
4366 } ) ;
4467} ) ;
0 commit comments