diff --git a/IPython/html/static/notebook/js/outputarea.js b/IPython/html/static/notebook/js/outputarea.js index 5d1d470bf..87c7eeb31 100644 --- a/IPython/html/static/notebook/js/outputarea.js +++ b/IPython/html/static/notebook/js/outputarea.js @@ -254,6 +254,9 @@ var IPython = (function (IPython) { this.append_output(json, true); }; + var mime_types = ['application/javascript', 'application/json', + 'image/jpeg', 'image/png', 'image/svg+xml', 'text/html', + 'text/latex', 'text/plain']; OutputArea.prototype.convert_mime_types = function (json, data) { if (data === undefined) { @@ -283,6 +286,13 @@ var IPython = (function (IPython) { if (data['application/javascript'] !== undefined) { json.javascript = data['application/javascript']; } + // non-mimetype-keyed metadata used to get dropped here, this code + // re-injects it into the json. + for (x in data){ + if( !(x in mime_types) ) { + json[x] = data[x]; + } + } return json; }; diff --git a/IPython/html/tests/casperjs/test_cases/isolated_svg.js b/IPython/html/tests/casperjs/test_cases/isolated_svg.js index d248a3518..0e2aa7a00 100644 --- a/IPython/html/tests/casperjs/test_cases/isolated_svg.js +++ b/IPython/html/tests/casperjs/test_cases/isolated_svg.js @@ -21,6 +21,32 @@ casper.notebook_test(function () { + "display_svg(SVG(s2), metadata=dict(isolated=True))\n" ); cell.execute(); + console.log("hello" ); + }); + + this.then(function() { + var fname=this.test.currentTestFile.split('/').pop().toLowerCase(); + this.echo(fname) + this.echo(this.currentUrl) + this.evaluate(function (n) { + IPython.notebook.rename(n); + console.write("hello" + n); + IPython.notebook.save_notebook(); + }, {n : fname}); + this.echo(this.currentUrl) + }); + + this.then(function() { + + url = this.evaluate(function() { + IPython.notebook.rename("foo"); + //$("span#notebook_name")[0].click(); + //$("input")[0].value = "please-work"; + //$(".btn-primary")[0].click(); + return document.location.href; + }) + this.echo("renamed" + url); + this.echo(this.currentUrl); }); this.wait_for_output(0);