@@ -26,3 +26,62 @@ test("cssToJs wraps read and parse errors with file context", async () => {
2626 "Error converting CSS to JS:" ,
2727 )
2828} )
29+
30+ test ( "menu-paged compiles its nested page and back-button states" , async ( ) => {
31+ const result = JSON . parse ( await cssToJs ( join ( import . meta. dirname , "../src/components/menu.css" ) ) )
32+ const paged = result [ ".menu-paged" ] [ "@layer daisyui.l1.l2" ]
33+
34+ expect ( paged ) . toMatchObject ( {
35+ "--menu-paged-arrow" : "135deg" ,
36+ "--menu-paged-back-arrow" : "-45deg" ,
37+ '[dir="rtl"] &' : {
38+ "--menu-paged-arrow" : "-45deg" ,
39+ "--menu-paged-back-arrow" : "135deg" ,
40+ } ,
41+ ":where(li ul, li menu):before" : {
42+ "--tw-content" : "none" ,
43+ content : "var(--tw-content)" ,
44+ } ,
45+ "details::details-content" : { transition : "none" } ,
46+ ":where(li > details > summary):after" : {
47+ rotate : "var(--menu-paged-arrow)" ,
48+ translate : "0" ,
49+ transition : "none" ,
50+ } ,
51+ } )
52+ expect (
53+ paged [
54+ "&:has(> li > details[open]) > li:not(:has(> details[open])), :where(:is(ul, menu):has(> li > details[open]) > li:not(:has(> details[open])))"
55+ ] ,
56+ ) . toEqual ( { display : "none" } )
57+ expect (
58+ paged [
59+ ":where(li:has(> details[open]), details[open], details[open] > :is(ul, menu)), :where(details[open])::details-content"
60+ ] ,
61+ ) . toEqual ( { display : "contents" } )
62+ expect (
63+ paged [ ":where(details[open]:has(> :is(ul, menu) > li > details[open]) > summary)" ] ,
64+ ) . toEqual ( { display : "none" } )
65+ expect ( paged [ ":where(li > details[open] > summary):after" ] ) . toEqual ( {
66+ order : - 1 ,
67+ "justify-self" : "flex-start" ,
68+ rotate : "var(--menu-paged-back-arrow)" ,
69+ } )
70+
71+ expect ( result [ ".menu-horizontal" ] [ "@layer daisyui.l1.l2" ] [ "&.menu-paged" ] ) . toEqual ( {
72+ "--menu-paged-arrow" : "-135deg" ,
73+ "--menu-paged-back-arrow" : "45deg" ,
74+ "& > li:not(.menu-title) > details > :is(ul, menu)" : {
75+ animation : "none" ,
76+ transition : "none" ,
77+ } ,
78+ } )
79+ expect ( result [ ".menu-vertical" ] [ "@layer daisyui.l1.l2" ] [ "&.menu-paged" ] ) . toEqual ( {
80+ "--menu-paged-arrow" : "135deg" ,
81+ "--menu-paged-back-arrow" : "-45deg" ,
82+ '[dir="rtl"] &' : {
83+ "--menu-paged-arrow" : "-45deg" ,
84+ "--menu-paged-back-arrow" : "135deg" ,
85+ } ,
86+ } )
87+ } )
0 commit comments