|
|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
//
|
|
|
|
|
// Test svg isolation
|
|
|
|
|
// Test display isolation
|
|
|
|
|
// An object whose metadata contains an "isolated" tag must be isolated
|
|
|
|
|
// from the rest of the document. In the case of inline SVGs, this means
|
|
|
|
|
// that multiple SVGs have different scopes. This test checks that there
|
|
|
|
|
@ -39,4 +39,30 @@ casper.notebook_test(function () {
|
|
|
|
|
this.test.assertEquals(colors[0], '#ff0000', 'First svg should be red');
|
|
|
|
|
this.test.assertEquals(colors[1], '#000000', 'Second svg should be black');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// now ensure that we can pass the same metadata dict to plain old display()
|
|
|
|
|
this.thenEvaluate(function () {
|
|
|
|
|
var cell = IPython.notebook.get_cell(0);
|
|
|
|
|
cell.set_text( "from IPython.display import display\n"
|
|
|
|
|
+ "display(SVG(s1), metadata=dict(isolated=True))\n"
|
|
|
|
|
+ "display(SVG(s2), metadata=dict(isolated=True))\n"
|
|
|
|
|
);
|
|
|
|
|
cell.execute();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// same test as original
|
|
|
|
|
this.then(function () {
|
|
|
|
|
var colors = this.evaluate(function () {
|
|
|
|
|
var colors = [];
|
|
|
|
|
var ifr = __utils__.findAll("iframe");
|
|
|
|
|
var svg1 = ifr[0].contentWindow.document.getElementById('r1');
|
|
|
|
|
colors[0] = window.getComputedStyle(svg1)["fill"];
|
|
|
|
|
var svg2 = ifr[1].contentWindow.document.getElementById('r2');
|
|
|
|
|
colors[1] = window.getComputedStyle(svg2)["fill"];
|
|
|
|
|
return colors;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.test.assertEquals(colors[0], '#ff0000', 'First svg should be red');
|
|
|
|
|
this.test.assertEquals(colors[1], '#000000', 'Second svg should be black');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|