@@ -139,16 +139,66 @@ const testConfigs: {
139139describe ( 'typography' , ( ) => {
140140 for ( const tc of testConfigs ) {
141141 it ( tc . name , async ( ) => {
142- const generator = await createGenerator ( {
142+ const uno = await createGenerator ( {
143143 presets : [
144144 presetAttributify ( tc . attributifyOptions ) ,
145145 presetUno ( { preflight : false } ) ,
146146 presetTypography ( tc . typographyOptions ) ,
147147 ] ,
148148 } )
149149
150- const { css } = await generator . generate ( tc . input )
150+ const { css } = await uno . generate ( tc . input )
151151 expect ( css ) . toMatchSnapshot ( )
152152 } )
153153 }
154154} )
155+
156+ describe ( 'typography elements modify' , ( ) => {
157+ it ( 'basic' , async ( ) => {
158+ const uno = await createGenerator ( {
159+ presets : [
160+ presetAttributify ( ) ,
161+ presetUno ( { preflight : false } ) ,
162+ presetTypography ( ) ,
163+ ] ,
164+ } )
165+
166+ const { css } = await uno . generate ( '<div prose-headings:text-red prose-img:rounded hover:prose-p-m2></div>' , { preflights : false } )
167+
168+ expect ( css ) . toMatchInlineSnapshot ( `
169+ "/* layer: default */
170+ [hover\\:prose-p-m2=""] :is(:where(p):not(:where(.not-prose,.not-prose *))):hover{margin:0.5rem;}
171+ .prose-img\\:rounded :is(:where(img):not(:where(.not-prose,.not-prose *))),
172+ [prose-img\\:rounded=""] :is(:where(img):not(:where(.not-prose,.not-prose *))){border-radius:0.25rem;}
173+ .prose-headings\\:text-red :is(:where(h1,h2,h3,h4,h5,h6,th):not(:where(.not-prose,.not-prose *))),
174+ [prose-headings\\:text-red=""] :is(:where(h1,h2,h3,h4,h5,h6,th):not(:where(.not-prose,.not-prose *))){--un-text-opacity:1;color:rgb(248 113 113 / var(--un-text-opacity));}"
175+ ` )
176+ } )
177+
178+ it ( 'basic without compatibility' , async ( ) => {
179+ const uno = await createGenerator ( {
180+ presets : [
181+ presetAttributify ( ) ,
182+ presetUno ( { preflight : false } ) ,
183+ presetTypography ( {
184+ compatibility : {
185+ noColonIs : true ,
186+ noColonWhere : true ,
187+ noColonNot : true ,
188+ } ,
189+ } ) ,
190+ ] ,
191+ } )
192+
193+ const { css } = await uno . generate ( '<div prose-headings:text-red prose-img:rounded hover:prose-p-m2></div>' , { preflights : false } )
194+
195+ expect ( css ) . toMatchInlineSnapshot ( `
196+ "/* layer: default */
197+ [hover\\:prose-p-m2=""] p:hover{margin:0.5rem;}
198+ .prose-img\\:rounded img,
199+ [prose-img\\:rounded=""] img{border-radius:0.25rem;}
200+ .prose-headings\\:text-red h1,.prose-headings\\:text-red h2,.prose-headings\\:text-red h3,.prose-headings\\:text-red h4,.prose-headings\\:text-red h5,.prose-headings\\:text-red h6,.prose-headings\\:text-red th,
201+ [prose-headings\\:text-red=""] h1,[prose-headings\\:text-red=""] h2,[prose-headings\\:text-red=""] h3,[prose-headings\\:text-red=""] h4,[prose-headings\\:text-red=""] h5,[prose-headings\\:text-red=""] h6,[prose-headings\\:text-red=""] th{--un-text-opacity:1;color:rgb(248 113 113 / var(--un-text-opacity));}"
202+ ` )
203+ } )
204+ } )
0 commit comments