##// END OF EJS Templates
cutcopyandpaste
Jonathan Frederic -
Show More
@@ -229,17 +229,42 b' casper.notebook_test(function () {'
229 this.test.assertEquals(this.get_cell_text(3), '', 'b; New cell 3 text is empty');
229 this.test.assertEquals(this.get_cell_text(3), '', 'b; New cell 3 text is empty');
230 this.validate_state('b', 'command', 3);
230 this.validate_state('b', 'command', 3);
231
231
232 // Copy/past/cut
232 // Copy/paste/cut
233 var num_cells = this.get_cells_length();
233 var num_cells = this.get_cells_length();
234 this.test.assertEquals(this.get_cell_text(1), a, 'Verify that cell 1 is a');
234 this.test.assertEquals(this.get_cell_text(1), a, 'Verify that cell 1 is a');
235 this.select_cell(1);
235 this.select_cell(1);
236 this.trigger_keydown('x'); // Cut
236 this.trigger_keydown('x'); // Cut
237 this.validate_state('x', 'command', 1);
237 this.validate_state('x', 'command', 1);
238 this.test.assertEquals(this.get_cells_length(), num_cells-1, 'Verify that the cell was removed.');
238 this.test.assertEquals(this.get_cells_length(), num_cells-1, 'Verify that a cell was removed.');
239 this.test.assertEquals(this.get_cell_text(1), '', 'Verify that cell 2 is now where cell 1 was.');
239 this.test.assertEquals(this.get_cell_text(1), '', 'Verify that cell 2 is now where cell 1 was.');
240 this.select_cell(2);
240 this.select_cell(2);
241 this.trigger_keydown('v'); // Paste
241 this.trigger_keydown('v'); // Paste
242 this.validate_state('v', 'command', 3);
242 this.validate_state('v', 'command', 3); // Selection should move to pasted cell, below current cell.
243 this.test.assertEquals(this.get_cell_text(3), a, 'Verify that cell 3 has the cut contents.');
244 this.test.assertEquals(this.get_cells_length(), num_cells, 'Verify a the cell was added.');
245 this.trigger_keydown('v'); // Paste
246 this.validate_state('v', 'command', 4); // Selection should move to pasted cell, below current cell.
247 this.test.assertEquals(this.get_cell_text(4), a, 'Verify that cell 4 has the cut contents.');
248 this.test.assertEquals(this.get_cells_length(), num_cells+1, 'Verify a the cell was added.');
249 this.select_cell(5);
250 this.trigger_keydown('c'); // Copy
251 this.validate_state('c', 'command', 5);
252 this.test.assertEquals(this.get_cell_text(5), b, 'Verify that cell 5 is b');
253 this.select_cell(6);
254 this.trigger_keydown('c'); // Copy
255 this.validate_state('c', 'command', 6);
256 this.test.assertEquals(this.get_cell_text(6), c, 'Verify that cell 6 is c');
257 this.trigger_keydown('v'); // Paste
258 this.validate_state('v', 'command', 7);
259 this.test.assertEquals(this.get_cell_text(6), c, 'Verify that cell 6 still has the copied contents.');
260 this.test.assertEquals(this.get_cell_text(7), c, 'Verify that cell 7 has the copied contents.');
261 this.test.assertEquals(this.get_cells_length(), num_cells+2, 'Verify a the cell was added.');
262 this.select_cell(0);
263 this.trigger_keydown('shift+v'); // Paste
264 this.validate_state('shift+v', 'command', 0);
265 this.test.assertEquals(this.get_cell_text(0), c, 'Verify that cell 0 has the copied contents.');
266 this.test.assertEquals(this.get_cells_length(), num_cells+3, 'Verify a the cell was added.');
267
243
268
244 });
269 });
245
270
General Comments 0
You need to be logged in to leave comments. Login now