@@ -4,7 +4,43 @@ import { registerCSS, testID } from "react-native-css/jest";
44
55import { compile } from "../compiler" ;
66
7- test ( "@prop single" , ( ) => {
7+ test ( "@prop target (nested @media)" , ( ) => {
8+ const compiled = registerCSS ( `
9+ .my-class {
10+ @prop test;
11+ @media all {
12+ color: #00f;
13+ }
14+ }
15+ ` ) ;
16+
17+ expect ( compiled . stylesheet ( ) ) . toStrictEqual ( {
18+ s : [
19+ [
20+ "my-class" ,
21+ [
22+ {
23+ d : [ [ "#00f" , [ "test" ] ] ] ,
24+ v : [ [ "__rn-css-color" , "#00f" ] ] ,
25+ s : [ 2 , 1 ] ,
26+ } ,
27+ ] ,
28+ ] ,
29+ ] ,
30+ } ) ;
31+
32+ render ( < View testID = { testID } className = "my-class" /> ) ;
33+ const component = screen . getByTestId ( testID ) ;
34+
35+ expect ( component . props ) . toStrictEqual ( {
36+ testID,
37+ children : undefined ,
38+ test : "#00f" ,
39+ style : { } ,
40+ } ) ;
41+ } ) ;
42+
43+ test ( "@prop value: target" , ( ) => {
844 const compiled = registerCSS ( `
945 .my-class {
1046 color: red;
@@ -46,7 +82,7 @@ test("@prop single", () => {
4682 } ) ;
4783} ) ;
4884
49- test ( "@prop single, nested value " , ( ) => {
85+ test ( "@prop value: nested target " , ( ) => {
5086 const compiled = compile ( `
5187 .test {
5288 color: red;
@@ -76,7 +112,7 @@ test("@prop single, nested value", () => {
76112 } ) ;
77113} ) ;
78114
79- test ( "@prop single, on target" , ( ) => {
115+ test ( "@prop value: wildcard target" , ( ) => {
80116 const compiled = compile ( `
81117 .test {
82118 color: red;
@@ -106,7 +142,7 @@ test("@prop single, on target", () => {
106142 } ) ;
107143} ) ;
108144
109- test ( "@prop single, nested" , ( ) => {
145+ test ( "@prop value: wildcard nested target " , ( ) => {
110146 const compiled = registerCSS ( `
111147 .my-class {
112148 color: red;
@@ -146,36 +182,6 @@ test("@prop single, nested", () => {
146182 } ) ;
147183} ) ;
148184
149- test ( "@prop single, top level, nested" , ( ) => {
150- const compiled = compile ( `
151- .test {
152- color: red;
153- background-color: blue;
154- @prop background-color: myBackgroundColor.test;
155- }
156- ` ) ;
157-
158- expect ( compiled . stylesheet ( ) ) . toStrictEqual ( {
159- s : [
160- [
161- "test" ,
162- [
163- {
164- d : [
165- {
166- color : "#f00" ,
167- } ,
168- [ "#00f" , [ "myBackgroundColor" , "test" ] ] ,
169- ] ,
170- s : [ 1 , 1 ] ,
171- v : [ [ "__rn-css-color" , "#f00" ] ] ,
172- } ,
173- ] ,
174- ] ,
175- ] ,
176- } ) ;
177- } ) ;
178-
179185test ( "@prop multiple" , ( ) => {
180186 const compiled = compile ( `
181187 .test {
0 commit comments