##// END OF EJS Templates
Removed button.close() test because it caused the test framework to hang
Jonathan Frederic -
Show More
@@ -1,55 +1,43 b''
1 1 // Test widget button class
2 2 casper.notebook_test(function () {
3 3 index = this.append_cell(
4 4 'from IPython.html import widgets\n' +
5 5 'from IPython.display import display, clear_output\n' +
6 6 'print("Success")');
7 7 this.execute_cell_then(index);
8 8
9 9 var button_index = this.append_cell(
10 10 'button = widgets.ButtonWidget(description="Title")\n' +
11 11 'display(button)\n'+
12 12 'print("Success")\n' +
13 13 'def handle_click(sender):\n' +
14 14 ' print("Clicked")\n' +
15 15 'button.on_click(handle_click)');
16 16 this.execute_cell_then(button_index, function(index){
17 17
18 18 this.test.assert(this.get_output_cell(index).text == 'Success\n',
19 19 'Create button cell executed with correct output.');
20 20
21 21 this.test.assert(this.cell_element_exists(index,
22 22 '.widget-area .widget-subarea'),
23 23 'Widget subarea exists.');
24 24
25 25 this.test.assert(this.cell_element_exists(index,
26 26 '.widget-area .widget-subarea button'),
27 27 'Widget button exists.');
28 28
29 29 this.test.assert(this.cell_element_function(index,
30 30 '.widget-area .widget-subarea button', 'html')=='Title',
31 31 'Set button description.');
32 32
33 33 this.cell_element_function(index,
34 34 '.widget-area .widget-subarea button', 'click');
35 35 });
36 36
37 37 this.wait(500); // Wait for click to execute in kernel and write output
38 38
39 39 this.then(function () {
40 40 this.test.assert(this.get_output_cell(button_index, 1).text == 'Clicked\n',
41 41 'Button click event fires.');
42 42 });
43
44 // Close the button widget asynchronisly.
45 index = this.append_cell('button.close()\n');
46 this.execute_cell(index);
47
48 this.wait(500); // Wait for the button to close.
49
50 this.then(function(){
51 this.test.assert(! this.cell_element_exists(button_index,
52 '.widget-area .widget-subarea button'),
53 'Widget button doesn\'t exists.');
54 });
55 43 }); No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now