##// END OF EJS Templates
Fix race condition in javascript kernel message processing...
Fix race condition in javascript kernel message processing Because the binary messages are now deserialized using the asynchronous FileReader API, we need to have some way to force the messages to still be processed in the order they are received. This patch implements a simple processing queue using promises.

File last commit:

r18592:bbf8ee41
r20441:834cd9c4
Show More
safe_append_output.js
32 lines | 1.1 KiB | application/javascript | JavascriptLexer
/ IPython / html / tests / notebook / safe_append_output.js
MinRK
test append_output with invalid data
r14160 //
// Test validation in append_output
//
// Invalid output data is stripped and logged.
//
casper.notebook_test(function () {
// this.printLog();
var messages = [];
this.on('remote.message', function (msg) {
messages.push(msg);
});
this.evaluate(function () {
var cell = IPython.notebook.get_cell(0);
cell.set_text( "dp = get_ipython().display_pub\n" +
MinRK
fix safe_append_output test
r16590 "dp.publish({'text/plain' : '5', 'image/png' : 5})"
MinRK
test append_output with invalid data
r14160 );
cell.execute();
});
this.wait_for_output(0);
this.on('remote.message', function () {});
this.then(function () {
var output = this.get_output_cell(0);
this.test.assert(messages.length > 0, "Captured log message");
Jonathan Frederic
Make notebook tests play nicely with SlimerJS...
r16831 this.test.assertEquals(messages[messages.length-1].substr(0,26), "Invalid type for image/png", "Logged Invalid type message");
MinRK
output[mime/type] -> output.data[mime/type] in javascript
r18592 this.test.assertEquals(output.data['image/png'], undefined, "Non-string png data was stripped");
this.test.assertEquals(output.data['text/plain'], '5', "text data is fine");
MinRK
test append_output with invalid data
r14160 });
});