##// END OF EJS Templates
Fix various review comments
Fix various review comments

File last commit:

r17929:22e0a586
r18790:4ecc06fb
Show More
widget_bool.js
85 lines | 3.5 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Organized tests.
r14464 // Test widget bool class
casper.notebook_test(function () {
index = this.append_cell(
'from IPython.html import widgets\n' +
'from IPython.display import display, clear_output\n' +
'print("Success")');
this.execute_cell_then(index);
var bool_index = this.append_cell(
Jonathan Frederic
Renamed *Widget to *,...
r17598 'bool_widgets = [widgets.Checkbox(description="Title", value=True),\n' +
' widgets.ToggleButton(description="Title", value=True)]\n' +
Jonathan Frederic
Many checks off the todo list, test fixes
r14583 'display(bool_widgets[0])\n' +
'display(bool_widgets[1])\n' +
Jonathan Frederic
Organized tests.
r14464 'print("Success")');
this.execute_cell_then(bool_index, function(index){
MinRK
first review pass on widget tests
r14797 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
Jonathan Frederic
Organized tests.
r14464 'Create bool widget cell executed with correct output.');
this.test.assert(this.cell_element_exists(index,
'.widget-area .widget-subarea'),
'Widget subarea exists.');
this.test.assert(this.cell_element_exists(index,
Jonathan Frederic
Cleaned up hbox and vbox widget div styles,...
r17929 '.widget-area .widget-subarea .widget-hbox input'),
Jonathan Frederic
Organized tests.
r14464 'Checkbox exists.');
this.test.assert(this.cell_element_function(index,
Jonathan Frederic
Cleaned up hbox and vbox widget div styles,...
r17929 '.widget-area .widget-subarea .widget-hbox input', 'prop', ['checked']),
Jonathan Frederic
Organized tests.
r14464 'Checkbox is checked.');
this.test.assert(this.cell_element_exists(index,
Jonathan Frederic
Cleaned up hbox and vbox widget div styles,...
r17929 '.widget-area .widget-subarea .widget-hbox .widget-label'),
Jonathan Frederic
Organized tests.
r14464 'Checkbox label exists.');
this.test.assert(this.cell_element_function(index,
Jonathan Frederic
Cleaned up hbox and vbox widget div styles,...
r17929 '.widget-area .widget-subarea .widget-hbox .widget-label', 'html')=="Title",
Jonathan Frederic
Organized tests.
r14464 'Checkbox labeled correctly.');
this.test.assert(this.cell_element_exists(index,
Jonathan Frederic
Many checks off the todo list, test fixes
r14583 '.widget-area .widget-subarea button'),
Jonathan Frederic
Organized tests.
r14464 'Toggle button exists.');
this.test.assert(this.cell_element_function(index,
Jonathan Frederic
Many checks off the todo list, test fixes
r14583 '.widget-area .widget-subarea button', 'html')=="Title",
Jonathan Frederic
Organized tests.
r14464 'Toggle button labeled correctly.');
this.test.assert(this.cell_element_function(index,
Jonathan Frederic
Many checks off the todo list, test fixes
r14583 '.widget-area .widget-subarea button', 'hasClass', ['active']),
Jonathan Frederic
Organized tests.
r14464 'Toggle button is toggled.');
});
index = this.append_cell(
Jonathan Frederic
Many checks off the todo list, test fixes
r14583 'bool_widgets[0].value = False\n' +
Jonathan Frederic
More fixes
r14595 'bool_widgets[1].value = False\n' +
Jonathan Frederic
Organized tests.
r14464 'print("Success")');
this.execute_cell_then(index, function(index){
MinRK
first review pass on widget tests
r14797 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
Jonathan Frederic
Organized tests.
r14464 'Change bool widget value cell executed with correct output.');
this.test.assert(! this.cell_element_function(bool_index,
Jonathan Frederic
Cleaned up hbox and vbox widget div styles,...
r17929 '.widget-area .widget-subarea .widget-hbox input', 'prop', ['checked']),
Jonathan Frederic
Organized tests.
r14464 'Checkbox is not checked. (1)');
this.test.assert(! this.cell_element_function(bool_index,
Jonathan Frederic
Many checks off the todo list, test fixes
r14583 '.widget-area .widget-subarea button', 'hasClass', ['active']),
Jonathan Frederic
Organized tests.
r14464 'Toggle button is not toggled. (1)');
// Try toggling the bool by clicking on the checkbox.
Jonathan Frederic
Cleaned up hbox and vbox widget div styles,...
r17929 this.cell_element_function(bool_index, '.widget-area .widget-subarea .widget-hbox input', 'click');
Jonathan Frederic
Organized tests.
r14464
Jonathan Frederic
More fixes
r14595 this.test.assert(this.cell_element_function(bool_index,
Jonathan Frederic
Cleaned up hbox and vbox widget div styles,...
r17929 '.widget-area .widget-subarea .widget-hbox input', 'prop', ['checked']),
Jonathan Frederic
More fixes
r14595 'Checkbox is checked. (2)');
Jonathan Frederic
Organized tests.
r14464
Jonathan Frederic
More fixes
r14595 // Try toggling the bool by clicking on the toggle button.
this.cell_element_function(bool_index, '.widget-area .widget-subarea button', 'click');
this.test.assert(this.cell_element_function(bool_index,
Jonathan Frederic
Many checks off the todo list, test fixes
r14583 '.widget-area .widget-subarea button', 'hasClass', ['active']),
Jonathan Frederic
More fixes
r14595 'Toggle button is toggled. (3)');
Jonathan Frederic
Organized tests.
r14464
});
});