@@ -20,11 +20,13 @@ moduleFor('The {{link-to}} helper: .transitioning-in .transitioning-out CSS clas
2020
2121 this . aboutDefer = RSVP . defer ( ) ;
2222 this . otherDefer = RSVP . defer ( ) ;
23+ this . newsDefer = RSVP . defer ( ) ;
2324 let _this = this ;
2425
2526 this . router . map ( function ( ) {
2627 this . route ( 'about' ) ;
2728 this . route ( 'other' ) ;
29+ this . route ( 'news' ) ;
2830 } ) ;
2931
3032 this . add ( 'route:about' , Route . extend ( {
@@ -39,11 +41,18 @@ moduleFor('The {{link-to}} helper: .transitioning-in .transitioning-out CSS clas
3941 }
4042 } ) ) ;
4143
44+ this . add ( 'route:news' , Route . extend ( {
45+ model ( ) {
46+ return _this . newsDefer . promise ;
47+ }
48+ } ) ) ;
49+
4250 this . addTemplate ( 'application' , `
4351 {{outlet}}
4452 {{link-to 'Index' 'index' id='index-link'}}
4553 {{link-to 'About' 'about' id='about-link'}}
4654 {{link-to 'Other' 'other' id='other-link'}}
55+ {{link-to 'News' 'news' activeClass=false id='news-link'}}
4756 ` ) ;
4857
4958 this . visit ( '/' ) ;
@@ -53,6 +62,7 @@ moduleFor('The {{link-to}} helper: .transitioning-in .transitioning-out CSS clas
5362 super . teardown ( ) ;
5463 this . aboutDefer = null ;
5564 this . otherDefer = null ;
65+ this . newsDefer = null ;
5666 }
5767
5868 [ '@test while a transition is underway' ] ( assert ) {
@@ -88,6 +98,41 @@ moduleFor('The {{link-to}} helper: .transitioning-in .transitioning-out CSS clas
8898 assertHasNoClass ( assert , $about , 'ember-transitioning-out' ) ;
8999 assertHasNoClass ( assert , $other , 'ember-transitioning-out' ) ;
90100 }
101+
102+ [ '@test while a transition is underway with activeClass is false' ] ( assert ) {
103+ let $index = this . $ ( '#index-link' ) ;
104+ let $news = this . $ ( '#news-link' ) ;
105+ let $other = this . $ ( '#other-link' ) ;
106+
107+ $news . click ( ) ;
108+
109+ assertHasClass ( assert , $index , 'active' ) ;
110+ assertHasNoClass ( assert , $news , 'active' ) ;
111+ assertHasNoClass ( assert , $other , 'active' ) ;
112+
113+ assertHasNoClass ( assert , $index , 'ember-transitioning-in' ) ;
114+ assertHasClass ( assert , $news , 'ember-transitioning-in' ) ;
115+ assertHasNoClass ( assert , $other , 'ember-transitioning-in' ) ;
116+
117+ assertHasClass ( assert , $index , 'ember-transitioning-out' ) ;
118+ assertHasNoClass ( assert , $news , 'ember-transitioning-out' ) ;
119+ assertHasNoClass ( assert , $other , 'ember-transitioning-out' ) ;
120+
121+ this . runTask ( ( ) => this . newsDefer . resolve ( ) ) ;
122+
123+ assertHasNoClass ( assert , $index , 'active' ) ;
124+ assertHasNoClass ( assert , $news , 'active' ) ;
125+ assertHasNoClass ( assert , $other , 'active' ) ;
126+
127+ assertHasNoClass ( assert , $index , 'ember-transitioning-in' ) ;
128+ assertHasNoClass ( assert , $news , 'ember-transitioning-in' ) ;
129+ assertHasNoClass ( assert , $other , 'ember-transitioning-in' ) ;
130+
131+ assertHasNoClass ( assert , $index , 'ember-transitioning-out' ) ;
132+ assertHasNoClass ( assert , $news , 'ember-transitioning-out' ) ;
133+ assertHasNoClass ( assert , $other , 'ember-transitioning-out' ) ;
134+ }
135+
91136} ) ;
92137
93138moduleFor ( `The {{link-to}} helper: .transitioning-in .transitioning-out CSS classes - nested link-to's` , class extends ApplicationTestCase {
0 commit comments