##// END OF EJS Templates
s/key_press/trigger_keydown
Jonathan Frederic -
Show More
@@ -11,23 +11,23 b' casper.notebook_test(function () {'
11
11
12 this.then(function () {
12 this.then(function () {
13 this.validate_state('initial state', 'edit', 0);
13 this.validate_state('initial state', 'edit', 0);
14 this.key_press('esc');
14 this.trigger_keydown('esc');
15 this.validate_state('esc', 'command', 0);
15 this.validate_state('esc', 'command', 0);
16 this.key_press('down');
16 this.trigger_keydown('down');
17 this.validate_state('down', 'command', 1);
17 this.validate_state('down', 'command', 1);
18 this.key_press('enter');
18 this.trigger_keydown('enter');
19 this.validate_state('enter', 'edit', 1);
19 this.validate_state('enter', 'edit', 1);
20 this.key_press('j');
20 this.trigger_keydown('j');
21 this.validate_state('j in edit mode', 'edit', 1);
21 this.validate_state('j in edit mode', 'edit', 1);
22 this.key_press('esc');
22 this.trigger_keydown('esc');
23 this.validate_state('esc', 'command', 1);
23 this.validate_state('esc', 'command', 1);
24 this.key_press('j');
24 this.trigger_keydown('j');
25 this.validate_state('j in command mode', 'command', 2);
25 this.validate_state('j in command mode', 'command', 2);
26 this.click_cell(0);
26 this.click_cell(0);
27 this.validate_state('click cell 0', 'edit', 0);
27 this.validate_state('click cell 0', 'edit', 0);
28 this.click_cell(3);
28 this.click_cell(3);
29 this.validate_state('click cell 3', 'edit', 3);
29 this.validate_state('click cell 3', 'edit', 3);
30 this.key_press('esc');
30 this.trigger_keydown('esc');
31 this.validate_state('esc', 'command', 3);
31 this.validate_state('esc', 'command', 3);
32
32
33 // Open keyboard help
33 // Open keyboard help
@@ -35,7 +35,7 b' casper.notebook_test(function () {'
35 $('#keyboard_shortcuts a').click();
35 $('#keyboard_shortcuts a').click();
36 }, {});
36 }, {});
37
37
38 this.key_press('k');
38 this.trigger_keydown('k');
39 this.validate_state('k in command mode while keyboard help is up', 'command', 3);
39 this.validate_state('k in command mode while keyboard help is up', 'command', 3);
40
40
41 // Close keyboard help
41 // Close keyboard help
@@ -43,7 +43,7 b' casper.notebook_test(function () {'
43 $('div.modal button.close').click();
43 $('div.modal button.close').click();
44 }, {});
44 }, {});
45
45
46 this.key_press('k');
46 this.trigger_keydown('k');
47 this.validate_state('k in command mode', 'command', 2);
47 this.validate_state('k in command mode', 'command', 2);
48 this.click_cell(0);
48 this.click_cell(0);
49 this.validate_state('click cell 0', 'edit', 0);
49 this.validate_state('click cell 0', 'edit', 0);
@@ -55,17 +55,17 b' casper.notebook_test(function () {'
55 this.validate_state('focus #notebook', 'command', 0);
55 this.validate_state('focus #notebook', 'command', 0);
56 this.click_cell(3);
56 this.click_cell(3);
57 this.validate_state('click cell 3', 'edit', 3);
57 this.validate_state('click cell 3', 'edit', 3);
58 this.key_press('shift+enter');
58 this.trigger_keydown('shift+enter');
59 this.validate_state('shift+enter (no cell below)', 'edit', 4);
59 this.validate_state('shift+enter (no cell below)', 'edit', 4);
60 this.click_cell(3);
60 this.click_cell(3);
61 this.validate_state('click cell 3', 'edit', 3);
61 this.validate_state('click cell 3', 'edit', 3);
62 this.key_press('shift+enter');
62 this.trigger_keydown('shift+enter');
63 this.validate_state('shift+enter (cell exists below)', 'command', 4);
63 this.validate_state('shift+enter (cell exists below)', 'command', 4);
64 this.click_cell(3);
64 this.click_cell(3);
65 this.validate_state('click cell 3', 'edit', 3);
65 this.validate_state('click cell 3', 'edit', 3);
66 this.key_press('alt+enter');
66 this.trigger_keydown('alt+enter');
67 this.validate_state('alt+enter', 'edit', 4);
67 this.validate_state('alt+enter', 'edit', 4);
68 this.key_press('ctrl+enter');
68 this.trigger_keydown('ctrl+enter');
69 this.validate_state('ctrl+enter', 'command', 4);
69 this.validate_state('ctrl+enter', 'command', 4);
70 });
70 });
71
71
@@ -155,7 +155,7 b' casper.notebook_test(function () {'
155 }, {});
155 }, {});
156 };
156 };
157
157
158 this.key_press = function(key) {
158 this.trigger_keydown = function(key) {
159 this.evaluate(function (k) {
159 this.evaluate(function (k) {
160 IPython.keyboard.trigger_keydown(k);
160 IPython.keyboard.trigger_keydown(k);
161 }, {k: key});
161 }, {k: key});
General Comments 0
You need to be logged in to leave comments. Login now