mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Add only a single defs element to surface
This commit is contained in:
@@ -29,8 +29,12 @@ export function Layers(projection, context) {
|
||||
.attr('class', 'surface')
|
||||
.merge(svg);
|
||||
|
||||
svg
|
||||
.append('defs');
|
||||
var defs = svg.selectAll('.surface-defs')
|
||||
.data([0]);
|
||||
|
||||
defs.enter()
|
||||
.append('defs')
|
||||
.attr('class', 'surface-defs');
|
||||
|
||||
var groups = svg.selectAll('.data-layer')
|
||||
.data(layers);
|
||||
|
||||
@@ -16,6 +16,13 @@ describe('iD.svg.Layers', function () {
|
||||
expect(container.selectAll('svg')).to.be.classed('surface');
|
||||
});
|
||||
|
||||
it('creates surface defs', function () {
|
||||
container.call(iD.svg.Layers(projection, context));
|
||||
var nodes = container.selectAll('svg defs').nodes();
|
||||
expect(nodes.length).to.eql(1);
|
||||
expect(d3.select(nodes[0])).to.be.classed('surface-defs');
|
||||
});
|
||||
|
||||
it('creates default data layers', function () {
|
||||
container.call(iD.svg.Layers(projection, context));
|
||||
var nodes = container.selectAll('svg .data-layer').nodes();
|
||||
|
||||
Reference in New Issue
Block a user