@@ -28,6 +28,96 @@ test("shadow values - single nested variables", () => {
2828 } ) ;
2929} ) ;
3030
31+ test ( "single shadow via runtime variable" , ( ) => {
32+ registerCSS (
33+ `.test {
34+ --my-shadow: 0 4px 6px -1px #000;
35+ box-shadow: var(--my-shadow);
36+ }` ,
37+ { inlineVariables : false } ,
38+ ) ;
39+
40+ render ( < View testID = { testID } className = "test" /> ) ;
41+ const component = screen . getByTestId ( testID ) ;
42+
43+ expect ( component . props . style . boxShadow ) . toStrictEqual ( [
44+ {
45+ offsetX : 0 ,
46+ offsetY : 4 ,
47+ blurRadius : 6 ,
48+ spreadDistance : - 1 ,
49+ color : "#000" ,
50+ } ,
51+ ] ) ;
52+ } ) ;
53+
54+ test ( "single shadow via multi-definition variable (theme switching)" , ( ) => {
55+ registerCSS ( `
56+ :root { --themed-shadow: 0 4px 6px -1px #000; }
57+ .dark { --themed-shadow: 0 4px 6px -1px #fff; }
58+ .test { box-shadow: var(--themed-shadow); }
59+ ` ) ;
60+
61+ render ( < View testID = { testID } className = "test" /> ) ;
62+ const component = screen . getByTestId ( testID ) ;
63+
64+ expect ( component . props . style . boxShadow ) . toStrictEqual ( [
65+ {
66+ offsetX : 0 ,
67+ offsetY : 4 ,
68+ blurRadius : 6 ,
69+ spreadDistance : - 1 ,
70+ color : "#000" ,
71+ } ,
72+ ] ) ;
73+ } ) ;
74+
75+ test ( "transparent shadow via runtime variable is filtered" , ( ) => {
76+ registerCSS (
77+ `.test {
78+ --my-shadow: 0 0 0 0 #0000;
79+ box-shadow: var(--my-shadow);
80+ }` ,
81+ { inlineVariables : false } ,
82+ ) ;
83+
84+ render ( < View testID = { testID } className = "test" /> ) ;
85+ const component = screen . getByTestId ( testID ) ;
86+
87+ expect ( component . props . style . boxShadow ) . toStrictEqual ( [ ] ) ;
88+ } ) ;
89+
90+ test ( "multi-shadow via runtime variables (comma-separated)" , ( ) => {
91+ registerCSS (
92+ `.test {
93+ --shadow-a: 0 4px 6px -1px #000;
94+ --shadow-b: 0 1px 2px 0 #333;
95+ box-shadow: var(--shadow-a), var(--shadow-b);
96+ }` ,
97+ { inlineVariables : false } ,
98+ ) ;
99+
100+ render ( < View testID = { testID } className = "test" /> ) ;
101+ const component = screen . getByTestId ( testID ) ;
102+
103+ expect ( component . props . style . boxShadow ) . toStrictEqual ( [
104+ {
105+ offsetX : 0 ,
106+ offsetY : 4 ,
107+ blurRadius : 6 ,
108+ spreadDistance : - 1 ,
109+ color : "#000" ,
110+ } ,
111+ {
112+ offsetX : 0 ,
113+ offsetY : 1 ,
114+ blurRadius : 2 ,
115+ spreadDistance : 0 ,
116+ color : "#333" ,
117+ } ,
118+ ] ) ;
119+ } ) ;
120+
31121test ( "shadow values - multiple nested variables" , ( ) => {
32122 registerCSS ( `
33123 :root {
0 commit comments