From 035fc91fa93ce1cddadb13afebb09335922067f5 Mon Sep 17 00:00:00 2001 From: Min RK Date: Fri, 13 Jan 2017 15:18:19 +0100 Subject: [PATCH] test runtime-loading of modules verify that runtime-required modules are the same as those used to build the classes (this is the primary motivator for the rollback of webpack) --- notebook/tests/base/misc.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/notebook/tests/base/misc.js b/notebook/tests/base/misc.js index 311566c94..3af58f86f 100644 --- a/notebook/tests/base/misc.js +++ b/notebook/tests/base/misc.js @@ -17,5 +17,29 @@ casper.notebook_test(function () { var result = this.get_output_cell(0); this.test.assertEquals(result.text.trim(), jsver, 'IPython.version in JS matches server-side.'); }); + + // verify that requirejs loads the same CodeCell prototype at runtime as build time + this.thenEvaluate(function () { + require(['notebook/js/codecell'], function (codecell) { + codecell.CodeCell.prototype.test = function () { + return 'ok'; + } + window._waitForMe = true; + }) + }) + + this.waitFor(function () { + return this.evaluate(function () { + return window._waitForMe; + }); + }) + + this.then(function () { + var result = this.evaluate(function () { + var cell = Jupyter.notebook.get_cell(0); + return cell.test(); + }); + this.test.assertEquals(result, 'ok', "runtime-requirejs loads the same modules") + }) });