@@ -130,11 +130,24 @@ it('negated ".not" modifier with value', () => {
130
130
opacity: 0.65;
131
131
` ;
132
132
133
- notToHaveStyleRule ( < Button /> , 'opacity' , '0.50' ) ;
134
- notToHaveStyleRule ( < Button /> , 'opacity' , '' ) ;
135
- notToHaveStyleRule ( < Button /> , 'opacity' , null ) ;
136
- notToHaveStyleRule ( < Button /> , 'opacity' , false ) ;
137
- notToHaveStyleRule ( < Button /> , 'opacity' , undefined ) ;
133
+ notToHaveStyleRule ( < Button /> , "opacity" , "0.50" ) ;
134
+ notToHaveStyleRule ( < Button /> , "opacity" , "" ) ;
135
+ notToHaveStyleRule ( < Button /> , "opacity" , null ) ;
136
+ notToHaveStyleRule ( < Button /> , "opacity" , false ) ;
137
+ expect ( ( ) => {
138
+ toHaveStyleRule ( < Button /> , "opacity" , undefined ) ;
139
+ } ) . toThrowError ( ) ;
140
+ } ) ;
141
+
142
+ it ( 'negated ".not" modifier fails when rule present with no value being asserted' , ( ) => {
143
+ const Button = styled . button `
144
+ opacity: 0.65;
145
+ ` ;
146
+
147
+ toHaveStyleRule ( < Button /> , "opacity" , "0.65" ) ;
148
+ expect ( ( ) => {
149
+ notToHaveStyleRule ( < Button /> , "opacity" ) ;
150
+ } ) . toThrowError ( ) ;
138
151
} ) ;
139
152
140
153
it ( 'jest asymmetric matchers' , ( ) => {
0 commit comments