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