Skip to content

Commit 212b815

Browse files
committed
add a test for progress-bar transition aborted
1 parent 7b02921 commit 212b815

File tree

11 files changed

+66
-2
lines changed

11 files changed

+66
-2
lines changed

tests/acceptance/progress-bar-test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { module, test } from 'qunit';
2+
import { visit, currentURL, click } from '@ember/test-helpers';
3+
import { setupApplicationTest } from 'ember-qunit';
4+
5+
module('Acceptance | progress bar', function (hooks) {
6+
setupApplicationTest(hooks);
7+
8+
test('progress bar should not causea a transition abort error', async function (assert) {
9+
await visit('/');
10+
11+
await click('[data-test-basic-route]');
12+
13+
assert.equal(currentURL(), '/fancy');
14+
15+
await visit('/');
16+
17+
await click('[data-test-slow-route]');
18+
19+
assert.equal(currentURL(), '/fancy');
20+
});
21+
});

tests/dummy/app/router.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ export default class Router extends EmberRouter {
66
rootURL = config.rootURL;
77
}
88

9-
Router.map(function () {});
9+
Router.map(function () {
10+
this.route('basicy');
11+
this.route('slow');
12+
this.route('fancy');
13+
});

tests/dummy/app/routes/basicy.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Route from '@ember/routing/route';
2+
import { inject as service } from '@ember/service';
3+
4+
export default class BasicRoute extends Route {
5+
@service router;
6+
model() {
7+
return this.router.transitionTo('fancy');
8+
}
9+
}

tests/dummy/app/routes/fancy.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Route from '@ember/routing/route';
2+
3+
export default class FancyRoute extends Route {}

tests/dummy/app/routes/slow.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Route from '@ember/routing/route';
2+
import { inject as service } from '@ember/service';
3+
import { timeout } from 'ember-concurrency';
4+
5+
export default class BasicRoute extends Route {
6+
@service router;
7+
async model() {
8+
await timeout(2000);
9+
return this.router.transitionTo('fancy');
10+
}
11+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<EsProgressBar />
2+
3+
{{outlet}}

tests/dummy/app/templates/basicy.hbs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{{page-title "Basic"}}
2+
3+
<h1>Basicy</h1>
4+
{{outlet}}

tests/dummy/app/templates/fancy.hbs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{page-title "Fancy"}}
2+
<h1>Fancy</h1>
3+
{{outlet}}

tests/dummy/app/templates/index.hbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<LinkTo @route="basicy" data-test-basic-route>Go to my basic route</LinkTo>
2+
<LinkTo @route="slow" data-test-slow-route>Go to my slow route</LinkTo>

tests/dummy/app/templates/slow.hbs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{{page-title "Basic"}}
2+
3+
<h1>Slow</h1>
4+
{{outlet}}

0 commit comments

Comments
 (0)