##// END OF EJS Templates
Fixing references to IPython.keycodes.
Brian E. Granger -
Show More
@@ -1,24 +1,24 b''
1 //
1 //
2 // Check for errors with up and down arrow presses in a non-empty notebook.
2 // Check for errors with up and down arrow presses in a non-empty notebook.
3 //
3 //
4 casper.notebook_test(function () {
4 casper.notebook_test(function () {
5 var result = this.evaluate(function() {
5 var result = this.evaluate(function() {
6 IPython.notebook.command_mode();
6 IPython.notebook.command_mode();
7 pos0 = IPython.notebook.get_selected_index();
7 pos0 = IPython.notebook.get_selected_index();
8 IPython.utils.press(IPython.keycodes.b)
8 IPython.utils.press(IPython.keyboard.keycodes.b)
9 pos1 = IPython.notebook.get_selected_index();
9 pos1 = IPython.notebook.get_selected_index();
10 IPython.utils.press(IPython.keycodes.b)
10 IPython.utils.press(IPython.keyboard.keycodes.b)
11 pos2 = IPython.notebook.get_selected_index();
11 pos2 = IPython.notebook.get_selected_index();
12 // Simulate the "up arrow" and "down arrow" keys.
12 // Simulate the "up arrow" and "down arrow" keys.
13 IPython.utils.press_up();
13 IPython.utils.press_up();
14 pos3 = IPython.notebook.get_selected_index();
14 pos3 = IPython.notebook.get_selected_index();
15 IPython.utils.press_down();
15 IPython.utils.press_down();
16 pos4 = IPython.notebook.get_selected_index();
16 pos4 = IPython.notebook.get_selected_index();
17 return pos0 == 0 &&
17 return pos0 == 0 &&
18 pos1 == 1 &&
18 pos1 == 1 &&
19 pos2 == 2 &&
19 pos2 == 2 &&
20 pos3 == 1 &&
20 pos3 == 1 &&
21 pos4 == 2;
21 pos4 == 2;
22 });
22 });
23 this.test.assertTrue(result, 'Up/down arrow okay in non-empty notebook.');
23 this.test.assertTrue(result, 'Up/down arrow okay in non-empty notebook.');
24 });
24 });
@@ -1,38 +1,38 b''
1 //
1 //
2 // Test merging two notebook cells.
2 // Test merging two notebook cells.
3 //
3 //
4 casper.notebook_test(function() {
4 casper.notebook_test(function() {
5 var output = this.evaluate(function () {
5 var output = this.evaluate(function () {
6 // Fill in test data.
6 // Fill in test data.
7 IPython.notebook.command_mode();
7 IPython.notebook.command_mode();
8 var set_cell_text = function () {
8 var set_cell_text = function () {
9 var cell_one = IPython.notebook.get_selected_cell();
9 var cell_one = IPython.notebook.get_selected_cell();
10 cell_one.set_text('a = 5');
10 cell_one.set_text('a = 5');
11
11
12 IPython.utils.press(IPython.keycodes.b)
12 IPython.utils.press(IPython.keyboard.keycodes.b)
13 var cell_two = IPython.notebook.get_selected_cell();
13 var cell_two = IPython.notebook.get_selected_cell();
14 cell_two.set_text('print(a)');
14 cell_two.set_text('print(a)');
15 };
15 };
16
16
17 // merge_cell_above()
17 // merge_cell_above()
18 set_cell_text();
18 set_cell_text();
19 IPython.notebook.merge_cell_above();
19 IPython.notebook.merge_cell_above();
20 var merged_above = IPython.notebook.get_selected_cell();
20 var merged_above = IPython.notebook.get_selected_cell();
21
21
22 // merge_cell_below()
22 // merge_cell_below()
23 set_cell_text();
23 set_cell_text();
24 IPython.notebook.select(0);
24 IPython.notebook.select(0);
25 IPython.notebook.merge_cell_below();
25 IPython.notebook.merge_cell_below();
26 var merged_below = IPython.notebook.get_selected_cell();
26 var merged_below = IPython.notebook.get_selected_cell();
27
27
28 return {
28 return {
29 above: merged_above.get_text(),
29 above: merged_above.get_text(),
30 below: merged_below.get_text()
30 below: merged_below.get_text()
31 };
31 };
32 });
32 });
33
33
34 this.test.assertEquals(output.above, 'a = 5\nprint(a)',
34 this.test.assertEquals(output.above, 'a = 5\nprint(a)',
35 'Successful merge_cell_above().');
35 'Successful merge_cell_above().');
36 this.test.assertEquals(output.below, 'a = 5\nprint(a)',
36 this.test.assertEquals(output.below, 'a = 5\nprint(a)',
37 'Successful merge_cell_below().');
37 'Successful merge_cell_below().');
38 });
38 });
General Comments 0
You need to be logged in to leave comments. Login now