Skip to content

Commit

Permalink
add test for PR dc-js#685
Browse files Browse the repository at this point in the history
@jcamins, adding a simple test for your PR on clip path id
to make sure it stays fixed and to show the intended behavior
please check and suggest improvements, if any.  Thanks!
  • Loading branch information
gordonwoodhull committed Nov 30, 2014
1 parent b2059e1 commit abd89b6
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2866,7 +2866,7 @@ dc.coordinateGridMixin = function (_chart) {
};

function getClipPathId() {
return _chart.anchorName() + '-clip';
return _chart.anchorName().replace(/[ .#]/g, '-') + '-clip';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion dc.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dc.min.js.map

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions spec/coordinate-grid-chart-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,25 @@ describe('dc.coordinateGridChart', function() {

});

describe('with a complex selector', function() {
beforeEach(function() {
var sel = appendChartID('coordinate-grid').append('div').attr('class', 'chart');
chart = dc.lineChart("#coordinate-grid .chart")
.width(500)
.height(150)
.dimension(dimension)
.group(group)
.transitionDuration(0)
.brushOn(false)
.margins({ top: 20, bottom: 0, right: 10, left: 0 })
.x(d3.time.scale.utc().domain([makeDate(2012, 4, 20), makeDate(2012, 7, 15)]));
chart.render();
});
it('should generate a valid clippath id', function() {
var rect = chart.select("defs #coordinate-grid--chart-clip rect");
expect(rect.empty()).toBeFalsy();
});
});
});

describe('when an x function is not provided', function () {
Expand Down
2 changes: 1 addition & 1 deletion web/js/dc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2866,7 +2866,7 @@ dc.coordinateGridMixin = function (_chart) {
};

function getClipPathId() {
return _chart.anchorName() + '-clip';
return _chart.anchorName().replace(/[ .#]/g, '-') + '-clip';
}

/**
Expand Down

0 comments on commit abd89b6

Please sign in to comment.