-
-
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 #17038 from emberjs/transition-hand-slapping
[FEATURE Router Service] Deprecate touching transition state
- Loading branch information
Showing
8 changed files
with
126 additions
and
19 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
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
45 changes: 45 additions & 0 deletions
45
packages/ember/tests/routing/deprecated_transition_state_test.js
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,45 @@ | ||
import { RouterTestCase, moduleFor } from 'internal-test-helpers'; | ||
import { EMBER_ROUTING_ROUTER_SERVICE } from '@ember/canary-features'; | ||
|
||
if (EMBER_ROUTING_ROUTER_SERVICE) { | ||
moduleFor( | ||
'Deprecated Transition State', | ||
class extends RouterTestCase { | ||
'@test touching transition.state is deprecated'(assert) { | ||
assert.expect(1); | ||
return this.visit('/').then(() => { | ||
this.routerService.on('routeWillChange', transition => { | ||
expectDeprecation(() => { | ||
transition.state; | ||
}, 'You attempted to read "transition.state" which is a private API. You should read the `RouteInfo` object on "transition.to" or "transition.from" which has the public state on it.'); | ||
}); | ||
return this.routerService.transitionTo('/child'); | ||
}); | ||
} | ||
|
||
'@test touching transition.queryParams is deprecated'(assert) { | ||
assert.expect(1); | ||
return this.visit('/').then(() => { | ||
this.routerService.on('routeWillChange', transition => { | ||
expectDeprecation(() => { | ||
transition.queryParams; | ||
}, 'You attempted to read "transition.queryParams" which is a private API. You should read the `RouteInfo` object on "transition.to" or "transition.from" which has the queryParams on it.'); | ||
}); | ||
return this.routerService.transitionTo('/child'); | ||
}); | ||
} | ||
|
||
'@test touching transition.params is deprecated'(assert) { | ||
assert.expect(1); | ||
return this.visit('/').then(() => { | ||
this.routerService.on('routeWillChange', transition => { | ||
expectDeprecation(() => { | ||
transition.params; | ||
}, 'You attempted to read "transition.params" which is a private API. You should read the `RouteInfo` object on "transition.to" or "transition.from" which has the params on it.'); | ||
}); | ||
return this.routerService.transitionTo('/child'); | ||
}); | ||
} | ||
} | ||
); | ||
} |
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