Show More
@@ -269,8 +269,8 b' casper.notebook_test(function () {' | |||||
269 | this.select_cell(0); |
|
269 | this.select_cell(0); | |
270 | this.trigger_keydown('a', 'enter'); // Create cell above and enter edit mode. |
|
270 | this.trigger_keydown('a', 'enter'); // Create cell above and enter edit mode. | |
271 | this.validate_state('a, enter', 'edit', 0); |
|
271 | this.validate_state('a, enter', 'edit', 0); | |
272 | this.trigger_keydown('a', 'b', 'c', 'd', 'left', 'left'); // Type 'abcd' and place the cursor in the middle. |
|
272 | this.set_cell_text(0, 'abcd'); | |
273 | this.validate_state('a, enter', 'edit', 0); |
|
273 | this.set_cell_editor_cursor(0, 0, 2); | |
274 | this.test.assertEquals(this.get_cell_text(0), 'abcd', 'Verify that cell 0 has the new contents.'); |
|
274 | this.test.assertEquals(this.get_cell_text(0), 'abcd', 'Verify that cell 0 has the new contents.'); | |
275 | this.trigger_keydown('alt+-'); // Split |
|
275 | this.trigger_keydown('alt+-'); // Split | |
276 | this.test.assertEquals(this.get_cell_text(0), 'ab', 'split; Verify that cell 0 has the first half.'); |
|
276 | this.test.assertEquals(this.get_cell_text(0), 'ab', 'split; Verify that cell 0 has the first half.'); |
@@ -246,12 +246,19 b' casper.click_cell_editor = function(index) {' | |||||
246 | // the code used in Code Mirror that handles the mousedown event on a |
|
246 | // the code used in Code Mirror that handles the mousedown event on a | |
247 | // region of codemirror that the user can focus. |
|
247 | // region of codemirror that the user can focus. | |
248 | this.evaluate(function (i) { |
|
248 | this.evaluate(function (i) { | |
249 | cm = IPython.notebook.get_cell(i).code_mirror; |
|
249 | var cm = IPython.notebook.get_cell(i).code_mirror; | |
250 | if (cm.options.readOnly != "nocursor" && (document.activeElement != cm.display.input)) |
|
250 | if (cm.options.readOnly != "nocursor" && (document.activeElement != cm.display.input)) | |
251 | cm.display.input.focus(); |
|
251 | cm.display.input.focus(); | |
252 | }, {i: index}); |
|
252 | }, {i: index}); | |
253 | }; |
|
253 | }; | |
254 |
|
254 | |||
|
255 | casper.set_cell_editor_cursor = function(index, line_index, char_index) { | |||
|
256 | // Set the Code Mirror instance cursor's location. | |||
|
257 | this.evaluate(function (i, l, c) { | |||
|
258 | IPython.notebook.get_cell(i).code_mirror.setCursor(l, c); | |||
|
259 | }, {i: index, l: line_index, c: char_index}); | |||
|
260 | }; | |||
|
261 | ||||
255 | casper.focus_notebook = function() { |
|
262 | casper.focus_notebook = function() { | |
256 | this.evaluate(function (){ |
|
263 | this.evaluate(function (){ | |
257 | $('#notebook').focus(); |
|
264 | $('#notebook').focus(); |
General Comments 0
You need to be logged in to leave comments.
Login now