##// END OF EJS Templates
Simplify code by using Promises in a better way; try_load -> load
Simplify code by using Promises in a better way; try_load -> load

File last commit:

r17731:4b05db92
r18887:94ab07f6
Show More
widget_box.js
79 lines | 2.9 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Organized tests.
r14464 // Test container 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 container_index = this.append_cell(
Jonathan Frederic
s/Container/Box
r17637 'container = widgets.Box()\n' +
Jonathan Frederic
Renamed *Widget to *,...
r17598 'button = widgets.Button()\n'+
Jonathan Frederic
Fixed JS tests to reflect Jason's changes
r14509 'container.children = [button]\n'+
Jonathan Frederic
Organized tests.
r14464 'display(container)\n'+
Jonathan Frederic
Fix tests
r17721 'container._dom_classes = ["my-test-class"]\n'+
Jonathan Frederic
Organized tests.
r14464 'print("Success")\n');
this.execute_cell_then(container_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 container 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
Address Sylvain's comments.
r17658 '.widget-area .widget-subarea .widget-box'),
Jonathan Frederic
Organized tests.
r14464 'Widget container exists.');
this.test.assert(this.cell_element_exists(index,
'.widget-area .widget-subarea .my-test-class'),
Jonathan Frederic
Fix tests
r17721 '_dom_classes works.');
Jonathan Frederic
Organized tests.
r14464
this.test.assert(this.cell_element_exists(index,
'.widget-area .widget-subarea .my-test-class button'),
'Container parent/child relationship works.');
});
index = this.append_cell(
Jonathan Frederic
Fixed rebase bugs and other bugs.
r17731 'container.box_style = "success"\n'+
Jonathan Frederic
Organized tests.
r14464 'print("Success")\n');
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
Fixed rebase bugs and other bugs.
r17731 'Set box_style cell executed with correct output.');
this.test.assert(this.cell_element_exists(container_index,
'.widget-box.alert-success'),
'Set box_style works.');
Jonathan Frederic
Organized tests.
r14464 });
index = this.append_cell(
Jonathan Frederic
Fix tests
r17721 'container._dom_classes = []\n'+
Jonathan Frederic
Organized tests.
r14464 'print("Success")\n');
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 'Remove container class cell executed with correct output.');
this.test.assert(! this.cell_element_exists(container_index,
'.widget-area .widget-subarea .my-test-class'),
Jonathan Frederic
Fix tests
r17721 '_dom_classes can be used to remove a class.');
Jonathan Frederic
Organized tests.
r14464 });
index = this.append_cell(
'display(button)\n'+
'print("Success")\n');
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 'Display container child executed with correct output.');
this.test.assert(! this.cell_element_exists(index,
Jonathan Frederic
Address Sylvain's comments.
r17658 '.widget-area .widget-subarea .widget-box'),
Jonathan Frederic
Organized tests.
r14464 'Parent container not displayed.');
this.test.assert(this.cell_element_exists(index,
'.widget-area .widget-subarea button'),
'Child displayed.');
});
});