@@ -70,7 +70,7 @@ test('mono utility only sets the font family and font-size-md carries the 13px s
7070 assert . match ( fontSizeMdRule , / f o n t - s i z e : \s * 1 3 p x / ) ;
7171} ) ;
7272
73- test ( 'dashboard layout pins Chart.js to 4.5.0' , ( ) => {
73+ test ( 'dashboard layout pins Chart.js to 4.5.0 and avoids unused htmx ' , ( ) => {
7474 const template = readFixture ( '../../../templates/layout.html' ) ;
7575
7676 assert . match (
@@ -85,10 +85,7 @@ test('dashboard layout pins Chart.js to 4.5.0', () => {
8585 template ,
8686 / < s c r i p t d e f e r s r c = " h t t p s : \/ \/ c d n \. j s d e l i v r \. n e t \/ n p m \/ a l p i n e j s @ 3 \. 1 5 \. 8 \/ d i s t \/ c d n \. m i n \. j s " i n t e g r i t y = " s h a 3 8 4 - L X W j K w D Z z 2 9 o 7 T d u N e \+ r \/ U x a o l H h 5 F s S v y 2 W 7 b D H S Z 8 j J e G g D e u N n s D N H o x p S g D i " c r o s s o r i g i n = " a n o n y m o u s " > < \/ s c r i p t > /
8787 ) ;
88- assert . match (
89- template ,
90- / < s c r i p t s r c = " h t t p s : \/ \/ u n p k g \. c o m \/ h t m x \. o r g @ 2 \. 0 \. 8 \/ d i s t \/ h t m x \. m i n \. j s " i n t e g r i t y = " s h a 3 8 4 - \/ T g k G k 7 p 3 0 7 T H 7 E X J D u U l g G 3 C e 1 U V o l A O F o p F e k Q k k X i h i 5 u \/ 6 O C v V K y z 1 W \+ i d a z " c r o s s o r i g i n = " a n o n y m o u s " > < \/ s c r i p t > /
91- ) ;
88+ assert . doesNotMatch ( template , / h t m x / i) ;
9289 assert . match (
9390 template ,
9491 / < s c r i p t s r c = " \/ a d m i n \/ s t a t i c \/ j s \/ m o d u l e s \/ c o n v e r s a t i o n - h e l p e r s \. j s " > < \/ s c r i p t > [ \s \S ] * < s c r i p t s r c = " \/ a d m i n \/ s t a t i c \/ j s \/ m o d u l e s \/ c l i p b o a r d \. j s " > < \/ s c r i p t > [ \s \S ] * < s c r i p t s r c = " \/ a d m i n \/ s t a t i c \/ j s \/ m o d u l e s \/ p r o v i d e r s \. j s " > < \/ s c r i p t > [ \s \S ] * < s c r i p t s r c = " \/ a d m i n \/ s t a t i c \/ j s \/ m o d u l e s \/ a u d i t - l i s t \. j s " > < \/ s c r i p t > [ \s \S ] * < s c r i p t s r c = " \/ a d m i n \/ s t a t i c \/ j s \/ m o d u l e s \/ a u t h - k e y s \. j s " > < \/ s c r i p t > [ \s \S ] * < s c r i p t s r c = " \/ a d m i n \/ s t a t i c \/ j s \/ m o d u l e s \/ g u a r d r a i l s \. j s " > < \/ s c r i p t > /
@@ -146,7 +143,7 @@ test('dashboard pages reuse a shared auth banner template', () => {
146143
147144 const authBannerCalls = indexTemplate . match ( / { { template " a u t h - b a n n e r " \. } } / g) || [ ] ;
148145 assert . equal ( authBannerCalls . length , 7 ) ;
149- assert . match ( indexTemplate , / < d i v x - s h o w = " p a g e = = = ' g u a r d r a i l s ' " > [ \s \S ] * { { template " a u t h - b a n n e r " \. } } / ) ;
146+ assert . match ( indexTemplate , / < t e m p l a t e x - i f = " p a g e = = = ' g u a r d r a i l s ' " > \s * < d i v > [ \s \S ] * { { template " a u t h - b a n n e r " \. } } / ) ;
150147 assert . doesNotMatch (
151148 indexTemplate ,
152149 / < d i v c l a s s = " a l e r t a l e r t - w a r n i n g " x - s h o w = " a u t h E r r o r " > [ \s \S ] * A u t h e n t i c a t i o n r e q u i r e d \. E n t e r y o u r A P I k e y i n t h e s i d e b a r t o v i e w d a t a \. [ \s \S ] * < \/ d i v > /
@@ -255,11 +252,13 @@ test('audit toolbar uses a full-width search row above the select row with a rig
255252test ( 'audit entry metadata is rendered as a labeled pill row at the bottom of the expanded entry' , ( ) => {
256253 const indexTemplate = readFixture ( '../../../templates/index.html' ) ;
257254 const css = readFixture ( '../../css/dashboard.css' ) ;
258- const auditEntryMatch = indexTemplate . match ( / < d i v c l a s s = " a u d i t - e n t r y - d e t a i l s " > [ \s \S ] * ?< \/ d i v > \s * < \/ d e t a i l s > / ) ;
255+ const detailsStart = indexTemplate . indexOf ( '<div class="audit-entry-details">' ) ;
256+ const detailsEnd = indexTemplate . indexOf ( '</template>' , detailsStart ) ;
259257
260- assert . ok ( auditEntryMatch , 'Expected audit entry details block' ) ;
258+ assert . notEqual ( detailsStart , - 1 , 'Expected audit entry details block' ) ;
259+ assert . notEqual ( detailsEnd , - 1 , 'Expected lazy audit entry details wrapper' ) ;
261260
262- const auditEntry = auditEntryMatch [ 0 ] ;
261+ const auditEntry = indexTemplate . slice ( detailsStart , detailsEnd ) ;
263262 const requestResponseIndex = auditEntry . indexOf ( '<div class="audit-request-response">' ) ;
264263 const metadataIndex = auditEntry . indexOf ( '<div class="audit-entry-metadata">' ) ;
265264
@@ -286,8 +285,38 @@ test('audit entry metadata is rendered as a labeled pill row at the bottom of th
286285 assert . match ( metadataContextRule , / f l e x - w r a p : \s * w r a p / ) ;
287286} ) ;
288287
289- test ( 'alias rows use a shared icon- only edit action ' , ( ) => {
288+ test ( 'model category tables lazy mount only the active table body ' , ( ) => {
290289 const indexTemplate = readFixture ( '../../../templates/index.html' ) ;
290+ const css = readFixture ( '../../css/dashboard.css' ) ;
291+ const modelsStart = indexTemplate . indexOf ( '<!-- Models Page -->' ) ;
292+ const workflowsStart = indexTemplate . indexOf ( '<!-- Workflows Page -->' ) ;
293+
294+ assert . notEqual ( modelsStart , - 1 , 'Expected models page block' ) ;
295+ assert . notEqual ( workflowsStart , - 1 , 'Expected workflows page block' ) ;
296+
297+ const modelsBlock = indexTemplate . slice ( modelsStart , workflowsStart ) ;
298+ const lazyTableMounts = modelsBlock . match ( / < t e m p l a t e x - i f = " \( [ ^ " ] * a c t i v e C a t e g o r y [ ^ " ] * " > \s * < d i v c l a s s = " t a b l e - w r a p p e r " > / g) || [ ] ;
299+
300+ assert . equal ( lazyTableMounts . length , 6 ) ;
301+ assert . doesNotMatch ( modelsBlock , / < d i v c l a s s = " t a b l e - w r a p p e r " x - s h o w = " \( [ ^ " ] * a c t i v e C a t e g o r y / ) ;
302+ assert . match ( modelsBlock , / a c t i v e C a t e g o r y = = = ' e m b e d d i n g ' [ \s \S ] * { { template " m o d e l - t a b l e - b o d y " \. } } / ) ;
303+ assert . match ( modelsBlock , / a c t i v e C a t e g o r y = = = ' u t i l i t y ' [ \s \S ] * { { template " m o d e l - t a b l e - b o d y " \. } } / ) ;
304+ assert . match ( modelsBlock , / c l a s s = " l o a d i n g - s t a t e " x - s h o w = " m o d e l s L o a d i n g & & ! a u t h E r r o r " r o l e = " s t a t u s " a r i a - l i v e = " p o l i t e " / ) ;
305+ assert . match ( modelsBlock , / x - t e x t = " d i s p l a y M o d e l s \. l e n g t h > 0 \? ' R e f r e s h i n g m o d e l s \. \. \. ' : ' L o a d i n g m o d e l s \. \. \. ' " / ) ;
306+
307+ const loadingRule = readCSSRule ( css , '.loading-state' ) ;
308+ assert . match ( loadingRule , / d i s p l a y : \s * f l e x / ) ;
309+ assert . match ( loadingRule , / m i n - h e i g h t : \s * 6 4 p x / ) ;
310+
311+ const spinnerRule = readCSSRule ( css , '.loading-spinner' ) ;
312+ assert . match ( spinnerRule , / a n i m a t i o n : \s * l o a d i n g - s p i n 0 \. 8 s l i n e a r i n f i n i t e / ) ;
313+ } ) ;
314+
315+ test ( 'alias rows use a shared icon-only edit action' , ( ) => {
316+ const indexTemplate = [
317+ readFixture ( '../../../templates/index.html' ) ,
318+ readFixture ( '../../../templates/model-table-body.html' )
319+ ] . join ( '\n' ) ;
291320 const editIconTemplate = readFixture ( '../../../templates/edit-icon.html' ) ;
292321
293322 assert . match (
@@ -326,7 +355,7 @@ test('audit request and response sections reuse a shared audit pane template', (
326355
327356 assert . match (
328357 auditPaneTemplate ,
329- / { { define " a u d i t - p a n e " } } [ \s \S ] * x - d a t a = " a u d i t P a n e S t a t e \( { { \. \} } \) " [ \s \S ] * x - t e x t = " p a n e \. t i t l e " [ \s \S ] * t y p e = " b u t t o n " [ \s \S ] * @ c l i c k \. p r e v e n t = " c o p y B o d y \( \) " [ \s \S ] * x - t e x t = " f o r m a t J S O N \( p a n e \. h e a d e r s \) " [ \s \S ] * r e n d e r B o d y W i t h C o n v e r s a t i o n H i g h l i g h t s \( p a n e \. e n t r y , p a n e \. b o d y \) [ \s \S ] * x - t e x t = " p a n e \. e m p t y M e s s a g e " [ \s \S ] * x - t e x t = " p a n e \. t o o L a r g e M e s s a g e " [ \s \S ] * { { end} } /
358+ / { { define " a u d i t - p a n e " } } [ \s \S ] * x - d a t a = " a u d i t P a n e S t a t e \( { { \. \} } \) " [ \s \S ] * x - t e x t = " p a n e \. t i t l e " [ \s \S ] * t y p e = " b u t t o n " [ \s \S ] * @ c l i c k \. p r e v e n t = " c o p y B o d y \( \) " [ \s \S ] * x - t e x t = " f o r m a t t e d H e a d e r s " [ \s \S ] * x - h t m l = " r e n d e r e d B o d y " [ \s \S ] * x - t e x t = " p a n e \. e m p t y M e s s a g e " [ \s \S ] * x - t e x t = " p a n e \. t o o L a r g e M e s s a g e " [ \s \S ] * { { end} } /
330359 ) ;
331360 assert . match ( indexTemplate , / { { template " a u d i t - p a n e " " a u d i t R e q u e s t P a n e \( e n t r y \) " } } / ) ;
332361 assert . match ( indexTemplate , / { { template " a u d i t - p a n e " " a u d i t R e s p o n s e P a n e \( e n t r y \) " } } / ) ;
0 commit comments