##// END OF EJS Templates
This feature was discussed in #6123, but it doesn't look like anything was ever incorporated into the IPython Notebook....
This feature was discussed in #6123, but it doesn't look like anything was ever incorporated into the IPython Notebook. Here's a brief overview of the changes: - Display of messages from other clients can be toggled on and off from within a notebook, either using the ``<M-m>e`` keyboard shortcut in the web UI, or through the option in the "Kernel" menu. - notebook.js controls whether messages are displayed through a callback that is invoked from kernel.js when no callbacks are available for a message. - The UI displays ``execute_input`` messages originating from an other clients in new cells at the end of the notebook. Output messages (``execute_result`` et al.) will only be displayed if a cell exists with a matching message ID. Pending design questions: - Should each ``execute_input`` message cause a new cell to be created? - Should new cells be placed at the end of the notebook, or elsewhere? If the latter, what criteria should be followed?

File last commit:

r15946:60417138
r19164:17ac8ca3
Show More
dualmode_clipboard.js
54 lines | 2.8 KiB | application/javascript | JavascriptLexer
// Test
casper.notebook_test(function () {
var a = 'print("a")';
var index = this.append_cell(a);
this.execute_cell_then(index);
var b = 'print("b")';
index = this.append_cell(b);
this.execute_cell_then(index);
var c = 'print("c")';
index = this.append_cell(c);
this.execute_cell_then(index);
this.then(function () {
// Copy/paste/cut
var num_cells = this.get_cells_length();
this.test.assertEquals(this.get_cell_text(1), a, 'Verify that cell 1 is a');
this.select_cell(1);
this.trigger_keydown('x'); // Cut
this.validate_notebook_state('x', 'command', 1);
this.test.assertEquals(this.get_cells_length(), num_cells-1, 'Verify that a cell was removed.');
this.test.assertEquals(this.get_cell_text(1), b, 'Verify that cell 2 is now where cell 1 was.');
this.select_cell(2);
this.trigger_keydown('v'); // Paste
this.validate_notebook_state('v', 'command', 3); // Selection should move to pasted cell, below current cell.
this.test.assertEquals(this.get_cell_text(3), a, 'Verify that cell 3 has the cut contents.');
this.test.assertEquals(this.get_cells_length(), num_cells, 'Verify a the cell was added.');
this.trigger_keydown('v'); // Paste
this.validate_notebook_state('v', 'command', 4); // Selection should move to pasted cell, below current cell.
this.test.assertEquals(this.get_cell_text(4), a, 'Verify that cell 4 has the cut contents.');
this.test.assertEquals(this.get_cells_length(), num_cells+1, 'Verify a the cell was added.');
this.select_cell(1);
this.trigger_keydown('c'); // Copy
this.validate_notebook_state('c', 'command', 1);
this.test.assertEquals(this.get_cell_text(1), b, 'Verify that cell 1 is b');
this.select_cell(2);
this.trigger_keydown('c'); // Copy
this.validate_notebook_state('c', 'command', 2);
this.test.assertEquals(this.get_cell_text(2), c, 'Verify that cell 2 is c');
this.select_cell(4);
this.trigger_keydown('v'); // Paste
this.validate_notebook_state('v', 'command', 5);
this.test.assertEquals(this.get_cell_text(2), c, 'Verify that cell 2 still has the copied contents.');
this.test.assertEquals(this.get_cell_text(5), c, 'Verify that cell 5 has the copied contents.');
this.test.assertEquals(this.get_cells_length(), num_cells+2, 'Verify a the cell was added.');
this.select_cell(0);
this.trigger_keydown('shift-v'); // Paste
this.validate_notebook_state('shift-v', 'command', 0);
this.test.assertEquals(this.get_cell_text(0), c, 'Verify that cell 0 has the copied contents.');
this.test.assertEquals(this.get_cells_length(), num_cells+3, 'Verify a the cell was added.');
});
});