File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -381,6 +381,10 @@ def update_screen(item)
381381 step = item . step . to_s
382382 $document. at_css ( "#tryruby-index" ) . value = step
383383
384+ # Disable the buttons that have no step to go to
385+ $document. at_css ( '#btn_back' ) . disabled = !@items . has_key? ( item . step - 1 )
386+ $document. at_css ( '#btn_next' ) . disabled = !@items . has_key? ( item . step + 1 )
387+
384388 # Set session cookie to store progress
385389 set_cookie ( 'tryruby_step' , step )
386390
Original file line number Diff line number Diff line change @@ -125,9 +125,13 @@ h3 {
125125.btn-primary {
126126 border-radius : 1rem ;
127127 font-family : sans-serif ;
128- color : var (--button-primary-text-color );
129- background-color : var (--button-primary-color );
130- border-color : var (--button-primary-color );
128+
129+ & ,
130+ & :disabled {
131+ color : var (--button-primary-text-color );
132+ background-color : var (--button-primary-color );
133+ border-color : var (--button-primary-color );
134+ }
131135
132136 & :focus ,
133137 & :focus:not (:focus-visible ),
Original file line number Diff line number Diff line change 5050 special = steps [ step ] || { }
5151
5252 find ( :css , "h1" ) . text . should be == data [ "title" ]
53+ page . should have_button ( "Back" , disabled : step == 1 )
54+ page . should have_button ( "Next" , disabled : step == 56 )
5355
5456 unless special [ :pass ]
5557 case special [ :code ]
You can’t perform that action at this time.
0 commit comments