@@ -2,117 +2,16 @@ import {
22 renderComponentForVisualTest ,
33 takeSnapshot ,
44 click ,
5- waitFor ,
65} from '../../../jest.conf/visual.testUtils' ;
76
87describe . visual ( 'KBreadcrumbs Visual Tests' , ( ) => {
9- const snapshotOptions = { widths : [ 375 , 768 ] , minHeight : 200 } ;
8+ const snapshotOptions = { widths : [ 800 ] , minHeight : 1000 } ;
109
11- it ( 'Breadcrumbs - Single Item (showSingleItem)' , async ( ) => {
12- await renderComponentForVisualTest ( 'KBreadcrumbs' , {
13- items : [ { text : 'Single Item' , link : null } ] ,
14- showSingleItem : true ,
15- } ) ;
16- await takeSnapshot ( 'KBreadcrumbs - Single Item' , snapshotOptions ) ;
17- } ) ;
18-
19- it ( 'Breadcrumbs - Single Item (hidden)' , async ( ) => {
20- await renderComponentForVisualTest ( 'KBreadcrumbs' , {
21- items : [ { text : 'Single Item' , link : null } ] ,
22- showSingleItem : false ,
23- } ) ;
24- await takeSnapshot ( 'KBreadcrumbs - Single Item Hidden' , snapshotOptions ) ;
25- } ) ;
26-
27- it ( 'Breadcrumbs - Multiple Items (no overflow)' , async ( ) => {
28- await renderComponentForVisualTest ( 'KBreadcrumbs' , {
29- items : [
30- { text : 'Home' , link : { path : '/' } } ,
31- { text : 'Library' , link : { path : '/lib' } } ,
32- { text : 'Data' , link : null } ,
33- ] ,
34- } ) ;
35- await takeSnapshot ( 'KBreadcrumbs - No Overflow' , snapshotOptions ) ;
36- } ) ;
37-
38- it ( 'Breadcrumbs - Multiple Items with Long Text' , async ( ) => {
39- await renderComponentForVisualTest ( 'KBreadcrumbs' , {
40- items : [
41- { text : 'Home' , link : { path : '/' } } ,
42- {
43- text : 'A very long breadcrumb text that should truncate properly when displayed in the component' ,
44- link : { path : '/long' } ,
45- } ,
46- { text : 'Data' , link : null } ,
47- ] ,
48- } ) ;
49- await takeSnapshot ( 'KBreadcrumbs - Long Text' , snapshotOptions ) ;
50- } ) ;
51-
52- it ( 'Breadcrumbs - With Links' , async ( ) => {
53- await renderComponentForVisualTest ( 'KBreadcrumbs' , {
54- items : [
55- { text : 'Home' , link : { path : '/' } } ,
56- { text : 'Library' , link : { path : '/lib' } } ,
57- { text : 'Files' , link : { path : '/files' } } ,
58- ] ,
59- } ) ;
60- await takeSnapshot ( 'KBreadcrumbs - With Links' , snapshotOptions ) ;
61- } ) ;
62-
63- it ( 'Breadcrumbs - Overflow with Dropdown Open (with links)' , async ( ) => {
64- const narrowSnapshotOptions = { widths : [ 300 ] , minHeight : 200 } ;
65-
66- await renderComponentForVisualTest ( 'KBreadcrumbs' , {
67- items : [
68- { text : 'Home' , link : { path : '/' } } ,
69- { text : 'Library' , link : { path : '/lib' } } ,
70- { text : 'Category' , link : { path : '/category' } } ,
71- { text : 'Subcategory' , link : { path : '/subcategory' } } ,
72- { text : 'Files' , link : null } ,
73- ] ,
74- } ) ;
75-
76- // First, check if dropdown button exists, if not, take snapshot without dropdown
77- try {
78- await waitFor ( '.breadcrumbs-dropdown-wrapper button' ) ;
79- await click ( '.breadcrumbs-dropdown-wrapper button' ) ;
80- await waitFor ( '.breadcrumbs-dropdown-menu' ) ;
81- } catch ( error ) {
82- // Dropdown button not found, component may not be overflowing
83- }
84-
85- await takeSnapshot (
86- 'KBreadcrumbs - Overflow with Dropdown Open (with links)' ,
87- narrowSnapshotOptions ,
88- ) ;
89- } ) ;
90-
91- it ( 'Breadcrumbs - Overflow with Dropdown Open (without links)' , async ( ) => {
92- const narrowSnapshotOptions = { widths : [ 300 ] , minHeight : 200 } ;
93-
94- await renderComponentForVisualTest ( 'KBreadcrumbs' , {
95- items : [
96- { text : 'Home' , link : null } ,
97- { text : 'Library' , link : null } ,
98- { text : 'Category' , link : null } ,
99- { text : 'Subcategory' , link : null } ,
100- { text : 'Files' , link : null } ,
101- ] ,
102- } ) ;
10+ it ( 'Breadcrumbs - Visual Tests' , async ( ) => {
11+ await renderComponentForVisualTest ( 'KBreadcrumbsVisualTest' ) ;
10312
104- // First, check if dropdown button exists
105- try {
106- await waitFor ( '.breadcrumbs-dropdown-wrapper button' ) ;
107- await click ( '.breadcrumbs-dropdown-wrapper button' ) ;
108- await waitFor ( '.breadcrumbs-dropdown-menu' ) ;
109- } catch ( error ) {
110- // Dropdown button not found, component may not be overflowing
111- }
13+ await click ( '#with-overflow .breadcrumbs-dropdown-wrapper button' ) ;
11214
113- await takeSnapshot (
114- 'KBreadcrumbs - Overflow with Dropdown Open (without links)' ,
115- narrowSnapshotOptions ,
116- ) ;
15+ await takeSnapshot ( 'KBreadcrumbs visual tests' , snapshotOptions ) ;
11716 } ) ;
11817} ) ;
0 commit comments