File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,6 +148,31 @@ test("rem - css root font-size override", () => {
148148 } ) ;
149149} ) ;
150150
151+ test ( "rem - via var() inlining picks up css root font-size (Tailwind v4 style)" , ( ) => {
152+ // Regression test for the second-pass parseLength bug.
153+ // Tailwind v4 emits utilities as `:root { --text-base: 1rem }` +
154+ // `.text-base { font-size: var(--text-base) }`. The `1rem` inside
155+ // the custom property is a token-list that skips the first-pass
156+ // Length visitor and gets resolved later by parseLength, which
157+ // reads inlineRem from the builder's options. Without the fix
158+ // that writes regex-discovered rem back to options, parseLength
159+ // falls back to 14 and this resolves to `fontSize: 14`.
160+ registerCSS ( `
161+ :root { font-size: 16px; --text-base: 1rem; }
162+ .text-base { font-size: var(--text-base); }
163+ ` ) ;
164+
165+ const { result } = renderHook ( ( ) => {
166+ return useNativeCss ( View , { className : "text-base" } ) ;
167+ } ) ;
168+
169+ expect ( result . current . type ) . toBe ( VariableContext . Provider ) ;
170+ expect ( result . current . props . children . type ) . toBe ( View ) ;
171+ expect ( result . current . props . children . props ) . toStrictEqual ( {
172+ style : { fontSize : 16 } ,
173+ } ) ;
174+ } ) ;
175+
151176test ( "rem - css override" , ( ) => {
152177 registerCSS (
153178 `
You can’t perform that action at this time.
0 commit comments