##// END OF EJS Templates
added test for display() calls with metadata...
Paul Ivanov -
Show More
@@ -1,5 +1,5 b''
1 //
1 //
2 // Test svg isolation
2 // Test display isolation
3 // An object whose metadata contains an "isolated" tag must be isolated
3 // An object whose metadata contains an "isolated" tag must be isolated
4 // from the rest of the document. In the case of inline SVGs, this means
4 // from the rest of the document. In the case of inline SVGs, this means
5 // that multiple SVGs have different scopes. This test checks that there
5 // that multiple SVGs have different scopes. This test checks that there
@@ -39,4 +39,30 b' casper.notebook_test(function () {'
39 this.test.assertEquals(colors[0], '#ff0000', 'First svg should be red');
39 this.test.assertEquals(colors[0], '#ff0000', 'First svg should be red');
40 this.test.assertEquals(colors[1], '#000000', 'Second svg should be black');
40 this.test.assertEquals(colors[1], '#000000', 'Second svg should be black');
41 });
41 });
42
43 // now ensure that we can pass the same metadata dict to plain old display()
44 this.thenEvaluate(function () {
45 var cell = IPython.notebook.get_cell(0);
46 cell.set_text( "from IPython.display import display\n"
47 + "display(SVG(s1), metadata=dict(isolated=True))\n"
48 + "display(SVG(s2), metadata=dict(isolated=True))\n"
49 );
50 cell.execute();
51 });
52
53 // same test as original
54 this.then(function () {
55 var colors = this.evaluate(function () {
56 var colors = [];
57 var ifr = __utils__.findAll("iframe");
58 var svg1 = ifr[0].contentWindow.document.getElementById('r1');
59 colors[0] = window.getComputedStyle(svg1)["fill"];
60 var svg2 = ifr[1].contentWindow.document.getElementById('r2');
61 colors[1] = window.getComputedStyle(svg2)["fill"];
62 return colors;
63 });
64
65 this.test.assertEquals(colors[0], '#ff0000', 'First svg should be red');
66 this.test.assertEquals(colors[1], '#000000', 'Second svg should be black');
67 });
42 });
68 });
General Comments 0
You need to be logged in to leave comments. Login now