@@ -20,6 +20,7 @@ function columns(query, mail) {
2020 ? [ [ "Mail" , "yii-debug-col-num yii-debug-col-mail" , "mailCount" ] ]
2121 : [ ] ) ,
2222 [ "Method" , "" , "method" ] ,
23+ [ "Status" , "yii-debug-col-status" , "statusCode" ] ,
2324 [ "AJAX" , "" , "ajax" ] ,
2425 [ "URL" , "" , "url" ] ,
2526 ] ;
@@ -52,6 +53,7 @@ function rows(definitions, count) {
5253 Query : "3" ,
5354 Mail : "0" ,
5455 Method : "COMMAND" ,
56+ Status : '<span class="yii-debug-badge yii-debug-status-2xx">200</span>' ,
5557 AJAX : "Yes" ,
5658 URL : `<span class="yii-debug-url-cell" title="${ url } ">${ url } </span>` ,
5759 } ;
@@ -65,19 +67,32 @@ function rows(definitions, count) {
6567 } ) . join ( "" ) ;
6668}
6769
70+ // IP and Mail hide up to 1600 px; the explicit widths pin both sides of that breakpoint on the desktop project.
6871for ( const [ adapter , query , mail ] of [
6972 [ "Yii2" , true , true ] ,
7073 [ "Yii2 without Mail" , true , false ] ,
7174 [ "Yii2 without Database" , false , true ] ,
7275 [ "Yii3" , false , false ] ,
7376] ) {
7477 for ( const theme of [ "light" , "dark" ] ) {
75- test ( `${ adapter } History keeps column widths stable in ${ theme } theme` , async ( {
76- page,
77- } ) => {
78- const definitions = columns ( query , mail ) ;
78+ for ( const width of [ null , 1600 , 1680 ] ) {
79+ const at = width ? ` at ${ width } px` : "" ;
80+
81+ test ( `${ adapter } History keeps column widths stable in ${ theme } theme${ at } ` , async ( {
82+ page,
83+ } , testInfo ) => {
84+ test . skip (
85+ width !== null && testInfo . project . name !== "desktop-1440" ,
86+ "Explicit breakpoint widths run on the desktop project only." ,
87+ ) ;
88+
89+ if ( width ) {
90+ await page . setViewportSize ( { width, height : 900 } ) ;
91+ }
92+
93+ const definitions = columns ( query , mail ) ;
7994
80- await page . setContent ( `
95+ await page . setContent ( `
8196 <!doctype html>
8297 <html lang="en" data-yii-debug-theme="${ theme } ">
8398 <body class="yii-debug">
@@ -99,50 +114,61 @@ for (const [adapter, query, mail] of [
99114 </body>
100115 </html>
101116 ` ) ;
102- await page . addStyleTag ( { path : stylesheet . pathname } ) ;
103- await waitForStableUI ( page ) ;
104-
105- const headers = page . locator ( "thead th" ) ;
106- const widths = ( ) =>
107- headers . evaluateAll ( ( cells ) =>
108- cells . map ( ( cell ) => cell . getBoundingClientRect ( ) . width ) ,
109- ) ;
110- const baseline = await widths ( ) ;
111- const viewport = page . viewportSize ( ) ;
112-
113- expect ( baseline . slice ( 0 , 5 ) ) . toEqual ( [ 36 , 276 , 80 , 100 , 100 ] ) ;
114- expect ( baseline [ 5 ] ) . toBe ( viewport . width <= 1366 ? 0 : 112 ) ;
115- expect ( baseline . slice ( - 3 , - 1 ) ) . toEqual ( [ 128 , 84 ] ) ;
116-
117- // Replacing the result rows models server-rendered filtering and paging.
118- for ( const count of [ 50 , 1 , 0 , 10 ] ) {
119- await page . locator ( "tbody" ) . evaluate (
120- ( body , html ) => {
121- body . innerHTML = html ;
122- } ,
123- count
124- ? rows ( definitions , count )
125- : `<tr><td colspan="${ definitions . length } ">No results found.</td></tr>` ,
126- ) ;
127- expect (
128- await widths ( ) ,
129- `${ count } results must preserve every column` ,
130- ) . toEqual ( baseline ) ;
131-
132- const overflow = await page . evaluate ( ( ) => ( {
133- viewport : document . documentElement . clientWidth ,
134- document : document . documentElement . scrollWidth ,
135- previews : [ ...document . querySelectorAll ( ".yii-debug-url-cell" ) ] . every (
136- ( element ) =>
137- element . getBoundingClientRect ( ) . right <=
138- element . parentElement . getBoundingClientRect ( ) . right ,
139- ) ,
140- } ) ) ;
141-
142- expect ( overflow . document ) . toBeLessThanOrEqual ( overflow . viewport ) ;
143- expect ( overflow . previews ) . toBe ( true ) ;
144- }
145- } ) ;
117+ await page . addStyleTag ( { path : stylesheet . pathname } ) ;
118+ await waitForStableUI ( page ) ;
119+
120+ const headers = page . locator ( "thead th" ) ;
121+ const widths = ( ) =>
122+ headers . evaluateAll ( ( cells ) =>
123+ cells . map ( ( cell ) => cell . getBoundingClientRect ( ) . width ) ,
124+ ) ;
125+ const baseline = await widths ( ) ;
126+ const viewport = page . viewportSize ( ) ;
127+
128+ expect ( baseline . slice ( 0 , 5 ) ) . toEqual ( [ 36 , 276 , 80 , 100 , 100 ] ) ;
129+ const hidden = viewport . width <= 1600 ;
130+
131+ expect ( baseline [ 5 ] , "IP width" ) . toBe ( hidden ? 0 : 112 ) ;
132+ if ( mail ) {
133+ expect (
134+ baseline [ definitions . findIndex ( ( [ label ] ) => label === "Mail" ) ] ,
135+ "Mail width" ,
136+ ) . toBe ( hidden ? 0 : 56 ) ;
137+ }
138+ expect ( baseline . slice ( - 4 , - 1 ) ) . toEqual ( [ 128 , 72 , 84 ] ) ;
139+
140+ // Replacing the result rows models server-rendered filtering and paging.
141+ for ( const count of [ 50 , 1 , 0 , 10 ] ) {
142+ await page . locator ( "tbody" ) . evaluate (
143+ ( body , html ) => {
144+ body . innerHTML = html ;
145+ } ,
146+ count
147+ ? rows ( definitions , count )
148+ : `<tr><td colspan="${ definitions . length } ">No results found.</td></tr>` ,
149+ ) ;
150+ expect (
151+ await widths ( ) ,
152+ `${ count } results must preserve every column` ,
153+ ) . toEqual ( baseline ) ;
154+
155+ const overflow = await page . evaluate ( ( ) => ( {
156+ viewport : document . documentElement . clientWidth ,
157+ document : document . documentElement . scrollWidth ,
158+ previews : [
159+ ...document . querySelectorAll ( ".yii-debug-url-cell" ) ,
160+ ] . every (
161+ ( element ) =>
162+ element . getBoundingClientRect ( ) . right <=
163+ element . parentElement . getBoundingClientRect ( ) . right ,
164+ ) ,
165+ } ) ) ;
166+
167+ expect ( overflow . document ) . toBeLessThanOrEqual ( overflow . viewport ) ;
168+ expect ( overflow . previews ) . toBe ( true ) ;
169+ }
170+ } ) ;
171+ }
146172 }
147173}
148174
0 commit comments