##// END OF EJS Templates
Made tests reflect changes to widget naming scheme.
Jonathan Frederic -
Show More
@@ -56,4 +56,92 casper.notebook_test(function () {
56 this.test.assert(this.get_output_cell(index).text == '12.0\n',
56 this.test.assert(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
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
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';
68
69 var floatrange_index = this.append_cell(
70 'floatrange = [widgets.BoundedFloatTextWidget(), \n' +
71 ' widgets.FloatSliderWidget()]\n' +
72 '[display(floatrange[i]) for i in range(2)]\n' +
73 'print("Success")\n');
74 this.execute_cell_then(floatrange_index, function(index){
75
76 this.test.assert(this.get_output_cell(index).text == 'Success\n',
77 'Create float range cell executed with correct output.');
78
79 this.test.assert(this.cell_element_exists(index,
80 '.widget-area .widget-subarea'),
81 'Widget subarea exists.');
82
83 this.test.assert(this.cell_element_exists(index, slider_query),
84 'Widget slider exists.');
85
86 this.test.assert(this.cell_element_exists(index, float_text_query),
87 'Widget float textbox exists.');
88 });
89
90 index = this.append_cell(
91 'for widget in floatrange:\n' +
92 ' widget.max = 50.0\n' +
93 ' widget.min = -50.0\n' +
94 ' widget.value = 20.0\n' +
95 'print("Success")\n');
96 this.execute_cell_then(index, function(index){
97
98 this.test.assert(this.get_output_cell(index).text == 'Success\n',
99 'Float range properties cell executed with correct output.');
100
101 this.test.assert(this.cell_element_exists(floatrange_index, slider_query),
102 'Widget slider exists.');
103
104 this.test.assert(this.cell_element_function(floatrange_index, slider_query,
105 'slider', ['value']) == 20.0,
106 'Slider set to Python value.');
107
108 // Clear the float textbox value and then set it to 1 by emulating
109 // keyboard presses.
110 this.cell_element_function(floatrange_index, float_text_query, 'val', ['']);
111 this.sendKeys(float_text_query, '1');
112 });
113
114 this.wait(1500); // Wait for change to execute in kernel
115
116 index = this.append_cell('for widget in floatrange:\n print(widget.value)\n');
117 this.execute_cell_then(index, function(index){
118 this.test.assert(this.get_output_cell(index).text == '1.0\n20.0\n',
119 'Float textbox set float range value');
120
121 // Clear the float textbox value and then set it to 120 by emulating
122 // keyboard presses.
123 this.cell_element_function(floatrange_index, float_text_query, 'val', ['']);
124 this.sendKeys(float_text_query, '120');
125 });
126
127 this.wait(500); // Wait for change to execute in kernel
128
129 index = this.append_cell('print(floatrange[0].value)\n');
130 this.execute_cell_then(index, function(index){
131 this.test.assert(this.get_output_cell(index).text == '50.0\n',
132 'Float textbox value bound');
133
134 // Clear the float textbox value and then set it to 'hello world' by
135 // emulating keyboard presses. 'hello world' should get filtered...
136 this.cell_element_function(floatrange_index, float_text_query, 'val', ['']);
137 this.sendKeys(float_text_query, 'hello world');
138 });
139
140 this.wait(500); // Wait for change to execute in kernel
141
142 index = this.append_cell('print(floatrange[0].value)\n');
143 this.execute_cell_then(index, function(index){
144 this.test.assert(this.get_output_cell(index).text == '50.0\n',
145 'Invalid float textbox characters ignored');
146 });
59 }); No newline at end of file
147 });
@@ -1,90 +0,0
1 // Test float range class
2 casper.notebook_test(function () {
3 index = this.append_cell(
4 'from IPython.html import widgets\n' +
5 'from IPython.display import display, clear_output\n' +
6 'print("Success")');
7 this.execute_cell_then(index);
8
9 var slider_query = '.widget-area .widget-subarea .widget-hbox-single .slider';
10 var float_text_query = '.widget-area .widget-subarea .widget-hbox-single .widget-numeric-text';
11
12 var floatrange_index = this.append_cell(
13 'floatrange = [widgets.BoundedFloatTextWidget(), \n' +
14 ' widgets.FloatSliderWidget()]\n' +
15 '[display(floatrange[i]) for i in range(2)]\n' +
16 'print("Success")\n');
17 this.execute_cell_then(floatrange_index, function(index){
18
19 this.test.assert(this.get_output_cell(index).text == 'Success\n',
20 'Create float range cell executed with correct output.');
21
22 this.test.assert(this.cell_element_exists(index,
23 '.widget-area .widget-subarea'),
24 'Widget subarea exists.');
25
26 this.test.assert(this.cell_element_exists(index, slider_query),
27 'Widget slider exists.');
28
29 this.test.assert(this.cell_element_exists(index, float_text_query),
30 'Widget float textbox exists.');
31 });
32
33 index = this.append_cell(
34 'for widget in floatrange:\n' +
35 ' widget.max = 50.0\n' +
36 ' widget.min = -50.0\n' +
37 ' widget.value = 20.0\n' +
38 'print("Success")\n');
39 this.execute_cell_then(index, function(index){
40
41 this.test.assert(this.get_output_cell(index).text == 'Success\n',
42 'Float range properties cell executed with correct output.');
43
44 this.test.assert(this.cell_element_exists(floatrange_index, slider_query),
45 'Widget slider exists.');
46
47 this.test.assert(this.cell_element_function(floatrange_index, slider_query,
48 'slider', ['value']) == 20.0,
49 'Slider set to Python value.');
50
51 // Clear the float textbox value and then set it to 1 by emulating
52 // keyboard presses.
53 this.cell_element_function(floatrange_index, float_text_query, 'val', ['']);
54 this.sendKeys(float_text_query, '1');
55 });
56
57 this.wait(1500); // Wait for change to execute in kernel
58
59 index = this.append_cell('for widget in floatrange:\n print(widget.value)\n');
60 this.execute_cell_then(index, function(index){
61 this.test.assert(this.get_output_cell(index).text == '1.0\n20.0\n',
62 'Float textbox set float range value');
63
64 // Clear the float textbox value and then set it to 120 by emulating
65 // keyboard presses.
66 this.cell_element_function(floatrange_index, float_text_query, 'val', ['']);
67 this.sendKeys(float_text_query, '120');
68 });
69
70 this.wait(500); // Wait for change to execute in kernel
71
72 index = this.append_cell('print(floatrange[0].value)\n');
73 this.execute_cell_then(index, function(index){
74 this.test.assert(this.get_output_cell(index).text == '50.0\n',
75 'Float textbox value bound');
76
77 // Clear the float textbox value and then set it to 'hello world' by
78 // emulating keyboard presses. 'hello world' should get filtered...
79 this.cell_element_function(floatrange_index, float_text_query, 'val', ['']);
80 this.sendKeys(float_text_query, 'hello world');
81 });
82
83 this.wait(500); // Wait for change to execute in kernel
84
85 index = this.append_cell('print(floatrange[0].value)\n');
86 this.execute_cell_then(index, function(index){
87 this.test.assert(this.get_output_cell(index).text == '50.0\n',
88 'Invalid float textbox characters ignored');
89 });
90 }); No newline at end of file
@@ -56,4 +56,96 casper.notebook_test(function () {
56 this.test.assert(this.get_output_cell(index).text == '12\n',
56 this.test.assert(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
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
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
69 var intrange_index = this.append_cell(
70 'intrange = [widgets.BoundedIntTextWidget(),\n' +
71 ' widgets.IntSliderWidget()]\n' +
72 '[display(intrange[i]) for i in range(2)]\n' +
73 'intrange[0].add_class("my-second-num-test-text")\n' +
74 'print("Success")\n');
75 this.execute_cell_then(intrange_index, function(index){
76
77 this.test.assert(this.get_output_cell(index).text == 'Success\n',
78 'Create int range cell executed with correct output.');
79
80 this.test.assert(this.cell_element_exists(index,
81 '.widget-area .widget-subarea'),
82 'Widget subarea exists.');
83
84 this.test.assert(this.cell_element_exists(index, slider_query),
85 'Widget slider exists.');
86
87 this.test.assert(this.cell_element_exists(index, int_text_query),
88 'Widget int textbox exists.');
89 });
90
91 index = this.append_cell(
92 'for widget in intrange:\n' +
93 ' widget.max = 50\n' +
94 ' widget.min = -50\n' +
95 ' widget.value = 25\n' +
96 'print("Success")\n');
97 this.execute_cell_then(index, function(index){
98
99 this.test.assert(this.get_output_cell(index).text == 'Success\n',
100 'Int range properties cell executed with correct output.');
101
102 this.test.assert(this.cell_element_exists(intrange_index, slider_query),
103 'Widget slider exists.');
104
105 this.test.assert(this.cell_element_function(intrange_index, slider_query,
106 'slider', ['value']) == 25,
107 'Slider set to Python value.');
108
109 this.test.assert(this.cell_element_function(intrange_index, int_text_query,
110 'val') == 25, 'Int textbox set to Python value.');
111
112 // Clear the int textbox value and then set it to 1 by emulating
113 // keyboard presses.
114 this.cell_element_function(intrange_index, int_text_query, 'val', ['']);
115 this.sendKeys(int_text_query, '1');
116 });
117
118 this.wait(500); // Wait for change to execute in kernel
119
120 index = this.append_cell('print(intrange[0].value)\n');
121 this.execute_cell_then(index, function(index){
122 this.test.assert(this.get_output_cell(index).text == '1\n',
123 'Int textbox set int range value');
124
125 // Clear the int textbox value and then set it to 120 by emulating
126 // keyboard presses.
127 this.cell_element_function(intrange_index, int_text_query, 'val', ['']);
128 this.sendKeys(int_text_query, '120');
129 });
130
131 this.wait(500); // Wait for change to execute in kernel
132
133 index = this.append_cell('print(intrange[0].value)\n');
134 this.execute_cell_then(index, function(index){
135 this.test.assert(this.get_output_cell(index).text == '50\n',
136 'Int textbox value bound');
137
138 // Clear the int textbox value and then set it to 'hello world' by
139 // emulating keyboard presses. 'hello world' should get filtered...
140 this.cell_element_function(intrange_index, int_text_query, 'val', ['']);
141 this.sendKeys(int_text_query, 'hello world');
142 });
143
144 this.wait(500); // Wait for change to execute in kernel
145
146 index = this.append_cell('print(intrange[0].value)\n');
147 this.execute_cell_then(index, function(index){
148 this.test.assert(this.get_output_cell(index).text == '50\n',
149 'Invalid int textbox characters ignored');
150 });
59 }); No newline at end of file
151 });
@@ -1,94 +0,0
1 // Test int range class
2 casper.notebook_test(function () {
3 index = this.append_cell(
4 'from IPython.html import widgets\n' +
5 'from IPython.display import display, clear_output\n' +
6 'print("Success")');
7 this.execute_cell_then(index);
8
9 var slider_query = '.widget-area .widget-subarea .widget-hbox-single .slider';
10 var int_text_query = '.widget-area .widget-subarea .widget-hbox-single .my-second-num-test-text';
11
12 var intrange_index = this.append_cell(
13 'intrange = [widgets.BoundedIntTextWidget(),\n' +
14 ' widgets.IntSliderWidget()]\n' +
15 '[display(intrange[i]) for i in range(2)]\n' +
16 'intrange[0].add_class("my-second-num-test-text")\n' +
17 'print("Success")\n');
18 this.execute_cell_then(intrange_index, function(index){
19
20 this.test.assert(this.get_output_cell(index).text == 'Success\n',
21 'Create int range cell executed with correct output.');
22
23 this.test.assert(this.cell_element_exists(index,
24 '.widget-area .widget-subarea'),
25 'Widget subarea exists.');
26
27 this.test.assert(this.cell_element_exists(index, slider_query),
28 'Widget slider exists.');
29
30 this.test.assert(this.cell_element_exists(index, int_text_query),
31 'Widget int textbox exists.');
32 });
33
34 index = this.append_cell(
35 'for widget in intrange:\n' +
36 ' widget.max = 50\n' +
37 ' widget.min = -50\n' +
38 ' widget.value = 25\n' +
39 'print("Success")\n');
40 this.execute_cell_then(index, function(index){
41
42 this.test.assert(this.get_output_cell(index).text == 'Success\n',
43 'Int range properties cell executed with correct output.');
44
45 this.test.assert(this.cell_element_exists(intrange_index, slider_query),
46 'Widget slider exists.');
47
48 this.test.assert(this.cell_element_function(intrange_index, slider_query,
49 'slider', ['value']) == 25,
50 'Slider set to Python value.');
51
52 this.test.assert(this.cell_element_function(intrange_index, int_text_query,
53 'val') == 25, 'Int textbox set to Python value.');
54
55 // Clear the int textbox value and then set it to 1 by emulating
56 // keyboard presses.
57 this.cell_element_function(intrange_index, int_text_query, 'val', ['']);
58 this.sendKeys(int_text_query, '1');
59 });
60
61 this.wait(500); // Wait for change to execute in kernel
62
63 index = this.append_cell('print(intrange[0].value)\n');
64 this.execute_cell_then(index, function(index){
65 this.test.assert(this.get_output_cell(index).text == '1\n',
66 'Int textbox set int range value');
67
68 // Clear the int textbox value and then set it to 120 by emulating
69 // keyboard presses.
70 this.cell_element_function(intrange_index, int_text_query, 'val', ['']);
71 this.sendKeys(int_text_query, '120');
72 });
73
74 this.wait(500); // Wait for change to execute in kernel
75
76 index = this.append_cell('print(intrange[0].value)\n');
77 this.execute_cell_then(index, function(index){
78 this.test.assert(this.get_output_cell(index).text == '50\n',
79 'Int textbox value bound');
80
81 // Clear the int textbox value and then set it to 'hello world' by
82 // emulating keyboard presses. 'hello world' should get filtered...
83 this.cell_element_function(intrange_index, int_text_query, 'val', ['']);
84 this.sendKeys(int_text_query, 'hello world');
85 });
86
87 this.wait(500); // Wait for change to execute in kernel
88
89 index = this.append_cell('print(intrange[0].value)\n');
90 this.execute_cell_then(index, function(index){
91 this.test.assert(this.get_output_cell(index).text == '50\n',
92 'Invalid int textbox characters ignored');
93 });
94 }); No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now