File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
exercises/04.2-Apply-several-classes Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ const fs = require ( "fs" ) ;
2
+ const path = require ( "path" ) ;
3
+ const html = fs . readFileSync ( path . resolve ( __dirname , './index.html' ) , 'utf8' ) ;
4
+ document . documentElement . innerHTML = html . toString ( ) ;
5
+
6
+ jest . dontMock ( "fs" ) ;
7
+
8
+ describe ( "You should change the class on the div tag" , ( ) => {
9
+ const div = document . querySelectorAll ( "div" )
10
+ test ( "There should only be 1 div tag" , ( ) => {
11
+ expect ( div . length ) . toBe ( 1 )
12
+ } ) ;
13
+
14
+ test ( "The div class should NOT have the spades class" , ( ) => {
15
+ div . forEach ( e => {
16
+ expect ( e . classList . contains ( "spade" ) ) . toBe ( false )
17
+ } )
18
+ } ) ;
19
+ test ( "The div class should have the heart class" , ( ) => {
20
+ div . forEach ( e => {
21
+ expect ( e . classList . contains ( "heart" ) ) . toBe ( true )
22
+ } )
23
+ } ) ;
24
+ } ) ;
You can’t perform that action at this time.
0 commit comments