This repository was archived by the owner on Jun 7, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,4 +79,22 @@ def test_livecode_datafile(self):
7979 try :
8080 self .assertLess (count , 20 )
8181 except :
82- print ("WARNING - No response from JOBE server" )
82+ print ("WARNING - No response from JOBE server" )
83+
84+ def test_activity_count (self ):
85+ self .driver .get (self .host + "/index.html" )
86+ t2 = self .driver .find_element_by_id ("test1" )
87+ self .assertIsNotNone (t2 )
88+ rb = t2 .find_element_by_class_name ("run-button" )
89+ self .assertIsNotNone (rb )
90+ rb .click ()
91+ pb = self .driver .find_element_by_id ("subchapterprogress" )
92+ self .assertIsNotNone (pb )
93+ total = self .driver .find_element_by_id ("scprogresstotal" ).text .strip ()
94+ self .assertEqual (2 , int (total ))
95+ possible = self .driver .find_element_by_id ("scprogressposs" ).text .strip ()
96+ self .assertEqual (5 , int (possible ))
97+ # count should not increment after a second click
98+ rb .click ()
99+ total = self .driver .find_element_by_id ("scprogresstotal" ).text .strip ()
100+ self .assertEqual (2 , int (total ))
Original file line number Diff line number Diff line change @@ -109,7 +109,15 @@ class PageProgressBar {
109109 constructor ( actDict ) {
110110 this . possible = 0 ;
111111 this . total = 1 ;
112- this . activities = actDict || { } ;
112+ if ( actDict ) {
113+ this . activities = actDict ;
114+ } else {
115+ let activities = { }
116+ $ ( ".runestone" ) . each ( function ( idx , e ) {
117+ activities [ e . firstElementChild . id ] = 0 ;
118+ } )
119+ this . activities = activities ;
120+ }
113121 this . calculateProgress ( ) ;
114122 this . renderProgress ( )
115123
You can’t perform that action at this time.
0 commit comments