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