##// END OF EJS Templates
shim utils.localinterfaces
shim utils.localinterfaces

File last commit:

r20397:ae55f08d
r21132:bd94d264
Show More
widget_button.js
48 lines | 1.9 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Organized tests.
r14464 // Test widget button class
casper.notebook_test(function () {
Jonathan Frederic
Make all tests async display safe
r18910 var button_index = this.append_cell(
Jonathan Frederic
Organized tests.
r14464 'from IPython.html import widgets\n' +
'from IPython.display import display, clear_output\n' +
Jonathan Frederic
Renamed *Widget to *,...
r17598 'button = widgets.Button(description="Title")\n' +
MinRK
test coalesced output in js
r17307 'display(button)\n' +
Jonathan Frederic
Organized tests.
r14464 'print("Success")\n' +
'def handle_click(sender):\n' +
MinRK
test coalesced output in js
r17307 ' display("Clicked")\n' +
Jonathan Frederic
Organized tests.
r14464 'button.on_click(handle_click)');
this.execute_cell_then(button_index, function(index){
MinRK
test coalesced output in js
r17307 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
Jonathan Frederic
Organized tests.
r14464 'Create button cell executed with correct output.');
Jonathan Frederic
Make all tests async display safe
r18910 });
// Wait for the widgets to actually display.
var widget_button_selector = '.widget-area .widget-subarea button';
this.wait_for_element(button_index, widget_button_selector);
Jonathan Frederic
Organized tests.
r14464
Jonathan Frederic
Make all tests async display safe
r18910 // Continue with the tests.
this.then(function() {
this.test.assert(this.cell_element_exists(button_index,
Jonathan Frederic
Organized tests.
r14464 '.widget-area .widget-subarea'),
'Widget subarea exists.');
Jonathan Frederic
Make all tests async display safe
r18910 this.test.assert(this.cell_element_exists(button_index,
widget_button_selector),
Jonathan Frederic
Organized tests.
r14464 'Widget button exists.');
Jonathan Frederic
Make all tests async display safe
r18910 this.test.assert(this.cell_element_function(button_index,
Sylvain Corlay
font awesome icon
r20397 widget_button_selector, 'html')=='<i class="fa"></i>Title',
Jonathan Frederic
Organized tests.
r14464 'Set button description.');
Jonathan Frederic
Make all tests async display safe
r18910 this.cell_element_function(button_index,
widget_button_selector, 'click');
Jonathan Frederic
Organized tests.
r14464 });
Jonathan Frederic
Remove sleep from the following,...
r14970 this.wait_for_output(button_index, 1);
this.then(function () {
Min RK
fix widget-import-warning test...
r19532 var warning_text = this.get_output_cell(button_index, 1).text;
this.test.assertNotEquals(warning_text.indexOf('Warning'), -1,
Bussonnier Matthias
fix test
r19293 'Importing widgets show a warning');
this.test.assertEquals(this.get_output_cell(button_index, 2).data['text/plain'], "'Clicked'",
Jonathan Frederic
Remove sleep from the following,...
r14970 'Button click event fires.');
Jonathan Frederic
Organized tests.
r14464 });
Bussonnier Matthias
fix test
r19293 });