Skip to content

Commit

Permalink
services/progress: Remove progress bar when running tests
Browse files Browse the repository at this point in the history
Waiting for the progressbar to finish animating was slowing down the tests unnecessarily, so instead of waiting for it to finish animating we won't show it anymore at all.
  • Loading branch information
Turbo87 committed Sep 11, 2020
1 parent 311e889 commit f47c0cf
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions app/services/progress.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import Service, { inject as service } from '@ember/service';
import { htmlSafe } from '@ember/string';
import { tracked } from '@glimmer/tracking';
import Ember from 'ember';

import { rawTimeout, task } from 'ember-concurrency';
import { buildWaiter } from 'ember-test-waiters';

const SPEED = 200;

let waiter = buildWaiter('progress-bar');

export default class ProgressService extends Service {
@service router;

Expand All @@ -29,7 +27,7 @@ export default class ProgressService extends Service {
counterTask;

@(task(function* () {
let token = waiter.beginAsync();
if (Ember.testing) return;

let progress = 0;
this._style = `width: 0%`;
Expand Down Expand Up @@ -61,8 +59,6 @@ export default class ProgressService extends Service {
this._style = `transition: width ${SPEED}ms linear; width: 100%`;
yield rawTimeout(SPEED);
this._style = `transition: opacity ${SPEED * 2}ms linear; width: 100%; opacity: 0`;

waiter.endAsync(token);
}).drop())
updateTask;
}

0 comments on commit f47c0cf

Please sign in to comment.