-
-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace blueprint with explicit test helpers #392
Replace blueprint with explicit test helpers #392
Conversation
bcb9294
to
b639f47
Compare
module('FlashMessageObject disableTimeout', function (hooks) { | ||
hooks.beforeEach(function () { | ||
disableTimeout(); | ||
flash = FlashMessage.create({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you planning to remove the EmberObject
usage before v5?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't specifically, although that will be a breaking change at some point...
Actually I'm not sure that this object is public API 🤔 so migrating it may not be a breaking change. Haven't looked into it deeply though
Self-reivew: I think we can reduce the configuration a bit here by disabling timers by default. Edit: Yeah – adjusted so that there's no installation config needed and the upgrading steps are simpler for most users (remove a single import). |
chore(test app): enable timeout for whole suite
import { enableTimeout } from 'ember-cli-flash/test-support'; | ||
|
||
enableTimeout(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test app needs to dogfood the enableTimeout
helper since it tests timeout functionality of the addon itself.
@NullVoxPopuli please add |
Old world 🌐
Previously the following was added to an Ember CLI app when installed via
ember install ember-cli-flash
.Essentially importing this helper would cause the
init
hook of theFlashObject
to become a no-op and disable the timeout running in consuming apps test runs.It wasn't very explicit or obvious that what was happening as a result of this import. Looking at apps that I maintain, some do and some don't have this...
New world 🌏
Blueprints are not supported in V2 addons, so this PR ships two new test helpers instead.
To get the same behaviour as "Old world 🌐 " a consuming app needs only to remove the blueprint import. ✅
However this can be changed at any time with the
enableTimers
function. This allows consuming apps to choose on a per-test basis whether Flash timeouts should occur – as demonstrated by the included tests.Why not disable timeouts for all test runs? 🤔
There are many existing apps with test suites that both do and do not have timeouts disabled at present I think it's important that this is configurable for compatibility reasons.
Even this addon's own test suite tests with the timeout functionality enabled.
Other options 🤷🏻
Very open to suggestions here. Just wanted to have a known way forward to replace the existing blueprint.
Documentation