Skip to content

Commit

Permalink
fix: reverse data correctly #1250 (#1364)
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreen authored Oct 4, 2022
1 parent 69389e8 commit 0223b1f
Show file tree
Hide file tree
Showing 8 changed files with 491 additions and 410 deletions.
2 changes: 1 addition & 1 deletion .size-limit.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
{
"path": "dist/index.cjs",
"limit": "7.3 kB",
"limit": "7.35 kB",
"import": "{ BarChart }"
},
{
Expand Down
28 changes: 28 additions & 0 deletions src/charts/BarChart/BarChart.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,5 +399,33 @@ describe('Charts', () => {
).toBeDefined();
});
});

it('should correct apply class names', async () => {
data = {
labels: ['A', 'B', 'C'],
series: [
{
className: 'series-1',
data: [1, 2, 3]
},
{
className: 'series-2',
data: [4, 5, 6]
}
]
};
options = {
reverseData: true
};
await createChart();

const seriesElements = document.querySelectorAll('.ct-series');

expect(seriesElements[0]).toHaveClass('series-2');
expect(seriesElements[0]).toContainHTML('ct:value="6"');

expect(seriesElements[1]).toHaveClass('series-1');
expect(seriesElements[1]).toContainHTML('ct:value="3"');
});
});
});
Loading

0 comments on commit 0223b1f

Please sign in to comment.