Skip to content

Commit c5163bb

Browse files
committed
Set up failing test case
1 parent e72e387 commit c5163bb

File tree

6 files changed

+53
-1
lines changed

6 files changed

+53
-1
lines changed

tests/acceptance/run-loop-test.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { test } from 'qunit';
2+
import moduleForAcceptance from '../../tests/helpers/module-for-acceptance';
3+
4+
import nprogress from 'ember-cli-nprogress';
5+
6+
// Note: This somewhat unorthidox test setup will throw an error when running the tests in Chrome,
7+
// if `nprogress` isn't configured to run withing the Ember run loop
8+
moduleForAcceptance('Acceptance | run loop', {
9+
beforeEach() {
10+
nprogress.configure({
11+
parent: '#nprogress-parent'
12+
});
13+
}
14+
});
15+
16+
test('loading an initial route', function(assert) {
17+
assert.expect(0);
18+
19+
visit('/');
20+
});
21+
22+
test('it fires the `start` event within the run loop', function(assert) {
23+
visit('/');
24+
25+
click('a');
26+
27+
andThen(function() {
28+
assert.equal(currentURL(), '/some-other-route');
29+
});
30+
});

tests/dummy/app/router.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const Router = Ember.Router.extend({
77
});
88

99
Router.map(function() {
10+
this.route('some-other-route');
1011
});
1112

1213
export default Router;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Ember from 'ember';
2+
import nprogress from 'ember-cli-nprogress';
3+
4+
const { Route } = Ember;
5+
6+
export default Route.extend({
7+
actions: {
8+
willTransition() {
9+
nprogress.start();
10+
},
11+
12+
didTransition() {
13+
nprogress.done();
14+
}
15+
}
16+
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<h2 id="title">Welcome to Ember</h2>
1+
<div id='nprogress-parent'></div>
22

33
{{outlet}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>Hello, world!</h1>
2+
3+
{{link-to 'Some other route' 'some-other-route'}}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h1>Some Other Route</h1>
2+

0 commit comments

Comments
 (0)