##// END OF EJS Templates
go to appropriate line when coming from another cell...
go to appropriate line when coming from another cell Sets the cursor on the last line of the cell when moved up from the top of the cell below, and sets the cursors to the first line when moving down from the bottom of a last line. Here, we retain the character that the cursor was on, so that users wishing to have up-down functionality like one document can still use this shortcut handler and simple adjust the at_top and at_bottom methods

File last commit:

r15619:957ea4d8
r15834:869e697c
Show More
merge_cells.js
38 lines | 1.3 KiB | application/javascript | JavascriptLexer
David Wyde
Add CasperJS tests for `merge_cell_above()` and `merge_cell_below()`.
r13256 //
// Test merging two notebook cells.
//
Paul Ivanov
pep8 style function names
r13275 casper.notebook_test(function() {
David Wyde
Add CasperJS tests for `merge_cell_above()` and `merge_cell_below()`.
r13256 var output = this.evaluate(function () {
// Fill in test data.
Brian E. Granger
Fixing more JS tests.
r14081 IPython.notebook.command_mode();
David Wyde
Add CasperJS tests for `merge_cell_above()` and `merge_cell_below()`.
r13256 var set_cell_text = function () {
var cell_one = IPython.notebook.get_selected_cell();
cell_one.set_text('a = 5');
Brian E. Granger
Removing old keyboard handling from IPython.utils.
r15619 IPython.keyboard.trigger_keydown('b');
David Wyde
Add CasperJS tests for `merge_cell_above()` and `merge_cell_below()`.
r13256 var cell_two = IPython.notebook.get_selected_cell();
Thomas Kluyver
Use Python 3 compatible syntax in tests
r13278 cell_two.set_text('print(a)');
David Wyde
Add CasperJS tests for `merge_cell_above()` and `merge_cell_below()`.
r13256 };
// merge_cell_above()
set_cell_text();
IPython.notebook.merge_cell_above();
var merged_above = IPython.notebook.get_selected_cell();
// merge_cell_below()
set_cell_text();
IPython.notebook.select(0);
IPython.notebook.merge_cell_below();
var merged_below = IPython.notebook.get_selected_cell();
return {
above: merged_above.get_text(),
below: merged_below.get_text()
};
});
Thomas Kluyver
Use Python 3 compatible syntax in tests
r13278 this.test.assertEquals(output.above, 'a = 5\nprint(a)',
Brian E. Granger
Fixing more JS tests.
r14081 'Successful merge_cell_above().');
Thomas Kluyver
Use Python 3 compatible syntax in tests
r13278 this.test.assertEquals(output.below, 'a = 5\nprint(a)',
Brian E. Granger
Fixing more JS tests.
r14081 'Successful merge_cell_below().');
David Wyde
Add CasperJS tests for `merge_cell_above()` and `merge_cell_below()`.
r13256 });