Show More
@@ -2,22 +2,23 | |||||
2 | // Check for errors with up and down arrow presses in a non-empty notebook. |
|
2 | // Check for errors with up and down arrow presses in a non-empty notebook. | |
3 | // |
|
3 | // | |
4 | casper.notebook_test(function () { |
|
4 | casper.notebook_test(function () { | |
5 |
this.t |
|
5 | var result = this.evaluate(function() { | |
6 | var result = this.evaluate(function() { |
|
6 | IPython.notebook.command_mode(); | |
7 |
|
|
7 | pos0 = IPython.notebook.get_selected_index(); | |
8 | pos0 = IPython.notebook.get_selected_index(); |
|
8 | IPython.keyboard.trigger_keydown('b'); | |
9 |
|
|
9 | pos1 = IPython.notebook.get_selected_index(); | |
10 | pos1 = IPython.notebook.get_selected_index(); |
|
10 | IPython.keyboard.trigger_keydown('b'); | |
11 |
|
|
11 | pos2 = IPython.notebook.get_selected_index(); | |
12 | pos2 = IPython.notebook.get_selected_index(); |
|
12 | // Simulate the "up arrow" and "down arrow" keys. | |
13 | // Simulate the "up arrow" and "down arrow" keys. |
|
13 | IPython.keyboard.trigger_keydown('up'); | |
14 | IPython.keyboard.trigger_keydown('up'); |
|
14 | pos3 = IPython.notebook.get_selected_index(); | |
15 | pos3 = IPython.notebook.get_selected_index(); |
|
15 | IPython.keyboard.trigger_keydown('down'); | |
16 | IPython.keyboard.trigger_keydown('down'); |
|
16 | pos4 = IPython.notebook.get_selected_index(); | |
17 | pos4 = IPython.notebook.get_selected_index(); |
|
17 | return pos0 == 0 && | |
18 | return [pos0, pos1, pos2, pos3, pos4]; |
|
18 | pos1 == 1 && | |
19 | }); |
|
19 | pos2 == 2 && | |
20 | this.test.assertEquals(result, [0, 1, 2, 1, 2], 'Up/down arrow okay in non-empty notebook.'); |
|
20 | pos3 == 1 && | |
|
21 | pos4 == 2; | |||
21 | }); |
|
22 | }); | |
22 |
|
23 | this.test.assertTrue(result, 'Up/down arrow okay in non-empty notebook.'); | ||
23 |
}); |
|
24 | }); No newline at end of file |
@@ -25,8 +25,8 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] |
|
28 | this.test.assertEquals(messages[messages.length-1], "Invalid type for image/png 5", "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 | }); | |
32 |
}); |
|
32 | }); No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now