##// END OF EJS Templates
Use wait_for_widget in widgets and string widget tests
Jonathan Frederic -
Show More
@@ -23,6 +23,7 b' casper.notebook_test(function () {'
23 23 }), 'Notebook widget manager instantiated');
24 24 });
25 25
26 var textbox = {};
26 27 throttle_index = this.append_cell(
27 28 'import time\n' +
28 29 'textbox = widgets.TextWidget()\n' +
@@ -32,10 +33,9 b' casper.notebook_test(function () {'
32 33 ' print(len(new))\n' +
33 34 ' time.sleep(0.5)\n' +
34 35 'textbox.on_trait_change(handle_change, "value")\n' +
35 'print("Success")');
36 'print(textbox.model_id)');
36 37 this.execute_cell_then(throttle_index, function(index){
37 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
38 'Test throttling cell executed with correct output');
38 textbox.model_id = this.get_output_cell(index).text.trim();
39 39
40 40 this.test.assert(this.cell_element_exists(index,
41 41 '.widget-area .widget-subarea'),
@@ -48,14 +48,9 b' casper.notebook_test(function () {'
48 48 this.sendKeys('.my-throttle-textbox', '....................');
49 49 });
50 50
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.trim();
56 return (output == '20');
57
58 }, function then() {
51 this.wait_for_widget(textbox);
52
53 this.then(function () {
59 54 var outputs = this.evaluate(function(i) {
60 55 return IPython.notebook.get_cell(i).output_area.outputs;
61 56 }, {i : throttle_index});
@@ -38,13 +38,6 b' casper.notebook_test(function () {'
38 38 '.widget-area .widget-subarea .widget-hbox-single input[type=text]', 'val')=='xyz',
39 39 'Python set textbox value.');
40 40
41 });
42
43 this.wait(500); // Wait for change to execute in kernel
44
45 index = this.append_cell('print(string_widget.value)');
46 this.execute_cell_then(index, function(index){
47
48 41 this.test.assert(this.cell_element_exists(string_index,
49 42 '.widget-area .widget-subarea div span.MathJax_Preview'),
50 43 'MathJax parsed the LaTeX successfully.');
General Comments 0
You need to be logged in to leave comments. Login now