File tree 1 file changed +22
-2
lines changed
1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -786,9 +786,29 @@ which is _checked_ (`done=true`)
786
786
that are _ unchecked_ (` done=false ` )
787
787
788
788
789
- We can _ easily_ write a _ test_ that includes these 3 assertions:
790
-
789
+ We can _ easily_ write a _ test_ that includes these 3 assertions.
790
+ Append following test code to your ` test/todo-app.test.js ` file:
791
791
792
+ ``` js
793
+ test (' render "main" view using (elmish) HTML DOM functions' , function (t ) {
794
+ const model = {
795
+ todos: [
796
+ { id: 1 , title: " Learn Elm Architecture" , done: true },
797
+ { id: 2 , title: " Build Todo List App" , done: false },
798
+ { id: 3 , title: " Win the Internet!" , done, false }
799
+ ],
800
+ hash: ' #/' // the "route" to display
801
+ };
802
+ const html = app .main (model);
803
+
804
+ const done = document .querySelectorAll (' .completed' )[0 ].textContent ;
805
+ t .equal (done, ' Learn Elm Architecture' , ' Done: Learn "TEA"' );
806
+ const todo = document .querySelectorAll (' .view' )[1 ].textContent ;
807
+ t .equal (todo, ' Build Todo List App' , ' Todo: Build Todo List App' );
808
+ elmish .empty (document .getElementById (id));
809
+ t .end ();
810
+ });
811
+ ```
792
812
793
813
794
814
You can’t perform that action at this time.
0 commit comments