##// END OF EJS Templates
first review pass on widget tests
MinRK -
Show More
@@ -6,7 +6,7 b' casper.notebook_test(function () {'
6
6
7 // Check if the WidgetManager class is defined.
7 // Check if the WidgetManager class is defined.
8 this.test.assert(this.evaluate(function() {
8 this.test.assert(this.evaluate(function() {
9 return IPython.WidgetManager != undefined;
9 return IPython.WidgetManager !== undefined;
10 }), 'WidgetManager class is defined');
10 }), 'WidgetManager class is defined');
11 });
11 });
12
12
@@ -19,10 +19,10 b' casper.notebook_test(function () {'
19 this.wait(500); // Wait for require.js async callbacks to load dependencies.
19 this.wait(500); // Wait for require.js async callbacks to load dependencies.
20
20
21 this.then(function () {
21 this.then(function () {
22 // Check if the widget manager has been instanciated.
22 // Check if the widget manager has been instantiated.
23 this.test.assert(this.evaluate(function() {
23 this.test.assert(this.evaluate(function() {
24 return IPython.notebook.kernel.widget_manager != undefined;
24 return IPython.notebook.kernel.widget_manager !== undefined;
25 }), 'Notebook widget manager instanciated');
25 }), 'Notebook widget manager instantiated');
26 });
26 });
27
27
28 throttle_index = this.append_cell(
28 throttle_index = this.append_cell(
@@ -33,10 +33,10 b' casper.notebook_test(function () {'
33 'def handle_change(name, old, new):\n' +
33 'def handle_change(name, old, new):\n' +
34 ' print(len(new))\n' +
34 ' print(len(new))\n' +
35 ' time.sleep(0.5)\n' +
35 ' time.sleep(0.5)\n' +
36 'textbox.on_trait_change(handle_change)\n' +
36 'textbox.on_trait_change(handle_change, "value")\n' +
37 'print("Success")');
37 'print("Success")');
38 this.execute_cell_then(throttle_index, function(index){
38 this.execute_cell_then(throttle_index, function(index){
39 this.test.assert(this.get_output_cell(index).text == 'Success\n',
39 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
40 'Test throttling cell executed with correct output');
40 'Test throttling cell executed with correct output');
41
41
42 this.test.assert(this.cell_element_exists(index,
42 this.test.assert(this.cell_element_exists(index,
@@ -53,24 +53,17 b' casper.notebook_test(function () {'
53 this.wait(2000); // Wait for clicks to execute in kernel
53 this.wait(2000); // Wait for clicks to execute in kernel
54
54
55 this.then(function(){
55 this.then(function(){
56 var resume = true;
56 var outputs = this.evaluate(function(i) {
57 var i = 0;
57 return IPython.notebook.get_cell(i).output_area.outputs;
58 while (resume) {
58 }, {i : throttle_index});
59 i++;
60 var output = this.get_output_cell(throttle_index, i);
61 if (output === undefined || output === null) {
62 resume = false;
63 i--;
64 }
65 }
66
59
67 // Only 4 outputs should have printed, but because of timing, sometimes
60 // Only 4 outputs should have printed, but because of timing, sometimes
68 // 5 outputs will print. All we need to do is verify num outputs <= 5
61 // 5 outputs will print. All we need to do is verify num outputs <= 5
69 // because that is much less than 20.
62 // because that is much less than 20.
70 this.test.assert(i <= 5, 'Messages throttled.');
63 this.test.assert(outputs.length <= 5, 'Messages throttled.');
71
64
72 // We also need to verify that the last state sent was correct.
65 // We also need to verify that the last state sent was correct.
73 var last_state = this.get_output_cell(throttle_index, i).text;
66 var last_state = outputs[outputs.length-1].text;
74 this.test.assert(last_state == "20\n", "Last state sent when throttling.");
67 this.test.assertEquals(last_state, "20\n", "Last state sent when throttling.");
75 });
68 });
76 });
69 });
@@ -14,7 +14,7 b' casper.notebook_test(function () {'
14 'print("Success")');
14 'print("Success")');
15 this.execute_cell_then(bool_index, function(index){
15 this.execute_cell_then(bool_index, function(index){
16
16
17 this.test.assert(this.get_output_cell(index).text == 'Success\n',
17 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
18 'Create bool widget cell executed with correct output.');
18 'Create bool widget cell executed with correct output.');
19
19
20 this.test.assert(this.cell_element_exists(index,
20 this.test.assert(this.cell_element_exists(index,
@@ -57,7 +57,7 b' casper.notebook_test(function () {'
57 'print("Success")');
57 'print("Success")');
58 this.execute_cell_then(index, function(index){
58 this.execute_cell_then(index, function(index){
59
59
60 this.test.assert(this.get_output_cell(index).text == 'Success\n',
60 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
61 'Change bool widget value cell executed with correct output.');
61 'Change bool widget value cell executed with correct output.');
62
62
63 this.test.assert(! this.cell_element_function(bool_index,
63 this.test.assert(! this.cell_element_function(bool_index,
@@ -15,7 +15,7 b' casper.notebook_test(function () {'
15 'button.on_click(handle_click)');
15 'button.on_click(handle_click)');
16 this.execute_cell_then(button_index, function(index){
16 this.execute_cell_then(button_index, function(index){
17
17
18 this.test.assert(this.get_output_cell(index).text == 'Success\n',
18 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
19 'Create button cell executed with correct output.');
19 'Create button cell executed with correct output.');
20
20
21 this.test.assert(this.cell_element_exists(index,
21 this.test.assert(this.cell_element_exists(index,
@@ -37,7 +37,7 b' casper.notebook_test(function () {'
37 this.wait(500); // Wait for click to execute in kernel and write output
37 this.wait(500); // Wait for click to execute in kernel and write output
38
38
39 this.then(function () {
39 this.then(function () {
40 this.test.assert(this.get_output_cell(button_index, 1).text == 'Clicked\n',
40 this.test.assertEquals(this.get_output_cell(button_index, 1).text, 'Clicked\n',
41 'Button click event fires.');
41 'Button click event fires.');
42 });
42 });
43 }); No newline at end of file
43 });
@@ -15,7 +15,7 b' casper.notebook_test(function () {'
15 'print("Success")\n');
15 'print("Success")\n');
16 this.execute_cell_then(container_index, function(index){
16 this.execute_cell_then(container_index, function(index){
17
17
18 this.test.assert(this.get_output_cell(index).text == 'Success\n',
18 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
19 'Create container cell executed with correct output.');
19 'Create container cell executed with correct output.');
20
20
21 this.test.assert(this.cell_element_exists(index,
21 this.test.assert(this.cell_element_exists(index,
@@ -40,7 +40,7 b' casper.notebook_test(function () {'
40 'print("Success")\n');
40 'print("Success")\n');
41 this.execute_cell_then(index, function(index){
41 this.execute_cell_then(index, function(index){
42
42
43 this.test.assert(this.get_output_cell(index).text == 'Success\n',
43 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
44 'Set container class CSS cell executed with correct output.');
44 'Set container class CSS cell executed with correct output.');
45
45
46 this.test.assert(this.cell_element_function(container_index,
46 this.test.assert(this.cell_element_function(container_index,
@@ -53,7 +53,7 b' casper.notebook_test(function () {'
53 'print("Success")\n');
53 'print("Success")\n');
54 this.execute_cell_then(index, function(index){
54 this.execute_cell_then(index, function(index){
55
55
56 this.test.assert(this.get_output_cell(index).text == 'Success\n',
56 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
57 'Remove container class cell executed with correct output.');
57 'Remove container class cell executed with correct output.');
58
58
59 this.test.assert(! this.cell_element_exists(container_index,
59 this.test.assert(! this.cell_element_exists(container_index,
@@ -66,7 +66,7 b' casper.notebook_test(function () {'
66 'print("Success")\n');
66 'print("Success")\n');
67 this.execute_cell_then(index, function(index){
67 this.execute_cell_then(index, function(index){
68
68
69 this.test.assert(this.get_output_cell(index).text == 'Success\n',
69 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
70 'Display container child executed with correct output.');
70 'Display container child executed with correct output.');
71
71
72 this.test.assert(! this.cell_element_exists(index,
72 this.test.assert(! this.cell_element_exists(index,
@@ -15,7 +15,7 b' casper.notebook_test(function () {'
15 'print("Success")\n');
15 'print("Success")\n');
16 this.execute_cell_then(float_index, function(index){
16 this.execute_cell_then(float_index, function(index){
17
17
18 this.test.assert(this.get_output_cell(index).text == 'Success\n',
18 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
19 'Create float cell executed with correct output.');
19 'Create float cell executed with correct output.');
20
20
21 this.test.assert(this.cell_element_exists(index,
21 this.test.assert(this.cell_element_exists(index,
@@ -33,7 +33,7 b' casper.notebook_test(function () {'
33
33
34 index = this.append_cell('print(float_widget.value)\n');
34 index = this.append_cell('print(float_widget.value)\n');
35 this.execute_cell_then(index, function(index){
35 this.execute_cell_then(index, function(index){
36 this.test.assert(this.get_output_cell(index).text == '1.05\n',
36 this.test.assertEquals(this.get_output_cell(index).text, '1.05\n',
37 'Float textbox value set.');
37 'Float textbox value set.');
38 this.cell_element_function(float_index, float_text_query_2, 'val', ['']);
38 this.cell_element_function(float_index, float_text_query_2, 'val', ['']);
39 this.sendKeys(float_text_query_2, '123456789.0');
39 this.sendKeys(float_text_query_2, '123456789.0');
@@ -43,7 +43,7 b' casper.notebook_test(function () {'
43
43
44 index = this.append_cell('print(float_widget.value)\n');
44 index = this.append_cell('print(float_widget.value)\n');
45 this.execute_cell_then(index, function(index){
45 this.execute_cell_then(index, function(index){
46 this.test.assert(this.get_output_cell(index).text == '123456789.0\n',
46 this.test.assertEquals(this.get_output_cell(index).text, '123456789.0\n',
47 'Long float textbox value set (probably triggers throttling).');
47 'Long float textbox value set (probably triggers throttling).');
48 this.cell_element_function(float_index, float_text_query_2, 'val', ['']);
48 this.cell_element_function(float_index, float_text_query_2, 'val', ['']);
49 this.sendKeys(float_text_query_2, '12hello');
49 this.sendKeys(float_text_query_2, '12hello');
@@ -53,7 +53,7 b' casper.notebook_test(function () {'
53
53
54 index = this.append_cell('print(float_widget.value)\n');
54 index = this.append_cell('print(float_widget.value)\n');
55 this.execute_cell_then(index, function(index){
55 this.execute_cell_then(index, function(index){
56 this.test.assert(this.get_output_cell(index).text == '12.0\n',
56 this.test.assertEquals(this.get_output_cell(index).text, '12.0\n',
57 'Invald float textbox value caught and filtered.');
57 'Invald float textbox value caught and filtered.');
58 });
58 });
59
59
@@ -73,7 +73,7 b' casper.notebook_test(function () {'
73 'print("Success")\n');
73 'print("Success")\n');
74 this.execute_cell_then(floatrange_index, function(index){
74 this.execute_cell_then(floatrange_index, function(index){
75
75
76 this.test.assert(this.get_output_cell(index).text == 'Success\n',
76 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
77 'Create float range cell executed with correct output.');
77 'Create float range cell executed with correct output.');
78
78
79 this.test.assert(this.cell_element_exists(index,
79 this.test.assert(this.cell_element_exists(index,
@@ -95,7 +95,7 b' casper.notebook_test(function () {'
95 'print("Success")\n');
95 'print("Success")\n');
96 this.execute_cell_then(index, function(index){
96 this.execute_cell_then(index, function(index){
97
97
98 this.test.assert(this.get_output_cell(index).text == 'Success\n',
98 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
99 'Float range properties cell executed with correct output.');
99 'Float range properties cell executed with correct output.');
100
100
101 this.test.assert(this.cell_element_exists(floatrange_index, slider_query),
101 this.test.assert(this.cell_element_exists(floatrange_index, slider_query),
@@ -32,7 +32,7 b' casper.notebook_test(function () {'
32 'print("Success")\n');
32 'print("Success")\n');
33 this.execute_cell_then(image_index, function(index){
33 this.execute_cell_then(image_index, function(index){
34
34
35 this.test.assert(this.get_output_cell(index).text == 'Success\n',
35 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
36 'Create image executed with correct output.');
36 'Create image executed with correct output.');
37
37
38 this.test.assert(this.cell_element_exists(index,
38 this.test.assert(this.cell_element_exists(index,
@@ -49,12 +49,12 b' casper.notebook_test(function () {'
49 this.captureSelector(capture_filename, '.my-test-image');
49 this.captureSelector(capture_filename, '.my-test-image');
50 var stream = fs.open(capture_filename, 'rb');
50 var stream = fs.open(capture_filename, 'rb');
51 var captured = btoa(stream.read());
51 var captured = btoa(stream.read());
52 stream.close()
52 stream.close();
53 fs.remove(capture_filename);
53 fs.remove(capture_filename);
54
54
55 // Uncomment line below to output captured image data to a text file.
55 // Uncomment line below to output captured image data to a text file.
56 // fs.write('./captured.txt', captured, 'w');
56 // fs.write('./captured.txt', captured, 'w');
57
57
58 this.test.assert(test_results==captured, "Red image data displayed correctly.");
58 this.test.assertEquals(test_results, captured, "Red image data displayed correctly.");
59 });
59 });
60 }); No newline at end of file
60 });
@@ -15,7 +15,7 b' casper.notebook_test(function () {'
15 'print("Success")\n');
15 'print("Success")\n');
16 this.execute_cell_then(int_index, function(index){
16 this.execute_cell_then(int_index, function(index){
17
17
18 this.test.assert(this.get_output_cell(index).text == 'Success\n',
18 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
19 'Create int cell executed with correct output.');
19 'Create int cell executed with correct output.');
20
20
21 this.test.assert(this.cell_element_exists(index,
21 this.test.assert(this.cell_element_exists(index,
@@ -33,7 +33,7 b' casper.notebook_test(function () {'
33
33
34 index = this.append_cell('print(int_widget.value)\n');
34 index = this.append_cell('print(int_widget.value)\n');
35 this.execute_cell_then(index, function(index){
35 this.execute_cell_then(index, function(index){
36 this.test.assert(this.get_output_cell(index).text == '1\n',
36 this.test.assertEquals(this.get_output_cell(index).text, '1\n',
37 'Int textbox value set.');
37 'Int textbox value set.');
38 this.cell_element_function(int_index, int_text_query_2, 'val', ['']);
38 this.cell_element_function(int_index, int_text_query_2, 'val', ['']);
39 this.sendKeys(int_text_query_2, '123456789');
39 this.sendKeys(int_text_query_2, '123456789');
@@ -43,7 +43,7 b' casper.notebook_test(function () {'
43
43
44 index = this.append_cell('print(int_widget.value)\n');
44 index = this.append_cell('print(int_widget.value)\n');
45 this.execute_cell_then(index, function(index){
45 this.execute_cell_then(index, function(index){
46 this.test.assert(this.get_output_cell(index).text == '123456789\n',
46 this.test.assertEquals(this.get_output_cell(index).text, '123456789\n',
47 'Long int textbox value set (probably triggers throttling).');
47 'Long int textbox value set (probably triggers throttling).');
48 this.cell_element_function(int_index, int_text_query_2, 'val', ['']);
48 this.cell_element_function(int_index, int_text_query_2, 'val', ['']);
49 this.sendKeys(int_text_query_2, '12hello');
49 this.sendKeys(int_text_query_2, '12hello');
@@ -53,7 +53,7 b' casper.notebook_test(function () {'
53
53
54 index = this.append_cell('print(int_widget.value)\n');
54 index = this.append_cell('print(int_widget.value)\n');
55 this.execute_cell_then(index, function(index){
55 this.execute_cell_then(index, function(index){
56 this.test.assert(this.get_output_cell(index).text == '12\n',
56 this.test.assertEquals(this.get_output_cell(index).text, '12\n',
57 'Invald int textbox value caught and filtered.');
57 'Invald int textbox value caught and filtered.');
58 });
58 });
59
59
@@ -74,7 +74,7 b' casper.notebook_test(function () {'
74 'print("Success")\n');
74 'print("Success")\n');
75 this.execute_cell_then(intrange_index, function(index){
75 this.execute_cell_then(intrange_index, function(index){
76
76
77 this.test.assert(this.get_output_cell(index).text == 'Success\n',
77 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
78 'Create int range cell executed with correct output.');
78 'Create int range cell executed with correct output.');
79
79
80 this.test.assert(this.cell_element_exists(index,
80 this.test.assert(this.cell_element_exists(index,
@@ -96,7 +96,7 b' casper.notebook_test(function () {'
96 'print("Success")\n');
96 'print("Success")\n');
97 this.execute_cell_then(index, function(index){
97 this.execute_cell_then(index, function(index){
98
98
99 this.test.assert(this.get_output_cell(index).text == 'Success\n',
99 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
100 'Int range properties cell executed with correct output.');
100 'Int range properties cell executed with correct output.');
101
101
102 this.test.assert(this.cell_element_exists(intrange_index, slider_query),
102 this.test.assert(this.cell_element_exists(intrange_index, slider_query),
@@ -119,7 +119,7 b' casper.notebook_test(function () {'
119
119
120 index = this.append_cell('print(intrange[0].value)\n');
120 index = this.append_cell('print(intrange[0].value)\n');
121 this.execute_cell_then(index, function(index){
121 this.execute_cell_then(index, function(index){
122 this.test.assert(this.get_output_cell(index).text == '1\n',
122 this.test.assertEquals(this.get_output_cell(index).text, '1\n',
123 'Int textbox set int range value');
123 'Int textbox set int range value');
124
124
125 // Clear the int textbox value and then set it to 120 by emulating
125 // Clear the int textbox value and then set it to 120 by emulating
@@ -132,7 +132,7 b' casper.notebook_test(function () {'
132
132
133 index = this.append_cell('print(intrange[0].value)\n');
133 index = this.append_cell('print(intrange[0].value)\n');
134 this.execute_cell_then(index, function(index){
134 this.execute_cell_then(index, function(index){
135 this.test.assert(this.get_output_cell(index).text == '50\n',
135 this.test.assertEquals(this.get_output_cell(index).text, '50\n',
136 'Int textbox value bound');
136 'Int textbox value bound');
137
137
138 // Clear the int textbox value and then set it to 'hello world' by
138 // Clear the int textbox value and then set it to 'hello world' by
@@ -145,7 +145,7 b' casper.notebook_test(function () {'
145
145
146 index = this.append_cell('print(intrange[0].value)\n');
146 index = this.append_cell('print(intrange[0].value)\n');
147 this.execute_cell_then(index, function(index){
147 this.execute_cell_then(index, function(index){
148 this.test.assert(this.get_output_cell(index).text == '50\n',
148 this.test.assertEquals(this.get_output_cell(index).text, '50\n',
149 'Invalid int textbox characters ignored');
149 'Invalid int textbox characters ignored');
150 });
150 });
151 }); No newline at end of file
151 });
@@ -19,7 +19,7 b' casper.notebook_test(function () {'
19 'print("Success")\n');
19 'print("Success")\n');
20 this.execute_cell_then(multicontainer1_index, function(index){
20 this.execute_cell_then(multicontainer1_index, function(index){
21
21
22 this.test.assert(this.get_output_cell(index).text == 'Success\n',
22 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
23 'Create multicontainer cell executed with correct output. (1)');
23 'Create multicontainer cell executed with correct output. (1)');
24
24
25 this.test.assert(this.cell_element_exists(index,
25 this.test.assert(this.cell_element_exists(index,
@@ -33,7 +33,7 b' casper.notebook_test(function () {'
33 'First widget tab list exists.');
33 'First widget tab list exists.');
34
34
35 // JQuery selector is 1 based
35 // JQuery selector is 1 based
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(500); // Wait for change to execute in kernel
@@ -42,16 +42,16 b' casper.notebook_test(function () {'
42 'print(multicontainer.selected_index)\n' +
42 'print(multicontainer.selected_index)\n' +
43 'multicontainer.selected_index = 2'); // 0 based
43 'multicontainer.selected_index = 2'); // 0 based
44 this.execute_cell_then(index, function(index){
44 this.execute_cell_then(index, function(index){
45 this.test.assert(this.get_output_cell(index).text == '1\n', // 0 based
45 this.test.assertEquals(this.get_output_cell(index).text, '1\n', // 0 based
46 'selected_index property updated with tab change.');
46 'selected_index property updated with tab change.');
47
47
48 // JQuery selector is 1 based
48 // JQuery selector is 1 based
49 this.test.assert(!this.cell_element_function(multicontainer1_index, multicontainer1_query + ' li:nth-child(1)', 'hasClass', ['active']),
49 this.test.assert(!this.cell_element_function(multicontainer1_index, multicontainer1_query + ' li:nth-child(1)', 'hasClass', ['active']),
50 "Tab 1 is not selected.")
50 "Tab 1 is not selected.");
51 this.test.assert(!this.cell_element_function(multicontainer1_index, multicontainer1_query + ' li:nth-child(2)', 'hasClass', ['active']),
51 this.test.assert(!this.cell_element_function(multicontainer1_index, multicontainer1_query + ' li:nth-child(2)', 'hasClass', ['active']),
52 "Tab 2 is not selected.")
52 "Tab 2 is not selected.");
53 this.test.assert(this.cell_element_function(multicontainer1_index, multicontainer1_query + ' li:nth-child(3)', 'hasClass', ['active']),
53 this.test.assert(this.cell_element_function(multicontainer1_index, multicontainer1_query + ' li:nth-child(3)', 'hasClass', ['active']),
54 "Tab 3 is selected.")
54 "Tab 3 is selected.");
55 });
55 });
56
56
57 index = this.append_cell('multicontainer.set_title(1, "hello")\nprint("Success")'); // 0 based
57 index = this.append_cell('multicontainer.set_title(1, "hello")\nprint("Success")'); // 0 based
@@ -75,7 +75,7 b' casper.notebook_test(function () {'
75 'print("Success")\n');
75 'print("Success")\n');
76 this.execute_cell_then(multicontainer2_index, function(index){
76 this.execute_cell_then(multicontainer2_index, function(index){
77
77
78 this.test.assert(this.get_output_cell(index).text == 'Success\n',
78 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
79 'Create multicontainer cell executed with correct output. (2)');
79 'Create multicontainer cell executed with correct output. (2)');
80
80
81 this.test.assert(this.cell_element_exists(index,
81 this.test.assert(this.cell_element_exists(index,
@@ -102,7 +102,7 b' casper.notebook_test(function () {'
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){
105 this.test.assert(this.get_output_cell(index).text == '1\n', // 0 based
105 this.test.assertEquals(this.get_output_cell(index).text, '1\n', // 0 based
106 'selected_index property updated with tab change.');
106 'selected_index property updated with tab change.');
107 });
107 });
108 }); No newline at end of file
108 });
@@ -6,10 +6,10 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 combo_selector = '.widget-area .widget-subarea .widget-hbox-single .btn-group .widget-combo-btn'
9 var combo_selector = '.widget-area .widget-subarea .widget-hbox-single .btn-group .widget-combo-btn';
10 var multibtn_selector = '.widget-area .widget-subarea .widget-hbox-single .btn-group[data-toggle="buttons-radio"]'
10 var multibtn_selector = '.widget-area .widget-subarea .widget-hbox-single .btn-group[data-toggle="buttons-radio"]';
11 var radio_selector = '.widget-area .widget-subarea .widget-hbox .vbox'
11 var radio_selector = '.widget-area .widget-subarea .widget-hbox .vbox';
12 var list_selector = '.widget-area .widget-subarea .widget-hbox .widget-listbox'
12 var list_selector = '.widget-area .widget-subarea .widget-hbox .widget-listbox';
13
13
14 var selection_index;
14 var selection_index;
15 var selection_values = 'abcd';
15 var selection_values = 'abcd';
@@ -30,7 +30,7 b' casper.notebook_test(function () {'
30 combo_state == state;
30 combo_state == state;
31 }
31 }
32 return true;
32 return true;
33 }
33 };
34
34
35 var verify_selection = function(context, index){
35 var verify_selection = function(context, index){
36 for (var i = 0; i < selection_values.length; i++) {
36 for (var i = 0; i < selection_values.length; i++) {
@@ -39,7 +39,7 b' casper.notebook_test(function () {'
39 }
39 }
40 }
40 }
41 return true;
41 return true;
42 }
42 };
43
43
44 //values=["' + selection_values + '"[i] for i in range(4)]
44 //values=["' + selection_values + '"[i] for i in range(4)]
45 selection_index = this.append_cell(
45 selection_index = this.append_cell(
@@ -56,7 +56,7 b' casper.notebook_test(function () {'
56 ' widget.on_trait_change(handle_change, "value")\n' +
56 ' widget.on_trait_change(handle_change, "value")\n' +
57 'print("Success")\n');
57 'print("Success")\n');
58 this.execute_cell_then(selection_index, function(index){
58 this.execute_cell_then(selection_index, function(index){
59 this.test.assert(this.get_output_cell(index).text == 'Success\n',
59 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
60 'Create selection cell executed with correct output.');
60 'Create selection cell executed with correct output.');
61
61
62 this.test.assert(this.cell_element_exists(index,
62 this.test.assert(this.cell_element_exists(index,
@@ -84,7 +84,7 b' casper.notebook_test(function () {'
84 ' widget.value = "a"\n' +
84 ' widget.value = "a"\n' +
85 'print("Success")\n');
85 'print("Success")\n');
86 this.execute_cell_then(index, function(index){
86 this.execute_cell_then(index, function(index){
87 this.test.assert(this.get_output_cell(index).text == 'Success\n',
87 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
88 'Python select item executed with correct output.');
88 'Python select item executed with correct output.');
89
89
90 // Verify that the first item is selected.
90 // Verify that the first item is selected.
@@ -15,7 +15,7 b' casper.notebook_test(function () {'
15 'print("Success")');
15 'print("Success")');
16 this.execute_cell_then(string_index, function(index){
16 this.execute_cell_then(string_index, function(index){
17
17
18 this.test.assert(this.get_output_cell(index).text == 'Success\n',
18 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
19 'Create string widget cell executed with correct output.');
19 'Create string widget cell executed with correct output.');
20
20
21 this.test.assert(this.cell_element_exists(index,
21 this.test.assert(this.cell_element_exists(index,
General Comments 0
You need to be logged in to leave comments. Login now