Show More
@@ -87,8 +87,7 b' casper.notebook_test(function () {' | |||||
87 | 'print("Success")'); |
|
87 | 'print("Success")'); | |
88 | this.execute_cell_then(bool_index, function(index){ |
|
88 | this.execute_cell_then(bool_index, function(index){ | |
89 |
|
89 | |||
90 |
|
|
90 | this.test.assert(this.get_output_cell(index).text == 'Success\n', | |
91 | this.test.assert(button_output == 'Success\n', |
|
|||
92 | 'Create bool widget cell executed with correct output.'); |
|
91 | 'Create bool widget cell executed with correct output.'); | |
93 |
|
92 | |||
94 | this.test.assert(this.cell_element_exists(index, |
|
93 | this.test.assert(this.cell_element_exists(index, | |
@@ -130,15 +129,14 b' casper.notebook_test(function () {' | |||||
130 | 'print("Success")'); |
|
129 | 'print("Success")'); | |
131 | this.execute_cell_then(index, function(index){ |
|
130 | this.execute_cell_then(index, function(index){ | |
132 |
|
131 | |||
133 |
|
|
132 | this.test.assert(this.get_output_cell(index).text == 'Success\n', | |
134 | this.test.assert(button_output == 'Success\n', |
|
|||
135 | 'Change bool widget value cell executed with correct output.'); |
|
133 | 'Change bool widget value cell executed with correct output.'); | |
136 |
|
134 | |||
137 | this.test.assert(!this.cell_element_function(bool_index, |
|
135 | this.test.assert(! this.cell_element_function(bool_index, | |
138 | '.widget-area .widget-subarea .widget-hbox-single input', 'prop', ['checked']), |
|
136 | '.widget-area .widget-subarea .widget-hbox-single input', 'prop', ['checked']), | |
139 | 'Checkbox is not checked. (1)'); |
|
137 | 'Checkbox is not checked. (1)'); | |
140 |
|
138 | |||
141 | this.test.assert(!this.cell_element_function(bool_index, |
|
139 | this.test.assert(! this.cell_element_function(bool_index, | |
142 | '.widget-area .widget-subarea div button', 'hasClass', ['active']), |
|
140 | '.widget-area .widget-subarea div button', 'hasClass', ['active']), | |
143 | 'Toggle button is not toggled. (1)'); |
|
141 | 'Toggle button is not toggled. (1)'); | |
144 |
|
142 | |||
@@ -156,11 +154,11 b' casper.notebook_test(function () {' | |||||
156 | // Try toggling the bool by clicking on the checkbox. |
|
154 | // 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'); |
|
155 | this.cell_element_function(bool_index, '.widget-area .widget-subarea .widget-hbox-single input', 'click'); | |
158 |
|
156 | |||
159 | this.test.assert(!this.cell_element_function(bool_index, |
|
157 | this.test.assert(! this.cell_element_function(bool_index, | |
160 | '.widget-area .widget-subarea .widget-hbox-single input', 'prop', ['checked']), |
|
158 | '.widget-area .widget-subarea .widget-hbox-single input', 'prop', ['checked']), | |
161 | 'Checkbox is not checked. (3)'); |
|
159 | 'Checkbox is not checked. (3)'); | |
162 |
|
160 | |||
163 | this.test.assert(!this.cell_element_function(bool_index, |
|
161 | this.test.assert(! this.cell_element_function(bool_index, | |
164 | '.widget-area .widget-subarea div button', 'hasClass', ['active']), |
|
162 | '.widget-area .widget-subarea div button', 'hasClass', ['active']), | |
165 | 'Toggle button is not toggled. (3)'); |
|
163 | 'Toggle button is not toggled. (3)'); | |
166 |
|
164 | |||
@@ -176,8 +174,7 b' casper.notebook_test(function () {' | |||||
176 | 'button.on_click(handle_click)'); |
|
174 | 'button.on_click(handle_click)'); | |
177 | this.execute_cell_then(button_index, function(index){ |
|
175 | this.execute_cell_then(button_index, function(index){ | |
178 |
|
176 | |||
179 |
|
|
177 | this.test.assert(this.get_output_cell(index).text == 'Success\n', | |
180 | this.test.assert(button_output == 'Success\n', |
|
|||
181 | 'Create button cell executed with correct output.'); |
|
178 | 'Create button cell executed with correct output.'); | |
182 |
|
179 | |||
183 | this.test.assert(this.cell_element_exists(index, |
|
180 | this.test.assert(this.cell_element_exists(index, | |
@@ -205,16 +202,87 b' casper.notebook_test(function () {' | |||||
205 |
|
202 | |||
206 | index = this.append_cell( |
|
203 | index = this.append_cell( | |
207 | 'button.close()\n'+ |
|
204 | 'button.close()\n'+ | |
208 |
'print("Success") |
|
205 | 'print("Success")'); | |
209 | this.execute_cell_then(index, function(index){ |
|
206 | this.execute_cell_then(index, function(index){ | |
210 |
|
207 | |||
211 |
|
|
208 | this.test.assert(this.get_output_cell(index).text == 'Success\n', | |
212 | this.test.assert(button_output == 'Success\n', |
|
|||
213 | 'Close button cell executed with correct output.'); |
|
209 | 'Close button cell executed with correct output.'); | |
214 |
|
210 | |||
215 | this.test.assert(! this.cell_element_exists(button_index, |
|
211 | this.test.assert(! this.cell_element_exists(button_index, | |
216 | '.widget-area .widget-subarea button'), |
|
212 | '.widget-area .widget-subarea button'), | |
217 | 'Widget button doesn\'t exists.'); |
|
213 | 'Widget button doesn\'t exists.'); | |
218 | }); |
|
214 | }); | |
|
215 | ||||
|
216 | // Test container widget /////////////////////////////////////////////////// | |||
|
217 | var container_index = this.append_cell( | |||
|
218 | 'container = widgets.ContainerWidget()\n' + | |||
|
219 | 'button = widgets.ButtonWidget(parent=container)\n'+ | |||
|
220 | 'display(container)\n'+ | |||
|
221 | 'container.add_class("my-test-class")\n'+ | |||
|
222 | 'print("Success")\n'); | |||
|
223 | this.execute_cell_then(container_index, function(index){ | |||
|
224 | ||||
|
225 | this.test.assert(this.get_output_cell(index).text == 'Success\n', | |||
|
226 | 'Create container cell executed with correct output.'); | |||
|
227 | ||||
|
228 | this.test.assert(this.cell_element_exists(index, | |||
|
229 | '.widget-area .widget-subarea'), | |||
|
230 | 'Widget subarea exists.'); | |||
|
231 | ||||
|
232 | this.test.assert(this.cell_element_exists(index, | |||
|
233 | '.widget-area .widget-subarea .widget-container'), | |||
|
234 | 'Widget container exists.'); | |||
|
235 | ||||
|
236 | this.test.assert(this.cell_element_exists(index, | |||
|
237 | '.widget-area .widget-subarea .my-test-class'), | |||
|
238 | 'add_class works.'); | |||
|
239 | ||||
|
240 | this.test.assert(this.cell_element_exists(index, | |||
|
241 | '.widget-area .widget-subarea .my-test-class button'), | |||
|
242 | 'Container parent/child relationship works.'); | |||
|
243 | }); | |||
|
244 | ||||
|
245 | index = this.append_cell( | |||
|
246 | 'container.set_css("display", "none")\n'+ | |||
|
247 | 'print("Success")\n'); | |||
|
248 | this.execute_cell_then(index, function(index){ | |||
|
249 | ||||
|
250 | this.test.assert(this.get_output_cell(index).text == 'Success\n', | |||
|
251 | 'Set container class CSS cell executed with correct output.'); | |||
|
252 | ||||
|
253 | this.test.assert(this.cell_element_function(container_index, | |||
|
254 | '.widget-area .widget-subarea .my-test-class', 'css', ['display'])=='none', | |||
|
255 | 'set_css works.'); | |||
|
256 | }); | |||
|
257 | ||||
|
258 | index = this.append_cell( | |||
|
259 | 'container.remove_class("my-test-class")\n'+ | |||
|
260 | 'print("Success")\n'); | |||
|
261 | this.execute_cell_then(index, function(index){ | |||
|
262 | ||||
|
263 | this.test.assert(this.get_output_cell(index).text == 'Success\n', | |||
|
264 | 'Remove container class cell executed with correct output.'); | |||
|
265 | ||||
|
266 | this.test.assert(! this.cell_element_exists(container_index, | |||
|
267 | '.widget-area .widget-subarea .my-test-class'), | |||
|
268 | 'remove_class works.'); | |||
|
269 | }); | |||
|
270 | ||||
|
271 | index = this.append_cell( | |||
|
272 | 'display(button)\n'+ | |||
|
273 | 'print("Success")\n'); | |||
|
274 | this.execute_cell_then(index, function(index){ | |||
|
275 | ||||
|
276 | this.test.assert(this.get_output_cell(index).text == 'Success\n', | |||
|
277 | 'Display container child executed with correct output.'); | |||
|
278 | ||||
|
279 | this.test.assert(! this.cell_element_exists(index, | |||
|
280 | '.widget-area .widget-subarea .widget-container'), | |||
|
281 | 'Parent container not displayed.'); | |||
|
282 | ||||
|
283 | // this.test.assert(this.cell_element_exists(index, | |||
|
284 | // '.widget-area .widget-subarea button'), | |||
|
285 | // 'Child displayed.'); | |||
|
286 | }); | |||
219 | }); |
|
287 | }); | |
220 |
|
288 |
General Comments 0
You need to be logged in to leave comments.
Login now