Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c70aa94

Browse filesBrowse files
committed
add geo toggle trace tests
1 parent 329a1db commit c70aa94
Copy full SHA for c70aa94

File tree

Expand file treeCollapse file tree

1 file changed

+38
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+38
-0
lines changed

‎test/jasmine/tests/geo_interact_test.js

Copy file name to clipboardExpand all lines: test/jasmine/tests/geo_interact_test.js
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,43 @@ describe('Test geo interactions', function() {
180180
});
181181
});
182182

183+
describe('trace visibility toggle', function() {
184+
function countTraces(type) {
185+
return d3.selectAll('g.trace.' + type).size();
186+
}
187+
188+
it('should toggle scattergeo elements', function(done) {
189+
expect(countTraces('scattergeo')).toBe(1);
190+
expect(countTraces('choropleth')).toBe(1);
191+
192+
Plotly.restyle(gd, 'visible', false, [0]).then(function() {
193+
expect(countTraces('scattergeo')).toBe(0);
194+
expect(countTraces('choropleth')).toBe(1);
195+
196+
Plotly.restyle(gd, 'visible', true, [0]).then(function() {
197+
expect(countTraces('scattergeo')).toBe(1);
198+
expect(countTraces('choropleth')).toBe(1);
199+
done();
200+
});
201+
});
202+
});
203+
204+
it('should toggle choropleth elements', function(done) {
205+
expect(countTraces('scattergeo')).toBe(1);
206+
expect(countTraces('choropleth')).toBe(1);
207+
208+
Plotly.restyle(gd, 'visible', false, [1]).then(function() {
209+
expect(countTraces('scattergeo')).toBe(1);
210+
expect(countTraces('choropleth')).toBe(0);
211+
212+
Plotly.restyle(gd, 'visible', true, [1]).then(function() {
213+
expect(countTraces('scattergeo')).toBe(1);
214+
expect(countTraces('choropleth')).toBe(1);
215+
done();
216+
});
217+
});
218+
});
219+
220+
});
183221
});
184222
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.