Skip to content

Commit b9f4160

Browse files
committed
move clip paths tests to plot_interact suite:
- for some reason the click paths tests were messing the state in such a way to make a double-click test fail (in click_test.js) on the CircleCI FF38. - by moving those tests to plot_interact (as 'p' > 'c'), the problem is put to the side.
1 parent e80602f commit b9f4160

File tree

2 files changed

+70
-70
lines changed

2 files changed

+70
-70
lines changed

test/jasmine/tests/cartesian_test.js

-70
Original file line numberDiff line numberDiff line change
@@ -49,73 +49,3 @@ describe('zoom box element', function() {
4949
.toEqual(0);
5050
});
5151
});
52-
53-
describe('plot svg clip paths', function() {
54-
55-
// plot with all features that rely on clip paths
56-
function plot() {
57-
return Plotly.plot(createGraphDiv(), [{
58-
type: 'contour',
59-
z: [[1,2,3], [2,3,1]]
60-
}, {
61-
type: 'scatter',
62-
y: [2, 1, 2]
63-
}], {
64-
showlegend: true,
65-
xaxis: {
66-
rangeslider: {}
67-
},
68-
shapes: [{
69-
xref: 'x',
70-
yref: 'y',
71-
x0: 0,
72-
y0: 0,
73-
x1: 3,
74-
y1: 3
75-
}]
76-
});
77-
}
78-
79-
afterEach(destroyGraphDiv);
80-
81-
it('should set clip path url to ids (base case)', function(done) {
82-
plot().then(function() {
83-
84-
d3.selectAll('[clip-path]').each(function() {
85-
var cp = d3.select(this).attr('clip-path');
86-
87-
expect(cp.substring(0, 5)).toEqual('url(#');
88-
expect(cp.substring(cp.length - 1)).toEqual(')');
89-
});
90-
91-
done();
92-
});
93-
});
94-
95-
it('should set clip path url to ids appended to window url', function(done) {
96-
97-
// this case occurs in some past versions of AngularJS
98-
// https://github.com/angular/angular.js/issues/8934
99-
100-
// append <base> with href
101-
var base = d3.select('body')
102-
.append('base')
103-
.attr('href', 'https://plot.ly');
104-
105-
// grab window URL
106-
var href = window.location.href;
107-
108-
plot().then(function() {
109-
110-
d3.selectAll('[clip-path]').each(function() {
111-
var cp = d3.select(this).attr('clip-path');
112-
113-
expect(cp.substring(0, 5 + href.length)).toEqual('url(' + href + '#');
114-
expect(cp.substring(cp.length - 1)).toEqual(')');
115-
});
116-
117-
base.remove();
118-
done();
119-
});
120-
});
121-
});

test/jasmine/tests/plot_interact_test.js

+70
Original file line numberDiff line numberDiff line change
@@ -436,3 +436,73 @@ describe('Test plot structure', function() {
436436
});
437437
});
438438
});
439+
440+
describe('plot svg clip paths', function() {
441+
442+
// plot with all features that rely on clip paths
443+
function plot() {
444+
return Plotly.plot(createGraphDiv(), [{
445+
type: 'contour',
446+
z: [[1,2,3], [2,3,1]]
447+
}, {
448+
type: 'scatter',
449+
y: [2, 1, 2]
450+
}], {
451+
showlegend: true,
452+
xaxis: {
453+
rangeslider: {}
454+
},
455+
shapes: [{
456+
xref: 'x',
457+
yref: 'y',
458+
x0: 0,
459+
y0: 0,
460+
x1: 3,
461+
y1: 3
462+
}]
463+
});
464+
}
465+
466+
afterEach(destroyGraphDiv);
467+
468+
it('should set clip path url to ids (base case)', function(done) {
469+
plot().then(function() {
470+
471+
d3.selectAll('[clip-path]').each(function() {
472+
var cp = d3.select(this).attr('clip-path');
473+
474+
expect(cp.substring(0, 5)).toEqual('url(#');
475+
expect(cp.substring(cp.length - 1)).toEqual(')');
476+
});
477+
478+
done();
479+
});
480+
});
481+
482+
it('should set clip path url to ids appended to window url', function(done) {
483+
484+
// this case occurs in some past versions of AngularJS
485+
// https://github.com/angular/angular.js/issues/8934
486+
487+
// append <base> with href
488+
var base = d3.select('body')
489+
.append('base')
490+
.attr('href', 'https://plot.ly');
491+
492+
// grab window URL
493+
var href = window.location.href;
494+
495+
plot().then(function() {
496+
497+
d3.selectAll('[clip-path]').each(function() {
498+
var cp = d3.select(this).attr('clip-path');
499+
500+
expect(cp.substring(0, 5 + href.length)).toEqual('url(' + href + '#');
501+
expect(cp.substring(cp.length - 1)).toEqual(')');
502+
});
503+
504+
base.remove();
505+
done();
506+
});
507+
});
508+
});

0 commit comments

Comments
 (0)