Skip to content

Commit

Permalink
Enable accessibility module (#471)
Browse files Browse the repository at this point in the history
* Enable accessibility module

* Add some waitFor
  • Loading branch information
RobbieTheWagner authored Jul 26, 2024
1 parent 27d92a8 commit 75c4728
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ember-highcharts/src/components/high-charts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ export default class HighCharts extends Component<HighChartsSignature> {
Highcharts = await import('highcharts');
}

const Accessibility = await import('highcharts/modules/accessibility');
Accessibility.default(Highcharts);

// 3d support
if (this.args.chartOptions?.chart?.options3d) {
const Boost = await import('highcharts/modules/boost');
Expand Down
18 changes: 18 additions & 0 deletions test-app/tests/integration/components/high-charts-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module('Integration | Component | High Charts', function (hooks) {
<HighCharts />
`);

await waitFor('.highcharts-credits');

// custom highcharts-configs/application.js is auto-loaded from tests/dummy/app
assert
.dom('.highcharts-credits')
Expand All @@ -41,6 +43,8 @@ module('Integration | Component | High Charts', function (hooks) {
/>
`);

await waitFor('.highcharts-legend');

assert
.dom('.highcharts-legend .highcharts-legend-item text')
.exists({ count: 1 }, 'expected one series');
Expand All @@ -52,13 +56,16 @@ module('Integration | Component | High Charts', function (hooks) {
test('should add a series', async function (assert) {
this.cityData = cityData;
this.lineChartOptions = lineChartOptions;

await render(hbs`
<HighCharts
@content={{this.cityData}}
@chartOptions={{this.lineChartOptions}}
/>
`);

await waitFor('.highcharts-legend');

assert
.dom('.highcharts-legend .highcharts-legend-item')
.exists({ count: 3 }, 'base series count');
Expand All @@ -83,13 +90,16 @@ module('Integration | Component | High Charts', function (hooks) {
test('should remove a series', async function (assert) {
this.cityData = cityData;
this.lineChartOptions = lineChartOptions;

await render(hbs`
<HighCharts
@content={{this.cityData}}
@chartOptions={{this.lineChartOptions}}
/>
`);

await waitFor('.highcharts-legend');

assert
.dom('.highcharts-legend .highcharts-legend-item')
.exists({ count: 3 }, 'base series count');
Expand Down Expand Up @@ -175,27 +185,35 @@ module('Integration | Component | High Charts', function (hooks) {
await render(hbs`
<HighCharts />
`);
await waitFor('.highcharts-container');

assert
.dom('.highcharts-container')
.exists({ count: 1 }, 'we rendered a chart without a mode specified');

await render(hbs`
<HighCharts @mode="" />
`);
await waitFor('.highcharts-container');

assert
.dom('.highcharts-container')
.exists({ count: 1 }, 'we rendered a chart with empty string mode');

await render(hbs`
<HighCharts @mode={{false}}/>
`);
await waitFor('.highcharts-container');

assert
.dom('.highcharts-container')
.exists({ count: 1 }, 'we rendered a chart with false boolean mode');

await render(hbs`
<HighCharts @mode={{null}}/>
`);
await waitFor('.highcharts-container');

assert
.dom('.highcharts-container')
.exists({ count: 1 }, 'we rendered a chart with null mode');
Expand Down

0 comments on commit 75c4728

Please sign in to comment.