Skip to content

Commit

Permalink
Add some waitFor
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbieTheWagner committed Jul 26, 2024
1 parent 12d8c90 commit f481cbb
Showing 1 changed file with 18 additions and 0 deletions.
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 f481cbb

Please sign in to comment.