Show More
@@ -16,8 +16,6 casper.notebook_test(function () { | |||
|
16 | 16 | 'print("Success")'); |
|
17 | 17 | this.execute_cell_then(index); |
|
18 | 18 | |
|
19 | this.wait(500); // Wait for require.js async callbacks to load dependencies. | |
|
20 | ||
|
21 | 19 | this.then(function () { |
|
22 | 20 | // Check if the widget manager has been instantiated. |
|
23 | 21 | this.test.assert(this.evaluate(function() { |
@@ -28,7 +26,7 casper.notebook_test(function () { | |||
|
28 | 26 | throttle_index = this.append_cell( |
|
29 | 27 | 'import time\n' + |
|
30 | 28 | 'textbox = widgets.TextWidget()\n' + |
|
31 | 'display(textbox)\n'+ | |
|
29 | 'display(textbox)\n' + | |
|
32 | 30 | 'textbox.add_class("my-throttle-textbox")\n' + |
|
33 | 31 | 'def handle_change(name, old, new):\n' + |
|
34 | 32 | ' print(len(new))\n' + |
@@ -47,12 +45,17 casper.notebook_test(function () { | |||
|
47 | 45 | '.my-throttle-textbox'), 'Textbox exists.'); |
|
48 | 46 | |
|
49 | 47 | // Send 20 characters |
|
50 |
this.sendKeys('.my-throttle-textbox', '................... |
|
|
48 | this.sendKeys('.my-throttle-textbox', '...................A'); | |
|
51 | 49 | }); |
|
52 | 50 | |
|
53 | this.wait(2000); // Wait for clicks to execute in kernel | |
|
54 | ||
|
55 | this.then(function(){ | |
|
51 | this.waitFor(function check() { | |
|
52 | var outputs = this.evaluate(function(i) { | |
|
53 | return IPython.notebook.get_cell(i).output_area.outputs; | |
|
54 | }, {i : throttle_index}); | |
|
55 | var output = outputs[outputs.length-1].text; | |
|
56 | return (output[output.length-1] == 'A'); | |
|
57 | ||
|
58 | }, function then() { | |
|
56 | 59 | var outputs = this.evaluate(function(i) { |
|
57 | 60 | return IPython.notebook.get_cell(i).output_area.outputs; |
|
58 | 61 | }, {i : throttle_index}); |
@@ -34,10 +34,11 casper.notebook_test(function () { | |||
|
34 | 34 | '.widget-area .widget-subarea button', 'click'); |
|
35 | 35 | }); |
|
36 | 36 | |
|
37 | this.wait(500); // Wait for click to execute in kernel and write output | |
|
38 | ||
|
39 |
|
|
|
40 | this.test.assertEquals(this.get_output_cell(button_index, 1).text, 'Clicked\n', | |
|
41 | 'Button click event fires.'); | |
|
37 | this.waitFor(function check() { | |
|
38 | return (this.get_output_cell(button_index, 1).text == 'Clicked\n'); | |
|
39 | }, function then() { | |
|
40 | this.test.assert(true, 'Button click event fires.'); | |
|
41 | }), function timeout() { | |
|
42 | this.test.assert(false, 'Button click event fires.'); | |
|
42 | 43 | }); |
|
43 | 44 | }); No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now