@@ -181,7 +181,12 @@ describe("[Unit] ElementAssertion.test.ts", () => {
181
181
const divTest = await findByTestId ( "classTest" ) ;
182
182
divTest . className = "foo bar" ;
183
183
const test = new ElementAssertion ( divTest ) ;
184
+
184
185
expect ( test . toHaveClass ( "foo" ) ) . toBeEqual ( test ) ;
186
+
187
+ expect ( ( ) => test . not . toHaveClass ( "foo" ) )
188
+ . toThrowError ( AssertionError )
189
+ . toHaveMessage ( "Expected the element to NOT have class(es): \"foo\"" ) ;
185
190
} ) ;
186
191
} ) ;
187
192
@@ -191,9 +196,12 @@ describe("[Unit] ElementAssertion.test.ts", () => {
191
196
const divTest = await findByTestId ( "classTest" ) ;
192
197
divTest . className = "foo" ;
193
198
const test = new ElementAssertion ( divTest ) ;
199
+
194
200
expect ( ( ) => test . toHaveClass ( "bar" ) )
195
201
. toThrowError ( AssertionError )
196
202
. toHaveMessage ( "Expected the element to have class(es): \"bar\"" ) ;
203
+
204
+ expect ( test . not . toHaveClass ( "bar" ) ) . toBeEqual ( test ) ;
197
205
} ) ;
198
206
} ) ;
199
207
@@ -203,7 +211,12 @@ describe("[Unit] ElementAssertion.test.ts", () => {
203
211
const divTest = await findByTestId ( "classTest" ) ;
204
212
divTest . className = "foo bar" ;
205
213
const test = new ElementAssertion ( divTest ) ;
214
+
206
215
expect ( test . toHaveClass ( [ "foo" , "bar" ] , { exact : true } ) ) . toBeEqual ( test ) ;
216
+
217
+ expect ( ( ) => test . not . toHaveClass ( [ "foo" , "bar" ] , { exact : true } ) )
218
+ . toThrowError ( AssertionError )
219
+ . toHaveMessage ( "Expected the element to NOT have exactly these classes: \"foo bar\"" ) ;
207
220
} ) ;
208
221
} ) ;
209
222
@@ -213,9 +226,12 @@ describe("[Unit] ElementAssertion.test.ts", () => {
213
226
const divTest = await findByTestId ( "classTest" ) ;
214
227
divTest . className = "foo bar extra" ;
215
228
const test = new ElementAssertion ( divTest ) ;
229
+
216
230
expect ( ( ) => test . toHaveClass ( [ "foo" , "bar" ] , { exact : true } ) )
217
231
. toThrowError ( AssertionError )
218
232
. toHaveMessage ( "Expected the element to have exactly these classes: \"foo bar\"" ) ;
233
+
234
+ expect ( test . not . toHaveClass ( [ "foo" , "bar" ] , { exact : true } ) ) . toBeEqual ( test ) ;
219
235
} ) ;
220
236
} ) ;
221
237
} ) ;
0 commit comments