@@ -39,23 +39,39 @@ describe("styed-tidy", () => {
3939 afterEach ( cleanup ) ;
4040
4141 describe ( "'is' matcher" , ( ) => {
42- const Test = styled . div < TestProps > `
43- ${ is ( "enabled" ) `color: green` } ;
44- ` ;
45-
4642 it ( "should render the given CSS when matched" , ( ) => {
43+ const Test = styled . div < TestProps > `
44+ ${ is ( "enabled" ) `color: green` } ;
45+ ` ;
4746 const { getByText } = setup ( < Test enabled > test</ Test > ) ;
4847 expect ( getByText ( "test" ) ) . toHaveStyleRule ( "color" , "green" ) ;
4948 } ) ;
5049
50+ it ( "should render the given CSS when given value is matched" , ( ) => {
51+ const Test = styled . div < TestProps > `
52+ ${ is ( "size" , "big" ) `color: green` } ;
53+ ` ;
54+ const { getByText } = setup ( < Test size = "big" > test</ Test > ) ;
55+ expect ( getByText ( "test" ) ) . toHaveStyleRule ( "color" , "green" ) ;
56+ } ) ;
57+
5158 it ( "should not render the given CSS when not matched" , ( ) => {
59+ const Test = styled . div < TestProps > `
60+ ${ is ( "enabled" ) `color: green` } ;
61+ ` ;
5262 const { getByText } = setup ( < Test > test</ Test > ) ;
5363 expect ( getByText ( "test" ) ) . not . toHaveStyleRule ( "color" ) ;
5464 } ) ;
55- } ) ;
5665
57- describe ( "'is' matcher with a mixin" , ( ) => {
58- it ( "should render the given CSS when matched" , ( ) => {
66+ it ( "should not render the given CSS when given value is not matched" , ( ) => {
67+ const Test = styled . div < TestProps > `
68+ ${ is ( "size" , "big" ) `color: green` } ;
69+ ` ;
70+ const { getByText } = setup ( < Test size = "small" > test</ Test > ) ;
71+ expect ( getByText ( "test" ) ) . not . toHaveStyleRule ( "color" ) ;
72+ } ) ;
73+
74+ it ( "should render the given CSS when matched when a mixin is included" , ( ) => {
5975 const Test = styled . div < TestProps > `
6076 ${ is ( "enabled" ) `height: ${ rem ( 16 ) } ` } ;
6177 ` ;
@@ -65,19 +81,37 @@ describe("styed-tidy", () => {
6581 } ) ;
6682
6783 describe ( "'isnt' matcher" , ( ) => {
68- const Test = styled . div < TestProps > `
69- ${ isnt ( "enabled" ) `color: red` } ;
70- ` ;
71-
7284 it ( "should not render the given CSS when matched" , ( ) => {
85+ const Test = styled . div < TestProps > `
86+ ${ isnt ( "enabled" ) `color: red` } ;
87+ ` ;
7388 const { getByText } = setup ( < Test enabled > test</ Test > ) ;
7489 expect ( getByText ( "test" ) ) . not . toHaveStyleRule ( "color" ) ;
7590 } ) ;
7691
7792 it ( "should render the given CSS when not matched" , ( ) => {
93+ const Test = styled . div < TestProps > `
94+ ${ isnt ( "enabled" ) `color: red` } ;
95+ ` ;
7896 const { getByText } = setup ( < Test > test</ Test > ) ;
7997 expect ( getByText ( "test" ) ) . toHaveStyleRule ( "color" , "red" ) ;
8098 } ) ;
99+
100+ it ( "should not render the given CSS when given value is matched" , ( ) => {
101+ const Test = styled . div < TestProps > `
102+ ${ isnt ( "size" , "small" ) `color: red` } ;
103+ ` ;
104+ const { getByText } = setup ( < Test size = "small" > test</ Test > ) ;
105+ expect ( getByText ( "test" ) ) . not . toHaveStyleRule ( "color" ) ;
106+ } ) ;
107+
108+ it ( "should render the given CSS when given value is not matched" , ( ) => {
109+ const Test = styled . div < TestProps > `
110+ ${ isnt ( "size" , "small" ) `color: red` } ;
111+ ` ;
112+ const { getByText } = setup ( < Test size = "big" > test</ Test > ) ;
113+ expect ( getByText ( "test" ) ) . toHaveStyleRule ( "color" , "red" ) ;
114+ } ) ;
81115 } ) ;
82116
83117 describe ( "'isAny' matcher" , ( ) => {
0 commit comments