##// END OF EJS Templates
Moved is_cell_rendered into base
Jonathan Frederic -
Show More
@@ -1,12 +1,6
1
1
2 // Test
2 // Test
3 casper.notebook_test(function () {
3 casper.notebook_test(function () {
4 this.is_rendered = function(i) {
5 return this.evaluate(function(i) {
6 return !!IPython.notebook.get_cell(i).rendered;
7 }, {i:i});
8 };
9
10 var a = 'print("a")';
4 var a = 'print("a")';
11 var index = this.append_cell(a);
5 var index = this.append_cell(a);
12 this.execute_cell_then(index, function(index) {
6 this.execute_cell_then(index, function(index) {
@@ -15,29 +9,29 casper.notebook_test(function () {
15 this.validate_notebook_state('select ' + index, 'command', index);
9 this.validate_notebook_state('select ' + index, 'command', index);
16 this.trigger_keydown('m');
10 this.trigger_keydown('m');
17 this.test.assertEquals(this.get_cell(index).cell_type, 'markdown', 'm; cell is markdown');
11 this.test.assertEquals(this.get_cell(index).cell_type, 'markdown', 'm; cell is markdown');
18 this.test.assert(!this.is_rendered(index), 'm; cell is unrendered');
12 this.test.assert(!this.is_cell_rendered(index), 'm; cell is unrendered');
19 this.trigger_keydown('enter');
13 this.trigger_keydown('enter');
20 this.test.assert(!this.is_rendered(index), 'enter; cell is unrendered');
14 this.test.assert(!this.is_cell_rendered(index), 'enter; cell is unrendered');
21 this.validate_notebook_state('enter', 'edit', index);
15 this.validate_notebook_state('enter', 'edit', index);
22 this.trigger_keydown('ctrl-enter');
16 this.trigger_keydown('ctrl-enter');
23 this.test.assert(this.is_rendered(index), 'ctrl-enter; cell is rendered');
17 this.test.assert(this.is_cell_rendered(index), 'ctrl-enter; cell is rendered');
24 this.validate_notebook_state('enter', 'command', index);
18 this.validate_notebook_state('enter', 'command', index);
25 this.trigger_keydown('enter');
19 this.trigger_keydown('enter');
26 this.test.assert(!this.is_rendered(index), 'enter; cell is unrendered');
20 this.test.assert(!this.is_cell_rendered(index), 'enter; cell is unrendered');
27 this.select_cell(index-1);
21 this.select_cell(index-1);
28 this.test.assert(!this.is_rendered(index), 'select ' + (index-1) + '; cell ' + index + ' is still unrendered');
22 this.test.assert(!this.is_cell_rendered(index), 'select ' + (index-1) + '; cell ' + index + ' is still unrendered');
29 this.validate_notebook_state('select ' + (index-1), 'command', index-1);
23 this.validate_notebook_state('select ' + (index-1), 'command', index-1);
30 this.select_cell(index);
24 this.select_cell(index);
31 this.validate_notebook_state('select ' + index, 'command', index);
25 this.validate_notebook_state('select ' + index, 'command', index);
32 this.trigger_keydown('ctrl-enter');
26 this.trigger_keydown('ctrl-enter');
33 this.test.assert(this.is_rendered(index), 'ctrl-enter; cell is rendered');
27 this.test.assert(this.is_cell_rendered(index), 'ctrl-enter; cell is rendered');
34 this.select_cell(index-1);
28 this.select_cell(index-1);
35 this.validate_notebook_state('select ' + (index-1), 'command', index-1);
29 this.validate_notebook_state('select ' + (index-1), 'command', index-1);
36 this.trigger_keydown('shift-enter');
30 this.trigger_keydown('shift-enter');
37 this.validate_notebook_state('shift-enter', 'command', index);
31 this.validate_notebook_state('shift-enter', 'command', index);
38 this.test.assert(this.is_rendered(index), 'shift-enter; cell is rendered');
32 this.test.assert(this.is_cell_rendered(index), 'shift-enter; cell is rendered');
39 this.trigger_keydown('shift-enter'); // Creates one cell
33 this.trigger_keydown('shift-enter'); // Creates one cell
40 this.validate_notebook_state('shift-enter', 'edit', index+1);
34 this.validate_notebook_state('shift-enter', 'edit', index+1);
41 this.test.assert(this.is_rendered(index), 'shift-enter; cell is rendered');
35 this.test.assert(this.is_cell_rendered(index), 'shift-enter; cell is rendered');
42 });
36 });
43 }); No newline at end of file
37 });
@@ -417,6 +417,12 casper.cell_has_class = function(index, classes) {
417 }, {i : index, c: classes});
417 }, {i : index, c: classes});
418 };
418 };
419
419
420 casper.is_cell_rendered = function (index, msg) {
421 return this.evaluate(function(i) {
422 return !!IPython.notebook.get_cell(i).rendered;
423 }, {i:i});
424 };
425
420 casper.assert_colors_equal = function (hex_color, local_color, msg) {
426 casper.assert_colors_equal = function (hex_color, local_color, msg) {
421 // Tests to see if two colors are equal.
427 // Tests to see if two colors are equal.
422 //
428 //
General Comments 0
You need to be logged in to leave comments. Login now