-
-
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.
Wrap deprecations in router-service flag
- Loading branch information
1 parent
d91a4d0
commit 55bd846
Showing
5 changed files
with
121 additions
and
106 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
111 changes: 57 additions & 54 deletions
111
packages/ember/tests/routing/deprecated_handler_infos_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 |
---|---|---|
@@ -1,66 +1,69 @@ | ||
import { moduleFor, ApplicationTestCase } from 'internal-test-helpers'; | ||
import { EMBER_ROUTING_ROUTER_SERVICE } from '@ember/canary-features'; | ||
|
||
moduleFor( | ||
'Deprecated HandlerInfos', | ||
class extends ApplicationTestCase { | ||
constructor() { | ||
super(...arguments); | ||
this.router.map(function() { | ||
this.route('parent', function() { | ||
this.route('child'); | ||
this.route('sibling'); | ||
if (EMBER_ROUTING_ROUTER_SERVICE) { | ||
moduleFor( | ||
'Deprecated HandlerInfos', | ||
class extends ApplicationTestCase { | ||
constructor() { | ||
super(...arguments); | ||
this.router.map(function() { | ||
this.route('parent', function() { | ||
this.route('child'); | ||
this.route('sibling'); | ||
}); | ||
}); | ||
}); | ||
} | ||
|
||
get routerOptions() { | ||
return { | ||
willTransition(oldHandlers, newHandlers, transition) { | ||
expectDeprecation(() => { | ||
this._routerMicrolib.currentHandlerInfos; | ||
}, 'You attempted to use "_routerMicrolib.currentHandlerInfos" which is a private API that will be removed.'); | ||
} | ||
|
||
expectDeprecation(() => { | ||
this._routerMicrolib.getHandler('parent'); | ||
}, 'You attempted to use "_routerMicrolib.getHandler" which is a private API that will be removed.'); | ||
|
||
oldHandlers.forEach(handler => { | ||
get routerOptions() { | ||
return { | ||
willTransition(oldHandlers, newHandlers, transition) { | ||
expectDeprecation(() => { | ||
handler.handler; | ||
}, 'You attempted to read "handlerInfo.handler" which is a private API that will be removed.'); | ||
}); | ||
newHandlers.forEach(handler => { | ||
this._routerMicrolib.currentHandlerInfos; | ||
}, 'You attempted to use "_routerMicrolib.currentHandlerInfos" which is a private API that will be removed.'); | ||
|
||
expectDeprecation(() => { | ||
handler.handler; | ||
}, 'You attempted to read "handlerInfo.handler" which is a private API that will be removed.'); | ||
}); | ||
this._routerMicrolib.getHandler('parent'); | ||
}, 'You attempted to use "_routerMicrolib.getHandler" which is a private API that will be removed.'); | ||
|
||
expectDeprecation(() => { | ||
transition.handlerInfos; | ||
}, 'You attempted to use "transition.handlerInfos" which is a private API that will be removed.'); | ||
oldHandlers.forEach(handler => { | ||
expectDeprecation(() => { | ||
handler.handler; | ||
}, 'You attempted to read "handlerInfo.handler" which is a private API that will be removed.'); | ||
}); | ||
newHandlers.forEach(handler => { | ||
expectDeprecation(() => { | ||
handler.handler; | ||
}, 'You attempted to read "handlerInfo.handler" which is a private API that will be removed.'); | ||
}); | ||
|
||
expectDeprecation(() => { | ||
transition.state.handlerInfos; | ||
}, 'You attempted to use "transition.state.handlerInfos" which is a private API that will be removed.'); | ||
QUnit.assert.ok(true, 'willTransition'); | ||
}, | ||
expectDeprecation(() => { | ||
transition.handlerInfos; | ||
}, 'You attempted to use "transition.handlerInfos" which is a private API that will be removed.'); | ||
|
||
didTransition(newHandlers) { | ||
newHandlers.forEach(handler => { | ||
expectDeprecation(() => { | ||
handler.handler; | ||
}, 'You attempted to read "handlerInfo.handler" which is a private API that will be removed.'); | ||
}); | ||
QUnit.assert.ok(true, 'didTransition'); | ||
}, | ||
}; | ||
} | ||
transition.state.handlerInfos; | ||
}, 'You attempted to use "transition.state.handlerInfos" which is a private API that will be removed.'); | ||
QUnit.assert.ok(true, 'willTransition'); | ||
}, | ||
|
||
didTransition(newHandlers) { | ||
newHandlers.forEach(handler => { | ||
expectDeprecation(() => { | ||
handler.handler; | ||
}, 'You attempted to read "handlerInfo.handler" which is a private API that will be removed.'); | ||
}); | ||
QUnit.assert.ok(true, 'didTransition'); | ||
}, | ||
}; | ||
} | ||
|
||
'@test handlerInfos are deprecated and associated private apis'(assert) { | ||
let done = assert.async(); | ||
return this.visit('/parent').then(() => { | ||
done(); | ||
}); | ||
'@test handlerInfos are deprecated and associated private apis'(assert) { | ||
let done = assert.async(); | ||
return this.visit('/parent').then(() => { | ||
done(); | ||
}); | ||
} | ||
} | ||
} | ||
); | ||
); | ||
} |
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