Show More
@@ -1,39 +1,43 b'' | |||
|
1 | 1 | |
|
2 | 2 | // Test |
|
3 | 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 | ||
|
4 | 10 | var a = 'print("a")'; |
|
5 | 11 | var index = this.append_cell(a); |
|
6 |
this.execute_cell_then(index) |
|
|
7 | ||
|
8 | this.then(function () { | |
|
12 | this.execute_cell_then(index, function(index) { | |
|
9 | 13 | // Markdown rendering / unredering |
|
10 |
this.select_cell( |
|
|
11 |
this.validate_notebook_state('select |
|
|
14 | this.select_cell(index); | |
|
15 | this.validate_notebook_state('select ' + index, 'command', index); | |
|
12 | 16 | this.trigger_keydown('m'); |
|
13 |
this.test.assertEquals(this.get_cell( |
|
|
14 |
this.test.assert |
|
|
17 | 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'); | |
|
15 | 19 | this.trigger_keydown('enter'); |
|
16 |
this.test.assert |
|
|
17 |
this.validate_notebook_state('enter', 'edit', |
|
|
20 | this.test.assert(!this.is_rendered(index), 'enter; cell is unrendered'); | |
|
21 | this.validate_notebook_state('enter', 'edit', index); | |
|
18 | 22 | this.trigger_keydown('ctrl-enter'); |
|
19 |
this.test.assert |
|
|
20 |
this.validate_notebook_state('enter', 'command', |
|
|
23 | this.test.assert(this.is_rendered(index), 'ctrl-enter; cell is rendered'); | |
|
24 | this.validate_notebook_state('enter', 'command', index); | |
|
21 | 25 | this.trigger_keydown('enter'); |
|
22 |
this.test.assert |
|
|
23 |
this.select_cell( |
|
|
24 |
this.test.assert |
|
|
25 |
this.validate_notebook_state('select |
|
|
26 |
this.select_cell( |
|
|
27 |
this.validate_notebook_state('select |
|
|
26 | this.test.assert(!this.is_rendered(index), 'enter; cell is unrendered'); | |
|
27 | this.select_cell(index-1); | |
|
28 | this.test.assert(!this.is_rendered(index), 'select ' + (index-1) + '; cell ' + index + ' is still unrendered'); | |
|
29 | this.validate_notebook_state('select ' + (index-1), 'command', index-1); | |
|
30 | this.select_cell(index); | |
|
31 | this.validate_notebook_state('select ' + index, 'command', index); | |
|
28 | 32 | this.trigger_keydown('ctrl-enter'); |
|
29 |
this.test.assert |
|
|
30 |
this.select_cell( |
|
|
31 |
this.validate_notebook_state('select |
|
|
33 | this.test.assert(this.is_rendered(index), 'ctrl-enter; cell is rendered'); | |
|
34 | this.select_cell(index-1); | |
|
35 | this.validate_notebook_state('select ' + (index-1), 'command', index-1); | |
|
32 | 36 | this.trigger_keydown('shift-enter'); |
|
33 |
this.validate_notebook_state('shift-enter', 'command', |
|
|
34 |
this.test.assert |
|
|
37 | this.validate_notebook_state('shift-enter', 'command', index); | |
|
38 | this.test.assert(this.is_rendered(index), 'shift-enter; cell is rendered'); | |
|
35 | 39 | this.trigger_keydown('shift-enter'); // Creates one cell |
|
36 |
this.validate_notebook_state('shift-enter', 'edit', |
|
|
37 |
this.test.assert |
|
|
40 | this.validate_notebook_state('shift-enter', 'edit', index+1); | |
|
41 | this.test.assert(this.is_rendered(index), 'shift-enter; cell is rendered'); | |
|
38 | 42 | }); |
|
39 | 43 | }); No newline at end of file |
@@ -25,7 +25,7 b' casper.notebook_test(function () {' | |||
|
25 | 25 | this.then(function () { |
|
26 | 26 | var output = this.get_output_cell(0); |
|
27 | 27 | this.test.assert(messages.length > 0, "Captured log message"); |
|
28 |
this.test.assertEquals(messages[messages.length-1], "Invalid type for image/png |
|
|
28 | this.test.assertEquals(messages[messages.length-1].substr(0,26), "Invalid type for image/png", "Logged Invalid type message"); | |
|
29 | 29 | this.test.assertEquals(output['image/png'], undefined, "Non-string png data was stripped"); |
|
30 | 30 | this.test.assertEquals(output['text/plain'], '5', "text data is fine"); |
|
31 | 31 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now