Test fixes

This commit is contained in:
Jonathan Frederic 2014-11-03 17:14:55 -08:00
parent bbcd5cb55f
commit 77789daa12

View File

@ -59,13 +59,27 @@ casper.notebook_test(function () {
JSON.stringify(input) + ' passed through Model._pack_model unchanged'); JSON.stringify(input) + ' passed through Model._pack_model unchanged');
}; };
var test_unpack = function (input) { var test_unpack = function (input) {
var output = that.evaluate(function(input) { that.thenEvaluate(function(input) {
window.results = undefined;
var model = new IPython.WidgetModel(IPython.notebook.kernel.widget_manager, undefined); var model = new IPython.WidgetModel(IPython.notebook.kernel.widget_manager, undefined);
var results = model._unpack_models(input); model._unpack_models(input).then(function(results) {
return results; window.results = results;
});
}, {input: input}); }, {input: input});
that.test.assert(recursive_compare(input, output),
JSON.stringify(input) + ' passed through Model._unpack_model unchanged'); that.waitFor(function check() {
return that.evaluate(function() {
return window.results;
});
});
that.then(function() {
var results = that.evaluate(function() {
return window.results;
});
that.test.assert(recursive_compare(input, results),
JSON.stringify(input) + ' passed through Model._unpack_model unchanged');
});
}; };
var test_packing = function(input) { var test_packing = function(input) {
test_pack(input); test_pack(input);
@ -84,7 +98,7 @@ casper.notebook_test(function () {
test_packing([String('hi'), Date("Thu Nov 13 2014 13:46:21 GMT-0500")]) test_packing([String('hi'), Date("Thu Nov 13 2014 13:46:21 GMT-0500")])
// Test multi-set, single touch code. First create a custom widget. // Test multi-set, single touch code. First create a custom widget.
this.evaluate(function() { this.thenEvaluate(function() {
var MultiSetView = IPython.DOMWidgetView.extend({ var MultiSetView = IPython.DOMWidgetView.extend({
render: function(){ render: function(){
this.model.set('a', 1); this.model.set('a', 1);