@@ -606,7 +606,7 @@ We _always_ start with the Model test(s)
606
606
607
607
``` js
608
608
test (' Test: reset counter returns 0' , function (assert ) {
609
- var result = update (6 , " res " );
609
+ var result = update (6 , " reset " );
610
610
assert .equal (result, 0 );
611
611
});
612
612
```
@@ -634,20 +634,20 @@ we need to give the _user_ something to interact with! <br />
634
634
We are going to be "_ adventurous_ " and write _ two_ tests this time! <br />
635
635
(_ thankfully we already have a UI test for another button we can "copy"_ )
636
636
637
- ```
637
+ ``` js
638
638
test (' reset button should be present on page' , function (assert ) {
639
639
var reset = document .getElementsByClassName (' reset' );
640
- console.log(reset);
641
640
assert .equal (reset .length , 1 );
642
641
});
643
642
644
643
test (' Click reset button resets model (counter) to 0' , function (assert ) {
645
- mount({model: 7, update: update , view: view} , id); // set initial state
644
+ mount (7 , update, view, id); // set initial state
646
645
var root = document .getElementById (id);
647
646
assert .equal (root .getElementsByClassName (' count' )[0 ].textContent , 7 );
648
647
var btn = root .getElementsByClassName (" reset" )[0 ]; // click reset button
649
648
btn .click (); // Click the Reset button!
650
649
var state = root .getElementsByClassName (' count' )[0 ].textContent ;
650
+ empty (document .getElementById (id)); // Clear the test DOM elements
651
651
});
652
652
```
653
653
#### 9.5 Watch View/UI Tests Fail!
0 commit comments