-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14176 from trentmwillis/prefix-route-name
Ensure Controller#transitionToRoute and Route#intermediateTransitionTo work in Engines
- Loading branch information
Showing
5 changed files
with
161 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { buildOwner } from 'internal-test-helpers'; | ||
import { Controller } from 'ember-runtime'; | ||
import { setOwner } from 'container'; | ||
|
||
QUnit.module('ember-routing/ext/controller'); | ||
|
||
QUnit.test('transitionToRoute considers an engine\'s mountPoint', function() { | ||
expect(4); | ||
|
||
let router = { | ||
transitionTo(route) { | ||
return route; | ||
} | ||
}; | ||
|
||
let engineInstance = buildOwner({ | ||
ownerOptions: { | ||
routable: true, | ||
mountPoint: 'foo.bar' | ||
} | ||
}); | ||
|
||
let controller = Controller.create({ target: router }); | ||
setOwner(controller, engineInstance); | ||
|
||
strictEqual(controller.transitionToRoute('application'), 'foo.bar.application', 'properly prefixes application route'); | ||
strictEqual(controller.transitionToRoute('posts'), 'foo.bar.posts', 'properly prefixes child routes'); | ||
throws(() => controller.transitionToRoute('/posts'), 'throws when trying to use a url'); | ||
|
||
let queryParams = {}; | ||
strictEqual(controller.transitionToRoute(queryParams), queryParams, 'passes query param only transitions through'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters