Show More
@@ -16,8 +16,6 b' casper.notebook_test(function () {' | |||||
16 | 'print("Success")'); |
|
16 | 'print("Success")'); | |
17 | this.execute_cell_then(index); |
|
17 | this.execute_cell_then(index); | |
18 |
|
18 | |||
19 | this.wait(500); // Wait for require.js async callbacks to load dependencies. |
|
|||
20 |
|
||||
21 | this.then(function () { |
|
19 | this.then(function () { | |
22 | // Check if the widget manager has been instantiated. |
|
20 | // Check if the widget manager has been instantiated. | |
23 | this.test.assert(this.evaluate(function() { |
|
21 | this.test.assert(this.evaluate(function() { | |
@@ -25,19 +23,19 b' casper.notebook_test(function () {' | |||||
25 | }), 'Notebook widget manager instantiated'); |
|
23 | }), 'Notebook widget manager instantiated'); | |
26 | }); |
|
24 | }); | |
27 |
|
25 | |||
|
26 | var textbox = {}; | |||
28 | throttle_index = this.append_cell( |
|
27 | throttle_index = this.append_cell( | |
29 | 'import time\n' + |
|
28 | 'import time\n' + | |
30 | 'textbox = widgets.TextWidget()\n' + |
|
29 | 'textbox = widgets.TextWidget()\n' + | |
31 | 'display(textbox)\n'+ |
|
30 | 'display(textbox)\n' + | |
32 | 'textbox.add_class("my-throttle-textbox")\n' + |
|
31 | 'textbox.add_class("my-throttle-textbox")\n' + | |
33 | 'def handle_change(name, old, new):\n' + |
|
32 | 'def handle_change(name, old, new):\n' + | |
34 | ' print(len(new))\n' + |
|
33 | ' print(len(new))\n' + | |
35 | ' time.sleep(0.5)\n' + |
|
34 | ' time.sleep(0.5)\n' + | |
36 | 'textbox.on_trait_change(handle_change, "value")\n' + |
|
35 | 'textbox.on_trait_change(handle_change, "value")\n' + | |
37 |
'print( |
|
36 | 'print(textbox.model_id)'); | |
38 | this.execute_cell_then(throttle_index, function(index){ |
|
37 | this.execute_cell_then(throttle_index, function(index){ | |
39 | this.test.assertEquals(this.get_output_cell(index).text, 'Success\n', |
|
38 | textbox.model_id = this.get_output_cell(index).text.trim(); | |
40 | 'Test throttling cell executed with correct output'); |
|
|||
41 |
|
39 | |||
42 | this.test.assert(this.cell_element_exists(index, |
|
40 | this.test.assert(this.cell_element_exists(index, | |
43 | '.widget-area .widget-subarea'), |
|
41 | '.widget-area .widget-subarea'), | |
@@ -50,9 +48,9 b' casper.notebook_test(function () {' | |||||
50 | this.sendKeys('.my-throttle-textbox', '....................'); |
|
48 | this.sendKeys('.my-throttle-textbox', '....................'); | |
51 | }); |
|
49 | }); | |
52 |
|
50 | |||
53 | this.wait(2000); // Wait for clicks to execute in kernel |
|
51 | this.wait_for_widget(textbox); | |
54 |
|
52 | |||
55 | this.then(function(){ |
|
53 | this.then(function () { | |
56 | var outputs = this.evaluate(function(i) { |
|
54 | var outputs = this.evaluate(function(i) { | |
57 | return IPython.notebook.get_cell(i).output_area.outputs; |
|
55 | return IPython.notebook.get_cell(i).output_area.outputs; | |
58 | }, {i : throttle_index}); |
|
56 | }, {i : throttle_index}); |
@@ -34,7 +34,7 b' casper.notebook_test(function () {' | |||||
34 | '.widget-area .widget-subarea button', 'click'); |
|
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 |
|
37 | this.wait_for_output(button_index, 1); | |
38 |
|
38 | |||
39 | this.then(function () { |
|
39 | this.then(function () { | |
40 | this.test.assertEquals(this.get_output_cell(button_index, 1).text, 'Clicked\n', |
|
40 | this.test.assertEquals(this.get_output_cell(button_index, 1).text, 'Clicked\n', |
@@ -6,72 +6,64 b' casper.notebook_test(function () {' | |||||
6 | 'print("Success")'); |
|
6 | 'print("Success")'); | |
7 | this.execute_cell_then(index); |
|
7 | this.execute_cell_then(index); | |
8 |
|
8 | |||
9 | var float_text_query_2 = '.widget-area .widget-subarea .widget-hbox-single .my-second-float-text'; |
|
9 | var float_text = {}; | |
10 |
|
10 | float_text.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-float-text'; | ||
11 |
|
|
11 | float_text.index = this.append_cell( | |
12 | 'float_widget = widgets.FloatTextWidget()\n' + |
|
12 | 'float_widget = widgets.FloatTextWidget()\n' + | |
13 | 'display(float_widget)\n' + |
|
13 | 'display(float_widget)\n' + | |
14 | 'float_widget.add_class("my-second-float-text")\n' + |
|
14 | 'float_widget.add_class("my-second-float-text")\n' + | |
15 |
'print( |
|
15 | 'print(float_widget.model_id)\n'); | |
16 | this.execute_cell_then(float_index, function(index){ |
|
16 | this.execute_cell_then(float_text.index, function(index){ | |
17 |
|
17 | float_text.model_id = this.get_output_cell(index).text.trim(); | ||
18 | this.test.assertEquals(this.get_output_cell(index).text, 'Success\n', |
|
18 | ||
19 | 'Create float cell executed with correct output.'); |
|
|||
20 |
|
||||
21 | this.test.assert(this.cell_element_exists(index, |
|
19 | this.test.assert(this.cell_element_exists(index, | |
22 | '.widget-area .widget-subarea'), |
|
20 | '.widget-area .widget-subarea'), | |
23 | 'Widget subarea exists.'); |
|
21 | 'Widget subarea exists.'); | |
24 |
|
22 | |||
25 |
this.test.assert(this.cell_element_exists(index, float_text |
|
23 | this.test.assert(this.cell_element_exists(index, float_text.query), | |
26 | 'Widget float textbox exists.'); |
|
24 | 'Widget float textbox exists.'); | |
27 |
|
25 | |||
28 |
this.cell_element_function(float_index, float_text |
|
26 | this.cell_element_function(float_text.index, float_text.query, 'val', ['']); | |
29 |
this.sendKeys(float_text |
|
27 | this.sendKeys(float_text.query, '1.05'); | |
30 | }); |
|
28 | }); | |
31 |
|
29 | |||
32 | this.wait(500); // Wait for change to execute in kernel |
|
30 | this.wait_for_widget(float_text); | |
33 |
|
31 | |||
34 | index = this.append_cell('print(float_widget.value)\n'); |
|
32 | index = this.append_cell('print(float_widget.value)\n'); | |
35 | this.execute_cell_then(index, function(index){ |
|
33 | this.execute_cell_then(index, function(index){ | |
36 | this.test.assertEquals(this.get_output_cell(index).text, '1.05\n', |
|
34 | this.test.assertEquals(this.get_output_cell(index).text, '1.05\n', | |
37 | 'Float textbox value set.'); |
|
35 | 'Float textbox value set.'); | |
38 |
this.cell_element_function(float_index, float_text |
|
36 | this.cell_element_function(float_text.index, float_text.query, 'val', ['']); | |
39 |
this.sendKeys(float_text |
|
37 | this.sendKeys(float_text.query, '123456789.0'); | |
40 | }); |
|
38 | }); | |
41 |
|
39 | |||
42 | this.wait(500); // Wait for change to execute in kernel |
|
40 | this.wait_for_widget(float_text); | |
43 |
|
41 | |||
44 | index = this.append_cell('print(float_widget.value)\n'); |
|
42 | index = this.append_cell('print(float_widget.value)\n'); | |
45 | this.execute_cell_then(index, function(index){ |
|
43 | this.execute_cell_then(index, function(index){ | |
46 | this.test.assertEquals(this.get_output_cell(index).text, '123456789.0\n', |
|
44 | this.test.assertEquals(this.get_output_cell(index).text, '123456789.0\n', | |
47 | 'Long float textbox value set (probably triggers throttling).'); |
|
45 | 'Long float textbox value set (probably triggers throttling).'); | |
48 |
this.cell_element_function(float_index, float_text |
|
46 | this.cell_element_function(float_text.index, float_text.query, 'val', ['']); | |
49 |
this.sendKeys(float_text |
|
47 | this.sendKeys(float_text.query, '12hello'); | |
50 | }); |
|
48 | }); | |
51 |
|
49 | |||
52 | this.wait(500); // Wait for change to execute in kernel |
|
50 | this.wait_for_widget(float_text); | |
53 |
|
51 | |||
54 | index = this.append_cell('print(float_widget.value)\n'); |
|
52 | index = this.append_cell('print(float_widget.value)\n'); | |
55 | this.execute_cell_then(index, function(index){ |
|
53 | this.execute_cell_then(index, function(index){ | |
56 | this.test.assertEquals(this.get_output_cell(index).text, '12.0\n', |
|
54 | this.test.assertEquals(this.get_output_cell(index).text, '12.0\n', | |
57 | 'Invald float textbox value caught and filtered.'); |
|
55 | 'Invald float textbox value caught and filtered.'); | |
58 | }); |
|
56 | }); | |
59 |
|
||||
60 | index = this.append_cell( |
|
|||
61 | 'from IPython.html import widgets\n' + |
|
|||
62 | 'from IPython.display import display, clear_output\n' + |
|
|||
63 | 'print("Success")'); |
|
|||
64 | this.execute_cell_then(index); |
|
|||
65 |
|
57 | |||
66 | var slider_query = '.widget-area .widget-subarea .widget-hbox-single .slider'; |
|
|||
67 | var float_text_query = '.widget-area .widget-subarea .widget-hbox-single .widget-numeric-text'; |
|
58 | var float_text_query = '.widget-area .widget-subarea .widget-hbox-single .widget-numeric-text'; | |
68 |
|
59 | var slider = {}; | ||
69 | var floatrange_index = this.append_cell( |
|
60 | slider.query = '.widget-area .widget-subarea .widget-hbox-single .slider'; | |
|
61 | slider.index = this.append_cell( | |||
70 | 'floatrange = [widgets.BoundedFloatTextWidget(), \n' + |
|
62 | 'floatrange = [widgets.BoundedFloatTextWidget(), \n' + | |
71 | ' widgets.FloatSliderWidget()]\n' + |
|
63 | ' widgets.FloatSliderWidget()]\n' + | |
72 | '[display(floatrange[i]) for i in range(2)]\n' + |
|
64 | '[display(floatrange[i]) for i in range(2)]\n' + | |
73 | 'print("Success")\n'); |
|
65 | 'print("Success")\n'); | |
74 |
this.execute_cell_then( |
|
66 | this.execute_cell_then(slider.index, function(index){ | |
75 |
|
67 | |||
76 | this.test.assertEquals(this.get_output_cell(index).text, 'Success\n', |
|
68 | this.test.assertEquals(this.get_output_cell(index).text, 'Success\n', | |
77 | 'Create float range cell executed with correct output.'); |
|
69 | 'Create float range cell executed with correct output.'); | |
@@ -80,7 +72,7 b' casper.notebook_test(function () {' | |||||
80 | '.widget-area .widget-subarea'), |
|
72 | '.widget-area .widget-subarea'), | |
81 | 'Widget subarea exists.'); |
|
73 | 'Widget subarea exists.'); | |
82 |
|
74 | |||
83 |
this.test.assert(this.cell_element_exists(index, slider |
|
75 | this.test.assert(this.cell_element_exists(index, slider.query), | |
84 | 'Widget slider exists.'); |
|
76 | 'Widget slider exists.'); | |
85 |
|
77 | |||
86 | this.test.assert(this.cell_element_exists(index, float_text_query), |
|
78 | this.test.assert(this.cell_element_exists(index, float_text_query), | |
@@ -98,10 +90,10 b' casper.notebook_test(function () {' | |||||
98 | this.test.assertEquals(this.get_output_cell(index).text, 'Success\n', |
|
90 | this.test.assertEquals(this.get_output_cell(index).text, 'Success\n', | |
99 | 'Float range properties cell executed with correct output.'); |
|
91 | 'Float range properties cell executed with correct output.'); | |
100 |
|
92 | |||
101 |
this.test.assert(this.cell_element_exists( |
|
93 | this.test.assert(this.cell_element_exists(slider.index, slider.query), | |
102 | 'Widget slider exists.'); |
|
94 | 'Widget slider exists.'); | |
103 |
|
95 | |||
104 |
this.test.assert(this.cell_element_function( |
|
96 | this.test.assert(this.cell_element_function(slider.index, slider.query, | |
105 | 'slider', ['value']) == 25.0, |
|
97 | 'slider', ['value']) == 25.0, | |
106 | 'Slider set to Python value.'); |
|
98 | 'Slider set to Python value.'); | |
107 | }); |
|
99 | }); |
@@ -6,50 +6,48 b' casper.notebook_test(function () {' | |||||
6 | 'print("Success")'); |
|
6 | 'print("Success")'); | |
7 | this.execute_cell_then(index); |
|
7 | this.execute_cell_then(index); | |
8 |
|
8 | |||
9 | var int_text_query_2 = '.widget-area .widget-subarea .widget-hbox-single .my-second-int-text'; |
|
9 | var int_text = {} | |
10 |
|
10 | int_text.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-int-text'; | ||
11 |
|
|
11 | int_text.index = this.append_cell( | |
12 | 'int_widget = widgets.IntTextWidget()\n' + |
|
12 | 'int_widget = widgets.IntTextWidget()\n' + | |
13 | 'display(int_widget)\n' + |
|
13 | 'display(int_widget)\n' + | |
14 | 'int_widget.add_class("my-second-int-text")\n' + |
|
14 | 'int_widget.add_class("my-second-int-text")\n' + | |
15 |
'print( |
|
15 | 'print(int_widget.model_id)\n'); | |
16 | this.execute_cell_then(int_index, function(index){ |
|
16 | this.execute_cell_then(int_text.index, function(index){ | |
17 |
|
17 | int_text.model_id = this.get_output_cell(index).text.trim(); | ||
18 | this.test.assertEquals(this.get_output_cell(index).text, 'Success\n', |
|
18 | ||
19 | 'Create int cell executed with correct output.'); |
|
|||
20 |
|
||||
21 | this.test.assert(this.cell_element_exists(index, |
|
19 | this.test.assert(this.cell_element_exists(index, | |
22 | '.widget-area .widget-subarea'), |
|
20 | '.widget-area .widget-subarea'), | |
23 | 'Widget subarea exists.'); |
|
21 | 'Widget subarea exists.'); | |
24 |
|
22 | |||
25 |
this.test.assert(this.cell_element_exists(index, int_text |
|
23 | this.test.assert(this.cell_element_exists(index, int_text.query), | |
26 | 'Widget int textbox exists.'); |
|
24 | 'Widget int textbox exists.'); | |
27 |
|
25 | |||
28 |
this.cell_element_function(int_index, int_text |
|
26 | this.cell_element_function(int_text.index, int_text.query, 'val', ['']); | |
29 |
this.sendKeys(int_text |
|
27 | this.sendKeys(int_text.query, '1.05'); | |
30 | }); |
|
28 | }); | |
31 |
|
29 | |||
32 | this.wait(500); // Wait for change to execute in kernel |
|
30 | this.wait_for_widget(int_text); | |
33 |
|
31 | |||
34 | index = this.append_cell('print(int_widget.value)\n'); |
|
32 | index = this.append_cell('print(int_widget.value)\n'); | |
35 | this.execute_cell_then(index, function(index){ |
|
33 | this.execute_cell_then(index, function(index){ | |
36 | this.test.assertEquals(this.get_output_cell(index).text, '1\n', |
|
34 | this.test.assertEquals(this.get_output_cell(index).text, '1\n', | |
37 | 'Int textbox value set.'); |
|
35 | 'Int textbox value set.'); | |
38 |
this.cell_element_function(int_index, int_text |
|
36 | this.cell_element_function(int_text.index, int_text.query, 'val', ['']); | |
39 |
this.sendKeys(int_text |
|
37 | this.sendKeys(int_text.query, '123456789'); | |
40 | }); |
|
38 | }); | |
41 |
|
39 | |||
42 | this.wait(500); // Wait for change to execute in kernel |
|
40 | this.wait_for_widget(int_text); | |
43 |
|
41 | |||
44 | index = this.append_cell('print(int_widget.value)\n'); |
|
42 | index = this.append_cell('print(int_widget.value)\n'); | |
45 | this.execute_cell_then(index, function(index){ |
|
43 | this.execute_cell_then(index, function(index){ | |
46 | this.test.assertEquals(this.get_output_cell(index).text, '123456789\n', |
|
44 | this.test.assertEquals(this.get_output_cell(index).text, '123456789\n', | |
47 | 'Long int textbox value set (probably triggers throttling).'); |
|
45 | 'Long int textbox value set (probably triggers throttling).'); | |
48 |
this.cell_element_function(int_index, int_text |
|
46 | this.cell_element_function(int_text.index, int_text.query, 'val', ['']); | |
49 |
this.sendKeys(int_text |
|
47 | this.sendKeys(int_text.query, '12hello'); | |
50 | }); |
|
48 | }); | |
51 |
|
49 | |||
52 | this.wait(500); // Wait for change to execute in kernel |
|
50 | this.wait_for_widget(int_text); | |
53 |
|
51 | |||
54 | index = this.append_cell('print(int_widget.value)\n'); |
|
52 | index = this.append_cell('print(int_widget.value)\n'); | |
55 | this.execute_cell_then(index, function(index){ |
|
53 | this.execute_cell_then(index, function(index){ | |
@@ -63,19 +61,18 b' casper.notebook_test(function () {' | |||||
63 | 'print("Success")'); |
|
61 | 'print("Success")'); | |
64 | this.execute_cell_then(index); |
|
62 | this.execute_cell_then(index); | |
65 |
|
63 | |||
66 | var slider_query = '.widget-area .widget-subarea .widget-hbox-single .slider'; |
|
|||
67 | var int_text_query = '.widget-area .widget-subarea .widget-hbox-single .my-second-num-test-text'; |
|
|||
68 |
|
64 | |||
69 | var intrange_index = this.append_cell( |
|
65 | var slider_query = '.widget-area .widget-subarea .widget-hbox-single .slider'; | |
|
66 | var int_text2 = {}; | |||
|
67 | int_text2.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-num-test-text'; | |||
|
68 | int_text2.index = this.append_cell( | |||
70 | 'intrange = [widgets.BoundedIntTextWidget(),\n' + |
|
69 | 'intrange = [widgets.BoundedIntTextWidget(),\n' + | |
71 | ' widgets.IntSliderWidget()]\n' + |
|
70 | ' widgets.IntSliderWidget()]\n' + | |
72 | '[display(intrange[i]) for i in range(2)]\n' + |
|
71 | '[display(intrange[i]) for i in range(2)]\n' + | |
73 | 'intrange[0].add_class("my-second-num-test-text")\n' + |
|
72 | 'intrange[0].add_class("my-second-num-test-text")\n' + | |
74 |
'print( |
|
73 | 'print(intrange[0].model_id)\n'); | |
75 |
this.execute_cell_then(int |
|
74 | this.execute_cell_then(int_text2.index, function(index){ | |
76 |
|
75 | int_text2.model_id = this.get_output_cell(index).text.trim(); | ||
77 | this.test.assertEquals(this.get_output_cell(index).text, 'Success\n', |
|
|||
78 | 'Create int range cell executed with correct output.'); |
|
|||
79 |
|
76 | |||
80 | this.test.assert(this.cell_element_exists(index, |
|
77 | this.test.assert(this.cell_element_exists(index, | |
81 | '.widget-area .widget-subarea'), |
|
78 | '.widget-area .widget-subarea'), | |
@@ -84,7 +81,7 b' casper.notebook_test(function () {' | |||||
84 | this.test.assert(this.cell_element_exists(index, slider_query), |
|
81 | this.test.assert(this.cell_element_exists(index, slider_query), | |
85 | 'Widget slider exists.'); |
|
82 | 'Widget slider exists.'); | |
86 |
|
83 | |||
87 |
this.test.assert(this.cell_element_exists(index, int_text |
|
84 | this.test.assert(this.cell_element_exists(index, int_text2.query), | |
88 | 'Widget int textbox exists.'); |
|
85 | 'Widget int textbox exists.'); | |
89 | }); |
|
86 | }); | |
90 |
|
87 | |||
@@ -99,23 +96,23 b' casper.notebook_test(function () {' | |||||
99 | this.test.assertEquals(this.get_output_cell(index).text, 'Success\n', |
|
96 | this.test.assertEquals(this.get_output_cell(index).text, 'Success\n', | |
100 | 'Int range properties cell executed with correct output.'); |
|
97 | 'Int range properties cell executed with correct output.'); | |
101 |
|
98 | |||
102 |
this.test.assert(this.cell_element_exists(int |
|
99 | this.test.assert(this.cell_element_exists(int_text2.index, slider_query), | |
103 | 'Widget slider exists.'); |
|
100 | 'Widget slider exists.'); | |
104 |
|
101 | |||
105 |
this.test.assert(this.cell_element_function(int |
|
102 | this.test.assert(this.cell_element_function(int_text2.index, slider_query, | |
106 | 'slider', ['value']) == 25, |
|
103 | 'slider', ['value']) == 25, | |
107 | 'Slider set to Python value.'); |
|
104 | 'Slider set to Python value.'); | |
108 |
|
105 | |||
109 |
this.test.assert(this.cell_element_function(int |
|
106 | this.test.assert(this.cell_element_function(int_text2.index, int_text2.query, | |
110 | 'val') == 25, 'Int textbox set to Python value.'); |
|
107 | 'val') == 25, 'Int textbox set to Python value.'); | |
111 |
|
108 | |||
112 | // Clear the int textbox value and then set it to 1 by emulating |
|
109 | // Clear the int textbox value and then set it to 1 by emulating | |
113 | // keyboard presses. |
|
110 | // keyboard presses. | |
114 |
this.cell_element_function(int |
|
111 | this.cell_element_function(int_text2.index, int_text2.query, 'val', ['']); | |
115 |
this.sendKeys(int_text |
|
112 | this.sendKeys(int_text2.query, '1'); | |
116 | }); |
|
113 | }); | |
117 |
|
114 | |||
118 | this.wait(500); // Wait for change to execute in kernel |
|
115 | this.wait_for_widget(int_text2); | |
119 |
|
116 | |||
120 | index = this.append_cell('print(intrange[0].value)\n'); |
|
117 | index = this.append_cell('print(intrange[0].value)\n'); | |
121 | this.execute_cell_then(index, function(index){ |
|
118 | this.execute_cell_then(index, function(index){ | |
@@ -124,11 +121,11 b' casper.notebook_test(function () {' | |||||
124 |
|
121 | |||
125 | // Clear the int textbox value and then set it to 120 by emulating |
|
122 | // Clear the int textbox value and then set it to 120 by emulating | |
126 | // keyboard presses. |
|
123 | // keyboard presses. | |
127 |
this.cell_element_function(int |
|
124 | this.cell_element_function(int_text2.index, int_text2.query, 'val', ['']); | |
128 |
this.sendKeys(int_text |
|
125 | this.sendKeys(int_text2.query, '120'); | |
129 | }); |
|
126 | }); | |
130 |
|
127 | |||
131 | this.wait(500); // Wait for change to execute in kernel |
|
128 | this.wait_for_widget(int_text2); | |
132 |
|
129 | |||
133 | index = this.append_cell('print(intrange[0].value)\n'); |
|
130 | index = this.append_cell('print(intrange[0].value)\n'); | |
134 | this.execute_cell_then(index, function(index){ |
|
131 | this.execute_cell_then(index, function(index){ | |
@@ -137,11 +134,11 b' casper.notebook_test(function () {' | |||||
137 |
|
134 | |||
138 | // Clear the int textbox value and then set it to 'hello world' by |
|
135 | // Clear the int textbox value and then set it to 'hello world' by | |
139 | // emulating keyboard presses. 'hello world' should get filtered... |
|
136 | // emulating keyboard presses. 'hello world' should get filtered... | |
140 |
this.cell_element_function(int |
|
137 | this.cell_element_function(int_text2.index, int_text2.query, 'val', ['']); | |
141 |
this.sendKeys(int_text |
|
138 | this.sendKeys(int_text2.query, 'hello world'); | |
142 | }); |
|
139 | }); | |
143 |
|
140 | |||
144 | this.wait(500); // Wait for change to execute in kernel |
|
141 | this.wait_for_widget(int_text2); | |
145 |
|
142 | |||
146 | index = this.append_cell('print(intrange[0].value)\n'); |
|
143 | index = this.append_cell('print(intrange[0].value)\n'); | |
147 | this.execute_cell_then(index, function(index){ |
|
144 | this.execute_cell_then(index, function(index){ |
@@ -36,7 +36,7 b' casper.notebook_test(function () {' | |||||
36 | this.click(multicontainer1_query + ' li:nth-child(2) a'); |
|
36 | this.click(multicontainer1_query + ' li:nth-child(2) a'); | |
37 | }); |
|
37 | }); | |
38 |
|
38 | |||
39 | this.wait(500); // Wait for change to execute in kernel |
|
39 | this.wait_for_idle(); | |
40 |
|
40 | |||
41 | index = this.append_cell( |
|
41 | index = this.append_cell( | |
42 | 'print(multicontainer.selected_index)\n' + |
|
42 | 'print(multicontainer.selected_index)\n' + | |
@@ -98,7 +98,7 b' casper.notebook_test(function () {' | |||||
98 | this.click(multicontainer2_query + ' .accordion-group:nth-child(2) .accordion-heading .accordion-toggle'); |
|
98 | this.click(multicontainer2_query + ' .accordion-group:nth-child(2) .accordion-heading .accordion-toggle'); | |
99 | }); |
|
99 | }); | |
100 |
|
100 | |||
101 | this.wait(500); // Wait for change to execute in kernel |
|
101 | this.wait_for_idle(); | |
102 |
|
102 | |||
103 | index = this.append_cell('print(multicontainer.selected_index)'); // 0 based |
|
103 | index = this.append_cell('print(multicontainer.selected_index)'); // 0 based | |
104 | this.execute_cell_then(index, function(index){ |
|
104 | this.execute_cell_then(index, function(index){ |
@@ -93,33 +93,33 b' casper.notebook_test(function () {' | |||||
93 | // Verify that selecting a radio button updates all of the others. |
|
93 | // Verify that selecting a radio button updates all of the others. | |
94 | this.cell_element_function(selection_index, radio_selector + ' .radio:nth-child(2) input', 'click'); |
|
94 | this.cell_element_function(selection_index, radio_selector + ' .radio:nth-child(2) input', 'click'); | |
95 | }); |
|
95 | }); | |
96 |
this.wait( |
|
96 | this.wait_for_idle(); | |
97 | this.then(function () { |
|
97 | this.then(function () { | |
98 | this.test.assert(verify_selection(this, 1), 'Radio button selection updated view states correctly.'); |
|
98 | this.test.assert(verify_selection(this, 1), 'Radio button selection updated view states correctly.'); | |
99 |
|
99 | |||
100 | // Verify that selecting a list option updates all of the others. |
|
100 | // Verify that selecting a list option updates all of the others. | |
101 | this.cell_element_function(selection_index, list_selector + ' option:nth-child(3)', 'click'); |
|
101 | this.cell_element_function(selection_index, list_selector + ' option:nth-child(3)', 'click'); | |
102 | }); |
|
102 | }); | |
103 |
this.wait( |
|
103 | this.wait_for_idle(); | |
104 | this.then(function () { |
|
104 | this.then(function () { | |
105 | this.test.assert(verify_selection(this, 2), 'List selection updated view states correctly.'); |
|
105 | this.test.assert(verify_selection(this, 2), 'List selection updated view states correctly.'); | |
106 |
|
106 | |||
107 | // Verify that selecting a multibutton option updates all of the others. |
|
107 | // Verify that selecting a multibutton option updates all of the others. | |
108 | this.cell_element_function(selection_index, multibtn_selector + ' .btn:nth-child(4)', 'click'); |
|
108 | this.cell_element_function(selection_index, multibtn_selector + ' .btn:nth-child(4)', 'click'); | |
109 | }); |
|
109 | }); | |
110 |
this.wait( |
|
110 | this.wait_for_idle(); | |
111 | this.then(function () { |
|
111 | this.then(function () { | |
112 | this.test.assert(verify_selection(this, 3), 'Multibutton selection updated view states correctly.'); |
|
112 | this.test.assert(verify_selection(this, 3), 'Multibutton selection updated view states correctly.'); | |
113 |
|
113 | |||
114 | // Verify that selecting a combobox option updates all of the others. |
|
114 | // Verify that selecting a combobox option updates all of the others. | |
115 | this.cell_element_function(selection_index, '.widget-area .widget-subarea .widget-hbox-single .btn-group ul.dropdown-menu li:nth-child(3) a', 'click'); |
|
115 | this.cell_element_function(selection_index, '.widget-area .widget-subarea .widget-hbox-single .btn-group ul.dropdown-menu li:nth-child(3) a', 'click'); | |
116 | }); |
|
116 | }); | |
117 |
this.wait( |
|
117 | this.wait_for_idle(); | |
118 | this.then(function () { |
|
118 | this.then(function () { | |
119 | this.test.assert(verify_selection(this, 2), 'Combobox selection updated view states correctly.'); |
|
119 | this.test.assert(verify_selection(this, 2), 'Combobox selection updated view states correctly.'); | |
120 | }); |
|
120 | }); | |
121 |
|
121 | |||
122 | this.wait(500); // Wait for change to execute in kernel |
|
122 | this.wait_for_idle(); | |
123 |
|
123 | |||
124 | index = this.append_cell( |
|
124 | index = this.append_cell( | |
125 | 'for widget in selection:\n' + |
|
125 | 'for widget in selection:\n' + |
@@ -38,13 +38,6 b' casper.notebook_test(function () {' | |||||
38 | '.widget-area .widget-subarea .widget-hbox-single input[type=text]', 'val')=='xyz', |
|
38 | '.widget-area .widget-subarea .widget-hbox-single input[type=text]', 'val')=='xyz', | |
39 | 'Python set textbox value.'); |
|
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 | this.test.assert(this.cell_element_exists(string_index, |
|
41 | this.test.assert(this.cell_element_exists(string_index, | |
49 | '.widget-area .widget-subarea div span.MathJax_Preview'), |
|
42 | '.widget-area .widget-subarea div span.MathJax_Preview'), | |
50 | 'MathJax parsed the LaTeX successfully.'); |
|
43 | 'MathJax parsed the LaTeX successfully.'); |
@@ -94,6 +94,27 b' casper.wait_for_output = function (cell_num, out_num) {' | |||||
94 | }); |
|
94 | }); | |
95 | }; |
|
95 | }; | |
96 |
|
96 | |||
|
97 | // wait for a widget msg que to reach 0 | |||
|
98 | // | |||
|
99 | // Parameters | |||
|
100 | // ---------- | |||
|
101 | // widget_info : object | |||
|
102 | // Object which contains info related to the widget. The model_id property | |||
|
103 | // is used to identify the widget. | |||
|
104 | casper.wait_for_widget = function (widget_info) { | |||
|
105 | this.waitFor(function () { | |||
|
106 | var pending = this.evaluate(function (m) { | |||
|
107 | return IPython.notebook.kernel.widget_manager.get_model(m).pending_msgs; | |||
|
108 | }, {m: widget_info.model_id}); | |||
|
109 | ||||
|
110 | if (pending == 0) { | |||
|
111 | return true; | |||
|
112 | } else { | |||
|
113 | return false; | |||
|
114 | } | |||
|
115 | }); | |||
|
116 | } | |||
|
117 | ||||
97 | // return an output of a given cell |
|
118 | // return an output of a given cell | |
98 | casper.get_output_cell = function (cell_num, out_num) { |
|
119 | casper.get_output_cell = function (cell_num, out_num) { | |
99 | out_num = out_num || 0; |
|
120 | out_num = out_num || 0; |
General Comments 0
You need to be logged in to leave comments.
Login now