##// END OF EJS Templates
Added bool widget value toggle tests
Jonathan Frederic -
Show More
@@ -100,7 +100,7 b' casper.notebook_test(function () {'
100 100 'Checkbox exists.');
101 101
102 102 this.test.assert(this.cell_element_function(index,
103 '.widget-area .widget-subarea .widget-hbox-single input', 'val')==true,
103 '.widget-area .widget-subarea .widget-hbox-single input', 'prop', ['checked']),
104 104 'Checkbox is checked.');
105 105
106 106 this.test.assert(this.cell_element_exists(index,
@@ -125,6 +125,47 b' casper.notebook_test(function () {'
125 125
126 126 });
127 127
128 index = this.append_cell(
129 'bool_widget.value = False\n' +
130 'print("Success")');
131 this.execute_cell_then(index, function(index){
132
133 var button_output = this.get_output_cell(index).text;
134 this.test.assert(button_output == 'Success\n',
135 'Change bool widget value cell executed with correct output.');
136
137 this.test.assert(!this.cell_element_function(bool_index,
138 '.widget-area .widget-subarea .widget-hbox-single input', 'prop', ['checked']),
139 'Checkbox is not checked. (1)');
140
141 this.test.assert(!this.cell_element_function(bool_index,
142 '.widget-area .widget-subarea div button', 'hasClass', ['active']),
143 'Toggle button is not toggled. (1)');
144
145 // Try toggling the bool by clicking on the toggle button.
146 this.cell_element_function(bool_index, '.widget-area .widget-subarea div button', 'click');
147
148 this.test.assert(this.cell_element_function(bool_index,
149 '.widget-area .widget-subarea .widget-hbox-single input', 'prop', ['checked']),
150 'Checkbox is checked. (2)');
151
152 this.test.assert(this.cell_element_function(bool_index,
153 '.widget-area .widget-subarea div button', 'hasClass', ['active']),
154 'Toggle button is toggled. (2)');
155
156 // Try toggling the bool by clicking on the checkbox.
157 this.cell_element_function(bool_index, '.widget-area .widget-subarea .widget-hbox-single input', 'click');
158
159 this.test.assert(!this.cell_element_function(bool_index,
160 '.widget-area .widget-subarea .widget-hbox-single input', 'prop', ['checked']),
161 'Checkbox is not checked. (3)');
162
163 this.test.assert(!this.cell_element_function(bool_index,
164 '.widget-area .widget-subarea div button', 'hasClass', ['active']),
165 'Toggle button is not toggled. (3)');
166
167 });
168
128 169 // Test button widget //////////////////////////////////////////////////////
129 170 var button_index = this.append_cell(
130 171 'button = widgets.ButtonWidget(description="Title")\n' +
General Comments 0
You need to be logged in to leave comments. Login now