##// END OF EJS Templates
Re-added new lines at eof
Jonathan Frederic -
Show More
@@ -1,24 +1,24 b''
1 //
1 //
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 var result = this.evaluate(function() {
5 var result = this.evaluate(function() {
6 IPython.notebook.command_mode();
6 IPython.notebook.command_mode();
7 pos0 = IPython.notebook.get_selected_index();
7 pos0 = IPython.notebook.get_selected_index();
8 IPython.keyboard.trigger_keydown('b');
8 IPython.keyboard.trigger_keydown('b');
9 pos1 = IPython.notebook.get_selected_index();
9 pos1 = IPython.notebook.get_selected_index();
10 IPython.keyboard.trigger_keydown('b');
10 IPython.keyboard.trigger_keydown('b');
11 pos2 = IPython.notebook.get_selected_index();
11 pos2 = IPython.notebook.get_selected_index();
12 // Simulate the "up arrow" and "down arrow" keys.
12 // Simulate the "up arrow" and "down arrow" keys.
13 IPython.keyboard.trigger_keydown('up');
13 IPython.keyboard.trigger_keydown('up');
14 pos3 = IPython.notebook.get_selected_index();
14 pos3 = IPython.notebook.get_selected_index();
15 IPython.keyboard.trigger_keydown('down');
15 IPython.keyboard.trigger_keydown('down');
16 pos4 = IPython.notebook.get_selected_index();
16 pos4 = IPython.notebook.get_selected_index();
17 return pos0 == 0 &&
17 return pos0 == 0 &&
18 pos1 == 1 &&
18 pos1 == 1 &&
19 pos2 == 2 &&
19 pos2 == 2 &&
20 pos3 == 1 &&
20 pos3 == 1 &&
21 pos4 == 2;
21 pos4 == 2;
22 });
22 });
23 this.test.assertTrue(result, 'Up/down arrow okay in non-empty notebook.');
23 this.test.assertTrue(result, 'Up/down arrow okay in non-empty notebook.');
24 }); No newline at end of file
24 });
@@ -1,32 +1,32 b''
1 //
1 //
2 // Test validation in append_output
2 // Test validation in append_output
3 //
3 //
4 // Invalid output data is stripped and logged.
4 // Invalid output data is stripped and logged.
5 //
5 //
6
6
7 casper.notebook_test(function () {
7 casper.notebook_test(function () {
8 // this.printLog();
8 // this.printLog();
9 var messages = [];
9 var messages = [];
10 this.on('remote.message', function (msg) {
10 this.on('remote.message', function (msg) {
11 messages.push(msg);
11 messages.push(msg);
12 });
12 });
13
13
14 this.evaluate(function () {
14 this.evaluate(function () {
15 var cell = IPython.notebook.get_cell(0);
15 var cell = IPython.notebook.get_cell(0);
16 cell.set_text( "dp = get_ipython().display_pub\n" +
16 cell.set_text( "dp = get_ipython().display_pub\n" +
17 "dp.publish('test', {'text/plain' : '5', 'image/png' : 5})"
17 "dp.publish('test', {'text/plain' : '5', 'image/png' : 5})"
18 );
18 );
19 cell.execute();
19 cell.execute();
20 });
20 });
21
21
22 this.wait_for_output(0);
22 this.wait_for_output(0);
23 this.on('remote.message', function () {});
23 this.on('remote.message', function () {});
24
24
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 5", "Logged Invalid type message");
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 }); No newline at end of file
32 });
General Comments 0
You need to be logged in to leave comments. Login now