|
|
|
|
@ -7,15 +7,10 @@ casper.notebook_test(function () {
|
|
|
|
|
this.execute_cell_then(index);
|
|
|
|
|
|
|
|
|
|
var bool_index = this.append_cell(
|
|
|
|
|
'bool_widgets = [widgets.BoolWidget(description="Title", value=True) for i in range(2)]\n' +
|
|
|
|
|
'bool_widgets = [widgets.CheckBoxWidget(description="Title", value=True),\n' +
|
|
|
|
|
' widgets.ToggleButtonWidget(description="Title", value=True)]\n' +
|
|
|
|
|
'display(bool_widgets[0])\n' +
|
|
|
|
|
'bool_widgets[1].view_name = "ToggleButtonView"\n' +
|
|
|
|
|
'display(bool_widgets[1])\n' +
|
|
|
|
|
'for widget in bool_widgets:\n' +
|
|
|
|
|
' def handle_change(name,old,new):\n' +
|
|
|
|
|
' for other_widget in bool_widgets:\n' +
|
|
|
|
|
' other_widget.value = new\n' +
|
|
|
|
|
' widget.on_trait_change(handle_change, "value")\n' +
|
|
|
|
|
'print("Success")');
|
|
|
|
|
this.execute_cell_then(bool_index, function(index){
|
|
|
|
|
|
|
|
|
|
@ -58,6 +53,7 @@ casper.notebook_test(function () {
|
|
|
|
|
|
|
|
|
|
index = this.append_cell(
|
|
|
|
|
'bool_widgets[0].value = False\n' +
|
|
|
|
|
'bool_widgets[1].value = False\n' +
|
|
|
|
|
'print("Success")');
|
|
|
|
|
this.execute_cell_then(index, function(index){
|
|
|
|
|
|
|
|
|
|
@ -71,28 +67,20 @@ casper.notebook_test(function () {
|
|
|
|
|
this.test.assert(! this.cell_element_function(bool_index,
|
|
|
|
|
'.widget-area .widget-subarea button', 'hasClass', ['active']),
|
|
|
|
|
'Toggle button is not toggled. (1)');
|
|
|
|
|
|
|
|
|
|
// 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,
|
|
|
|
|
'.widget-area .widget-subarea .widget-hbox-single input', 'prop', ['checked']),
|
|
|
|
|
'Checkbox is checked. (2)');
|
|
|
|
|
|
|
|
|
|
this.test.assert(this.cell_element_function(bool_index,
|
|
|
|
|
'.widget-area .widget-subarea button', 'hasClass', ['active']),
|
|
|
|
|
'Toggle button is toggled. (2)');
|
|
|
|
|
|
|
|
|
|
// Try toggling the bool by clicking on the checkbox.
|
|
|
|
|
this.cell_element_function(bool_index, '.widget-area .widget-subarea .widget-hbox-single input', 'click');
|
|
|
|
|
|
|
|
|
|
this.test.assert(! this.cell_element_function(bool_index,
|
|
|
|
|
this.test.assert(this.cell_element_function(bool_index,
|
|
|
|
|
'.widget-area .widget-subarea .widget-hbox-single input', 'prop', ['checked']),
|
|
|
|
|
'Checkbox is not checked. (3)');
|
|
|
|
|
'Checkbox is checked. (2)');
|
|
|
|
|
|
|
|
|
|
this.test.assert(! this.cell_element_function(bool_index,
|
|
|
|
|
// 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,
|
|
|
|
|
'.widget-area .widget-subarea button', 'hasClass', ['active']),
|
|
|
|
|
'Toggle button is not toggled. (3)');
|
|
|
|
|
'Toggle button is toggled. (3)');
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|