Show More
@@ -0,0 +1,37 b'' | |||||
|
1 | // | |||
|
2 | // Test merging two notebook cells. | |||
|
3 | // | |||
|
4 | casper.notebookTest(function() { | |||
|
5 | var output = this.evaluate(function () { | |||
|
6 | // Fill in test data. | |||
|
7 | var set_cell_text = function () { | |||
|
8 | var cell_one = IPython.notebook.get_selected_cell(); | |||
|
9 | cell_one.set_text('a = 5'); | |||
|
10 | ||||
|
11 | IPython.notebook.insert_cell_below('code'); | |||
|
12 | var cell_two = IPython.notebook.get_selected_cell(); | |||
|
13 | cell_two.set_text('print a'); | |||
|
14 | }; | |||
|
15 | ||||
|
16 | // merge_cell_above() | |||
|
17 | set_cell_text(); | |||
|
18 | IPython.notebook.merge_cell_above(); | |||
|
19 | var merged_above = IPython.notebook.get_selected_cell(); | |||
|
20 | ||||
|
21 | // merge_cell_below() | |||
|
22 | set_cell_text(); | |||
|
23 | IPython.notebook.select(0); | |||
|
24 | IPython.notebook.merge_cell_below(); | |||
|
25 | var merged_below = IPython.notebook.get_selected_cell(); | |||
|
26 | ||||
|
27 | return { | |||
|
28 | above: merged_above.get_text(), | |||
|
29 | below: merged_below.get_text() | |||
|
30 | }; | |||
|
31 | }); | |||
|
32 | ||||
|
33 | this.test.assertEquals(output.above, 'a = 5\nprint a', | |||
|
34 | 'Successful insert_cell_above().'); | |||
|
35 | this.test.assertEquals(output.below, 'a = 5\nprint a', | |||
|
36 | 'Successful insert_cell_below().'); | |||
|
37 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now