File tree Expand file tree Collapse file tree 4 files changed +25
-5
lines changed
components/docs-viewer/x-nav-item Expand file tree Collapse file tree 4 files changed +25
-5
lines changed Original file line number Diff line number Diff line change 1515/libpeerconnection.log
1616npm-debug.log *
1717testem.log
18+ package-lock.json
Original file line number Diff line number Diff line change 11import { inject as service } from '@ember/service' ;
22import Component from '@ember/component' ;
33import layout from './template' ;
4+ import { next } from '@ember/runloop' ;
45
56export default Component . extend ( {
67 layout,
@@ -11,8 +12,14 @@ export default Component.extend({
1112
1213 didInsertElement ( ) {
1314 this . _super ( ...arguments ) ;
14- this . get ( 'docsRoutes.items' ) . addObject ( this ) ;
15- } ,
15+
16+ next ( ( ) => {
17+ this . get ( 'docsRoutes.items' ) . addObject ( this ) ;
18+ } ) ;
19+ }
20+
1621} ) . reopenClass ( {
22+
1723 positionalParams : [ 'label' , 'route' , 'model' ]
24+
1825} ) ;
Original file line number Diff line number Diff line change @@ -35,15 +35,15 @@ export default Service.extend({
3535 } ) ;
3636 } ) ,
3737
38- currentRouteIndex : computed ( 'router.router.currentURL ' , 'routeUrls.[]' , function ( ) {
38+ currentRouteIndex : computed ( 'router.router.url ' , 'routeUrls.[]' , function ( ) {
3939 if ( this . get ( 'routeUrls.length' ) ) {
4040 let router = this . get ( 'router.router' ) ;
41- let currentURL = router . get ( 'rootURL' ) + router . get ( 'currentURL ' ) ;
41+ let currentURL = router . get ( 'rootURL' ) + router . get ( 'url ' ) ;
4242 currentURL = currentURL
4343 . replace ( "//" , "/" ) // dedup slashes
4444 . replace ( / \/ $ / , "" ) ; // remove trailing slash
4545 let index = this . get ( 'routeUrls' ) . indexOf ( currentURL ) ;
46- assert ( `DocsRoutes wasn't able to correctly detect the current route.` , index > - 1 ) ;
46+ assert ( `DocsRoutes wasn't able to correctly detect the current route. The current url is ${ currentURL } ` , index > - 1 ) ;
4747 return index ;
4848 }
4949 } ) ,
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+ moduleForAcceptance ( 'Acceptance | Docs route test' ) ;
5+
6+ test ( 'the docs route renders' , function ( assert ) {
7+ visit ( '/docs' ) ;
8+
9+ andThen ( function ( ) {
10+ assert . equal ( currentURL ( ) , '/docs' ) ;
11+ } ) ;
12+ } ) ;
You can’t perform that action at this time.
0 commit comments