Skip to content

Commit ee9dd26

Browse files
committed
Automated Prettier for specs
1 parent 83752a0 commit ee9dd26

37 files changed

+2365
-1419
lines changed

spec/bar-chart-spec.js

+218-133
Large diffs are not rendered by default.

spec/base-mixin-spec.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,7 @@ describe('dc.baseMixin', () => {
502502

503503
describe('with viewbox enabled', () => {
504504
beforeEach(() => {
505-
chart
506-
.useViewBoxResizing(true)
507-
.resetSvg();
505+
chart.useViewBoxResizing(true).resetSvg();
508506
});
509507

510508
it('has useViewBoxResizing set', () => {

spec/biggish-data-spec.js

+16-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/box-plot-spec.js

+23-24
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ describe('dc.BoxPlot', () => {
88

99
dimension = data.dimension(d => d.countrycode);
1010
group = dimension.group().reduce(
11-
(p, v) => { p.push(+v.value); return p; },
12-
(p, v) => { p.splice(p.indexOf(+v.value), 1); return p; },
11+
(p, v) => {
12+
p.push(+v.value);
13+
return p;
14+
},
15+
(p, v) => {
16+
p.splice(p.indexOf(+v.value), 1);
17+
return p;
18+
},
1319
() => []
1420
);
1521

@@ -22,12 +28,12 @@ describe('dc.BoxPlot', () => {
2228
.group(group)
2329
.width(300)
2430
.height(144)
25-
.margins({top: 0, right: 0, bottom: 0, left: 0})
31+
.margins({ top: 0, right: 0, bottom: 0, left: 0 })
2632
.boxPadding(0)
2733
.transitionDuration(0)
2834
.transitionDelay(0)
2935
.y(d3.scaleLinear().domain([0, 144]))
30-
.ordinalColors(['#01','#02']);
36+
.ordinalColors(['#01', '#02']);
3137
});
3238

3339
describe('rendering the box plot', () => {
@@ -86,11 +92,7 @@ describe('dc.BoxPlot', () => {
8692

8793
describe('with renderDataPoints enabled', () => {
8894
beforeEach(() => {
89-
chart
90-
.renderDataPoints(true)
91-
.renderTitle(true)
92-
.boxWidth(100)
93-
.render();
95+
chart.renderDataPoints(true).renderTitle(true).boxWidth(100).render();
9496
});
9597

9698
it('should create one data point per data value (non-outlier)', () => {
@@ -101,8 +103,8 @@ describe('dc.BoxPlot', () => {
101103
});
102104
it('should display the data between 10 to 90 of the box (by default)', () => {
103105
const w = box(1).select('rect.box').attr('width');
104-
const min = (w / 2) - (w * chart.dataWidthPortion() / 2);
105-
const max = (w / 2) + (w * chart.dataWidthPortion() / 2);
106+
const min = w / 2 - (w * chart.dataWidthPortion()) / 2;
107+
const max = w / 2 + (w * chart.dataWidthPortion()) / 2;
106108
chart.selectAll('circle.data').each(function () {
107109
expect(d3.select(this).attr('cx')).toBeGreaterThan(min - 0.1);
108110
expect(d3.select(this).attr('cx')).toBeLessThan(max + 0.1);
@@ -111,15 +113,13 @@ describe('dc.BoxPlot', () => {
111113

112114
describe('and dataWidthPortion set to 50%', () => {
113115
beforeEach(() => {
114-
chart
115-
.dataWidthPortion(0.5)
116-
.render();
116+
chart.dataWidthPortion(0.5).render();
117117
});
118118

119119
it('should display the data between 25 to 75 of the box', () => {
120120
const w = box(1).select('rect.box').attr('width');
121-
const min = (w / 2) - (w * chart.dataWidthPortion() / 2);
122-
const max = (w / 2) + (w * chart.dataWidthPortion() / 2);
121+
const min = w / 2 - (w * chart.dataWidthPortion()) / 2;
122+
const max = w / 2 + (w * chart.dataWidthPortion()) / 2;
123123
chart.selectAll('circle.data').each(function () {
124124
expect(d3.select(this).attr('cx')).toBeGreaterThan(min - 0.1);
125125
expect(d3.select(this).attr('cx')).toBeLessThan(max + 0.1);
@@ -129,15 +129,13 @@ describe('dc.BoxPlot', () => {
129129

130130
describe('and dataWidthPortion set to 10%', () => {
131131
beforeEach(() => {
132-
chart
133-
.dataWidthPortion(0.1)
134-
.render();
132+
chart.dataWidthPortion(0.1).render();
135133
});
136134

137135
it('should display the data between 45 to 55 of the box', () => {
138136
const w = box(1).select('rect.box').attr('width');
139-
const min = (w / 2) - (w * chart.dataWidthPortion() / 2);
140-
const max = (w / 2) + (w * chart.dataWidthPortion() / 2);
137+
const min = w / 2 - (w * chart.dataWidthPortion()) / 2;
138+
const max = w / 2 + (w * chart.dataWidthPortion()) / 2;
141139
chart.selectAll('circle.data').each(function () {
142140
expect(d3.select(this).attr('cx')).toBeGreaterThan(min - 0.1);
143141
expect(d3.select(this).attr('cx')).toBeLessThan(max + 0.1);
@@ -170,7 +168,9 @@ describe('dc.BoxPlot', () => {
170168
});
171169

172170
it('should be settable to a function', () => {
173-
chart.boxWidth((innerChartWidth, xUnits) => innerChartWidth / (xUnits + 2)).render();
171+
chart
172+
.boxWidth((innerChartWidth, xUnits) => innerChartWidth / (xUnits + 2))
173+
.render();
174174
expect(box(1).select('rect.box').attr('width')).toBe('75');
175175
});
176176
});
@@ -291,7 +291,7 @@ describe('dc.BoxPlot', () => {
291291
});
292292
});
293293

294-
function box (n) {
294+
function box(n) {
295295
const nthBox = d3.select(chart.selectAll('g.box').nodes()[n]);
296296
nthBox.boxText = function (i) {
297297
return d3.select(this.selectAll('text.box').nodes()[i]);
@@ -305,4 +305,3 @@ describe('dc.BoxPlot', () => {
305305
return nthBox;
306306
}
307307
});
308-

0 commit comments

Comments
 (0)