File tree Expand file tree Collapse file tree 2 files changed +16
-11
lines changed
internal-test-helpers/lib/test-cases Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -664,19 +664,14 @@ class EmberRouter extends EmberObject.extend(Evented) implements Evented {
664664 this . _toplevelView = OutletView . create ( { environment, template, application } ) ;
665665 this . _toplevelView . setOutletState ( root ) ;
666666
667- // TODO(SAFETY): At least one test runs without this set correctly. At a
668- // later time, update the test to configure this correctly. The test ID:
669667 // `Router Service - non application test: RouterService#transitionTo with basic route`
670668 let instance = owner . lookup ( '-application-instance:main' ) as ApplicationInstance ;
671- // let instance = owner.lookup('-application-instance:main') as ApplicationInstance | undefined;
672- // assert('[BUG] unexpectedly missing `-application-instance:main`', instance !== undefined);
673-
674- if ( instance ) {
675- // SAFETY: LOL. This is calling a deprecated API with a type that we
676- // cannot actually confirm at a type level *is* a `ViewMixin`. Seems:
677- // not great on multiple fronts!
678- instance . didCreateRootView ( this . _toplevelView as any ) ;
679- }
669+ assert ( '[BUG] unexpectedly missing `-application-instance:main`' , instance !== undefined ) ;
670+
671+ // SAFETY: LOL. This is calling a deprecated API with a type that we
672+ // cannot actually confirm at a type level *is* a `ViewMixin`. Seems:
673+ // not great on multiple fronts!
674+ instance . didCreateRootView ( this . _toplevelView as any ) ;
680675 } else {
681676 this . _toplevelView . setOutletState ( root ) ;
682677 }
Original file line number Diff line number Diff line change @@ -34,6 +34,16 @@ export default class RouterNonApplicationTestCase extends AbstractTestCase {
3434 owner . register ( '-view-registry:main' , Object . create ( null ) , { instantiate : false } ) ;
3535 owner . register ( 'event_dispatcher:main' , EventDispatcher ) ;
3636
37+ // This is a bit of a hack, but we need to register an application instance
38+ // so that the router can look it up. In the future, we should probably
39+ // make this a real application instance, or at least a real engine instance.
40+ let appInstance = {
41+ didCreateRootView : ( view : any ) => {
42+ view . appendTo ( this . element ) ;
43+ } ,
44+ } ;
45+ owner . register ( '-application-instance:main' , appInstance , { instantiate : false } ) ;
46+
3747 this . renderer = this . owner . lookup ( 'renderer:-dom' ) as Renderer ;
3848 this . element = document . querySelector ( '#qunit-fixture' ) ! ;
3949 this . component = null ;
You can’t perform that action at this time.
0 commit comments