##// END OF EJS Templates
Made *+enter tests more complicated.
Jonathan Frederic -
Show More
@@ -55,18 +55,58 b' casper.notebook_test(function () {'
55 55 this.validate_state('focus #notebook', 'command', 0);
56 56 this.click_cell(3);
57 57 this.validate_state('click cell 3', 'edit', 3);
58
59 // shift+enter tests.
60 // last cell in notebook
61 var base_index = 3;
62 this.trigger_keydown('shift+enter'); // Creates one cell
63 this.validate_state('shift+enter (no cell below)', 'edit', base_index + 1);
64 // not last cell in notebook & starts in edit mode
65 this.click_cell(base_index);
66 this.validate_state('click cell %d' % base_index, 'edit', base_index);
58 67 this.trigger_keydown('shift+enter');
59 this.validate_state('shift+enter (no cell below)', 'edit', 4);
60 this.click_cell(3);
61 this.validate_state('click cell 3', 'edit', 3);
68 this.validate_state('shift+enter (cell exists below)', 'command', base_index + 1);
69 // starts in command mode
70 this.trigger_keydown('k');
71 this.validate_state('k in comand mode', 'command', base_index);
62 72 this.trigger_keydown('shift+enter');
63 this.validate_state('shift+enter (cell exists below)', 'command', 4);
64 this.click_cell(3);
65 this.validate_state('click cell 3', 'edit', 3);
66 this.trigger_keydown('alt+enter');
67 this.validate_state('alt+enter', 'edit', 4);
73 this.validate_state('shift+enter (start in command mode)', 'command', base_index + 1);
74
75 // ctrl+enter tests.
76 // last cell in notebook
77 base_index++;
78 this.trigger_keydown('ctrl+enter');
79 this.validate_state('ctrl+enter (no cell below)', 'command', base_index);
80 // not last cell in notebook & starts in edit mode
81 this.click_cell(base_index-1);
82 this.validate_state('click cell %d' % (base_index-1), 'edit', base_index-1);
68 83 this.trigger_keydown('ctrl+enter');
69 this.validate_state('ctrl+enter', 'command', 4);
84 this.validate_state('ctrl+enter (cell exists below)', 'command', base_index-1);
85 // starts in command mode
86 this.trigger_keydown('j');
87 this.validate_state('j in comand mode', 'command', base_index);
88 this.trigger_keydown('ctrl+enter');
89 this.validate_state('ctrl+enter (start in command mode)', 'command', base_index);
90
91 // alt+enter tests.
92 // last cell in notebook
93 base_index++;
94 this.trigger_keydown('alt+enter'); // Creates one cell
95 this.validate_state('alt+enter (no cell below)', 'edit', base_index + 1);
96 // not last cell in notebook & starts in edit mode
97 this.click_cell(base_index);
98 this.validate_state('click cell %d' % base_index, 'edit', base_index);
99 this.trigger_keydown('alt+enter'); // Creates one cell
100 this.validate_state('alt+enter (cell exists below)', 'edit', base_index + 1);
101 // starts in command mode
102 this.trigger_keydown('esc');
103 this.trigger_keydown('k');
104 this.validate_state('k in comand mode', 'command', base_index);
105 this.trigger_keydown('alt+enter'); // Creates one cell
106 this.validate_state('alt+enter (start in command mode)', 'edit', base_index + 1);
107
108 // Notebook will now have 8 cells, the index of the last cell will be 7.
109
70 110 });
71 111
72 112
General Comments 0
You need to be logged in to leave comments. Login now