From 77789daa122e9061c049a11dae94da7bca6fbc35 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Mon, 3 Nov 2014 17:14:55 -0800 Subject: [PATCH] Test fixes --- IPython/html/tests/widgets/widget.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/IPython/html/tests/widgets/widget.js b/IPython/html/tests/widgets/widget.js index e79a91544..d3c6b6d2a 100644 --- a/IPython/html/tests/widgets/widget.js +++ b/IPython/html/tests/widgets/widget.js @@ -59,13 +59,27 @@ casper.notebook_test(function () { JSON.stringify(input) + ' passed through Model._pack_model unchanged'); }; 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 results = model._unpack_models(input); - return results; + model._unpack_models(input).then(function(results) { + window.results = results; + }); }, {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) { 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 multi-set, single touch code. First create a custom widget. - this.evaluate(function() { + this.thenEvaluate(function() { var MultiSetView = IPython.DOMWidgetView.extend({ render: function(){ this.model.set('a', 1);