File tree Expand file tree Collapse file tree 6 files changed +53
-1
lines changed Expand file tree Collapse file tree 6 files changed +53
-1
lines changed Original file line number Diff line number Diff line change
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
+ } ) ;
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const Router = Ember.Router.extend({
7
7
} ) ;
8
8
9
9
Router . map ( function ( ) {
10
+ this . route ( 'some-other-route' ) ;
10
11
} ) ;
11
12
12
13
export default Router ;
Original file line number Diff line number Diff line change
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
+ } ) ;
Original file line number Diff line number Diff line change 1
- <h2 id =" title " >Welcome to Ember</ h2 >
1
+ <div id =' nprogress-parent ' ></ div >
2
2
3
3
{{ outlet }}
Original file line number Diff line number Diff line change
1
+ <h1 >Hello, world!</h1 >
2
+
3
+ {{ link-to ' Some other route' ' some-other-route' }}
Original file line number Diff line number Diff line change
1
+ <h1 >Some Other Route</h1 >
2
+
You can’t perform that action at this time.
0 commit comments