##// END OF EJS Templates
Remove debug print statements in container tests
Jonathan Frederic -
Show More
@@ -1,81 +1,80 b''
1 1 // Test container class
2 2 casper.notebook_test(function () {
3 3 index = this.append_cell(
4 4 'from IPython.html import widgets\n' +
5 5 'from IPython.display import display, clear_output\n' +
6 6 'print("Success")');
7 7 this.execute_cell_then(index);
8 8
9 9 var container_index = this.append_cell(
10 10 'container = widgets.ContainerWidget()\n' +
11 11 'button = widgets.ButtonWidget()\n'+
12 12 'container.children = [button]\n'+
13 13 'display(container)\n'+
14 14 'container.add_class("my-test-class")\n'+
15 15 'print("Success")\n');
16 16 this.execute_cell_then(container_index, function(index){
17 17
18 print(this.get_output_cell(index).text);
19 18 this.test.assert(this.get_output_cell(index).text == 'Success\n',
20 19 'Create container cell executed with correct output.');
21 20
22 21 this.test.assert(this.cell_element_exists(index,
23 22 '.widget-area .widget-subarea'),
24 23 'Widget subarea exists.');
25 24
26 25 this.test.assert(this.cell_element_exists(index,
27 26 '.widget-area .widget-subarea .widget-container'),
28 27 'Widget container exists.');
29 28
30 29 this.test.assert(this.cell_element_exists(index,
31 30 '.widget-area .widget-subarea .my-test-class'),
32 31 'add_class works.');
33 32
34 33 this.test.assert(this.cell_element_exists(index,
35 34 '.widget-area .widget-subarea .my-test-class button'),
36 35 'Container parent/child relationship works.');
37 36 });
38 37
39 38 index = this.append_cell(
40 39 'container.set_css("float", "right")\n'+
41 40 'print("Success")\n');
42 41 this.execute_cell_then(index, function(index){
43 42
44 43 this.test.assert(this.get_output_cell(index).text == 'Success\n',
45 44 'Set container class CSS cell executed with correct output.');
46 45
47 46 this.test.assert(this.cell_element_function(container_index,
48 47 '.widget-area .widget-subarea .my-test-class', 'css', ['float'])=='right',
49 48 'set_css works.');
50 49 });
51 50
52 51 index = this.append_cell(
53 52 'container.remove_class("my-test-class")\n'+
54 53 'print("Success")\n');
55 54 this.execute_cell_then(index, function(index){
56 55
57 56 this.test.assert(this.get_output_cell(index).text == 'Success\n',
58 57 'Remove container class cell executed with correct output.');
59 58
60 59 this.test.assert(! this.cell_element_exists(container_index,
61 60 '.widget-area .widget-subarea .my-test-class'),
62 61 'remove_class works.');
63 62 });
64 63
65 64 index = this.append_cell(
66 65 'display(button)\n'+
67 66 'print("Success")\n');
68 67 this.execute_cell_then(index, function(index){
69 68
70 69 this.test.assert(this.get_output_cell(index).text == 'Success\n',
71 70 'Display container child executed with correct output.');
72 71
73 72 this.test.assert(! this.cell_element_exists(index,
74 73 '.widget-area .widget-subarea .widget-container'),
75 74 'Parent container not displayed.');
76 75
77 76 this.test.assert(this.cell_element_exists(index,
78 77 '.widget-area .widget-subarea button'),
79 78 'Child displayed.');
80 79 });
81 80 }); No newline at end of file
@@ -1,109 +1,108 b''
1 1 // Test multicontainer class
2 2 casper.notebook_test(function () {
3 3 index = this.append_cell(
4 4 'from IPython.html import widgets\n' +
5 5 'from IPython.display import display, clear_output\n' +
6 6 'print("Success")');
7 7 this.execute_cell_then(index);
8 8
9 9 // Test tab view
10 10 var multicontainer1_query = '.widget-area .widget-subarea div div.nav-tabs';
11 11 var multicontainer1_index = this.append_cell(
12 12 'multicontainer = widgets.MulticontainerWidget()\n' +
13 13 'page1 = widgets.StringWidget()\n' +
14 14 'page2 = widgets.StringWidget()\n' +
15 15 'page3 = widgets.StringWidget()\n' +
16 16 'multicontainer.children = [page1, page2, page3]\n' +
17 17 'display(multicontainer)\n' +
18 18 'multicontainer.selected_index = 0\n' +
19 19 'print("Success")\n');
20 20 this.execute_cell_then(multicontainer1_index, function(index){
21 print(this.get_output_cell(index, 0).text);
22 print(this.get_output_cell(index, 1).text);
21
23 22 this.test.assert(this.get_output_cell(index).text == 'Success\n',
24 23 'Create multicontainer cell executed with correct output. (1)');
25 24
26 25 this.test.assert(this.cell_element_exists(index,
27 26 '.widget-area .widget-subarea'),
28 27 'Widget subarea exists.');
29 28
30 29 this.test.assert(this.cell_element_exists(index, multicontainer1_query),
31 30 'Widget tab list exists.');
32 31
33 32 this.test.assert(this.cell_element_exists(index, multicontainer1_query),
34 33 'First widget tab list exists.');
35 34
36 35 // JQuery selector is 1 based
37 36 this.click(multicontainer1_query + ' li:nth-child(2) a')
38 37 });
39 38
40 39 this.wait(500); // Wait for change to execute in kernel
41 40
42 41 index = this.append_cell(
43 42 'print(multicontainer.selected_index)\n' +
44 43 'multicontainer.selected_index = 2'); // 0 based
45 44 this.execute_cell_then(index, function(index){
46 45 this.test.assert(this.get_output_cell(index).text == '1\n', // 0 based
47 46 'selected_index property updated with tab change.');
48 47
49 48 // JQuery selector is 1 based
50 49 this.test.assert(!this.cell_element_function(multicontainer1_index, multicontainer1_query + ' li:nth-child(1)', 'hasClass', ['active']),
51 50 "Tab 1 is not selected.")
52 51 this.test.assert(!this.cell_element_function(multicontainer1_index, multicontainer1_query + ' li:nth-child(2)', 'hasClass', ['active']),
53 52 "Tab 2 is not selected.")
54 53 this.test.assert(this.cell_element_function(multicontainer1_index, multicontainer1_query + ' li:nth-child(3)', 'hasClass', ['active']),
55 54 "Tab 3 is selected.")
56 55 });
57 56
58 57 index = this.append_cell('multicontainer.set_title(1, "hello")\nprint("Success")'); // 0 based
59 58 this.execute_cell_then(index, function(index){
60 59 this.test.assert(this.cell_element_function(multicontainer1_index, multicontainer1_query +
61 60 ' li:nth-child(2) a', 'html') == 'hello',
62 61 'Tab page title set (after display).');
63 62 });
64 63
65 64 // Test accordion view
66 65 var multicontainer2_query = '.widget-area .widget-subarea .accordion';
67 66 var multicontainer2_index = this.append_cell(
68 67 'multicontainer = widgets.MulticontainerWidget()\n' +
69 68 'page1 = widgets.StringWidget()\n' +
70 69 'page2 = widgets.StringWidget()\n' +
71 70 'page3 = widgets.StringWidget()\n' +
72 71 'multicontainer.children = [page1, page2, page3]\n' +
73 72 'multicontainer.set_title(2, "good")\n' +
74 73 'display(multicontainer, view_name="AccordionView")\n' +
75 74 'multicontainer.selected_index = 0\n' +
76 75 'print("Success")\n');
77 76 this.execute_cell_then(multicontainer2_index, function(index){
78 77
79 78 this.test.assert(this.get_output_cell(index).text == 'Success\n',
80 79 'Create multicontainer cell executed with correct output. (2)');
81 80
82 81 this.test.assert(this.cell_element_exists(index,
83 82 '.widget-area .widget-subarea'),
84 83 'Widget subarea exists.');
85 84
86 85 this.test.assert(this.cell_element_exists(index, multicontainer2_query),
87 86 'Widget accordion exists.');
88 87
89 88 this.test.assert(this.cell_element_exists(index, multicontainer2_query +
90 89 ' .accordion-group:nth-child(1) .accordion-body'),
91 90 'First accordion page exists.');
92 91
93 92 // JQuery selector is 1 based
94 93 this.test.assert(this.cell_element_function(index, multicontainer2_query +
95 94 ' .accordion-group:nth-child(3) .accordion-heading .accordion-toggle',
96 95 'html')=='good', 'Accordion page title set (before display).');
97 96
98 97 // JQuery selector is 1 based
99 98 this.click(multicontainer2_query + ' .accordion-group:nth-child(2) .accordion-heading .accordion-toggle');
100 99 });
101 100
102 101 this.wait(500); // Wait for change to execute in kernel
103 102
104 103 index = this.append_cell('print(multicontainer.selected_index)'); // 0 based
105 104 this.execute_cell_then(index, function(index){
106 105 this.test.assert(this.get_output_cell(index).text == '1\n', // 0 based
107 106 'selected_index property updated with tab change.');
108 107 });
109 108 }); No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now