Skip to content

Commit 5dbf065

Browse files
committed
add svg/xlink namespace tests
1 parent 0a1cbaa commit 5dbf065

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

test/jasmine/tests/plot_interact_test.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ var destroyGraphDiv = require('../assets/destroy_graph_div');
99
describe('Test plot structure', function() {
1010
'use strict';
1111

12+
function assertNamespaces(node) {
13+
expect(node.getAttribute('xmlns'))
14+
.toEqual('http://www.w3.org/2000/svg');
15+
expect(node.getAttribute('xmlns:xlink'))
16+
.toEqual('http://www.w3.org/1999/xlink');
17+
}
18+
1219
afterEach(destroyGraphDiv);
1320

1421
describe('cartesian plots', function() {
@@ -44,6 +51,15 @@ describe('Test plot structure', function() {
4451

4552
expect(nodes.size()).toEqual(Npts);
4653
});
54+
55+
it('has the correct name spaces', function() {
56+
var mainSVGs = d3.selectAll('.main-svg');
57+
58+
mainSVGs.each(function() {
59+
var node = this;
60+
assertNamespaces(node);
61+
});
62+
});
4763
});
4864

4965
describe('pie traces', function() {
@@ -63,6 +79,18 @@ describe('Test plot structure', function() {
6379

6480
expect(nodes.size()).toEqual(Npts);
6581
});
82+
83+
it('has the correct name spaces', function() {
84+
var mainSVGs = d3.selectAll('.main-svg');
85+
86+
mainSVGs.each(function() {
87+
var node = this;
88+
assertNamespaces(node);
89+
});
90+
91+
var testerSVG = d3.selectAll('#js-plotly-tester');
92+
assertNamespaces(testerSVG.node());
93+
});
6694
});
6795
});
6896

@@ -96,6 +124,22 @@ describe('Test plot structure', function() {
96124

97125
expect(nodes.size()).toEqual(Npts);
98126
});
127+
128+
it('has the correct name spaces', function() {
129+
var mainSVGs = d3.selectAll('.main-svg');
130+
131+
mainSVGs.each(function() {
132+
var node = this;
133+
assertNamespaces(node);
134+
});
135+
136+
var geoSVGs = d3.select('#geo').selectAll('svg');
137+
138+
geoSVGs.each(function() {
139+
var node = this;
140+
assertNamespaces(node);
141+
});
142+
});
99143
});
100144

101145
describe('polar plots', function() {

0 commit comments

Comments
 (0)