Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add d3@v5 tests at the Github CI #1825

Merged
merged 2 commits into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/ubuntu-d3-v5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Ubuntu d3@5

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm ci
- run: npm i d3@5
- run: npx grunt ci-pull
13 changes: 7 additions & 6 deletions spec/bar-chart-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ describe('dc.BarChart', () => {
});

it('should generate the y-axis domain dynamically', () => {
expect(nthYAxisText(0).text()).toMatch(/10/);
expect(nthYAxisText(1).text()).toMatch(/5/);
expect(nthYAxisText(0).text()).toMatch(/[\-−]10/);
expect(nthYAxisText(1).text()).toMatch(/[\-−]5/);
expect(nthYAxisText(2).text()).toBe('0');
});

Expand Down Expand Up @@ -583,7 +583,7 @@ describe('dc.BarChart', () => {
return d3.select(chart.selectAll('g.axis.y .tick text').nodes()[n]);
};

expect(nthText(0).text()).toBe('−20');
expect(nthText(0).text()).toMatch(/[\-−]20/);
expect(nthText(1).text()).toBe('0');
expect(nthText(2).text()).toBe('20');
});
Expand All @@ -609,9 +609,10 @@ describe('dc.BarChart', () => {
return d3.select(chart.selectAll('g.axis.y .tick text').nodes()[n]);
};

expect(nthText(0).text()).toBe('−30');
expect(nthText(1).text()).toBe('−20');
expect(nthText(2).text()).toBe('−10');
// d3@5 and d3@6 uses different characters to format negative numbers
expect(nthText(0).text()).toMatch(/[\-−]30/);
expect(nthText(1).text()).toMatch(/[\-−]20/);
expect(nthText(2).text()).toMatch(/[\-−]10/);
expect(nthText(3).text()).toBe('0');
});
});
Expand Down
9 changes: 5 additions & 4 deletions spec/line-chart-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ describe('dc.lineChart', () => {
return d3.select(chart.selectAll('g.axis.y .tick text').nodes()[n]);
};

expect(nthText(0).text()).toBe('−20');
expect(nthText(0).text()).toMatch(/[\-−]20/);
expect(nthText(1).text()).toBe('0');
expect(nthText(2).text()).toBe('20');
});
Expand Down Expand Up @@ -598,9 +598,10 @@ describe('dc.lineChart', () => {
return d3.select(chart.selectAll('g.axis.y .tick text').nodes()[n]);
};

expect(nthText(0).text()).toBe('−30');
expect(nthText(1).text()).toBe('−20');
expect(nthText(2).text()).toBe('−10');
// d3@5 and d3@6 uses different characters to format negative numbers
expect(nthText(0).text()).toMatch(/[\-−]30/);
expect(nthText(1).text()).toMatch(/[\-−]20/);
expect(nthText(2).text()).toMatch(/[\-−]10/);
expect(nthText(3).text()).toBe('0');
});
});
Expand Down
3 changes: 2 additions & 1 deletion spec/row-chart-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,8 @@ describe('dc.rowChart', () => {
const nthText = function (n) { return d3.select(chart.selectAll('g.axis .tick text').nodes()[n]); };

for (let i = 0; i < xAxisTicks.length; i++) {
expect(nthText(i).text()).toBe(xAxisTicks[i]);
// d3@5 and d3@6 uses different characters to format negative numbers
expect(nthText(i).text().replace('-','−')).toBe(xAxisTicks[i].replace('-','−'));
}
});
});
Expand Down