Most apps will be unaffected by this – unless they call getFlashObject
to access flash messages.
Prior to v6 FlashObject
extended EmberObject and supported methods like get
, getProperties
, set
, and setProperties
.
It's now a native class, and property access can be done using regular dot syntax, eg flash.get('message')
should be replaced with flash.message
.
In previous versions an install-time blueprint would add a test helper to tests/helpers/flash-message.js
and import it in tests/test-helper.js
.
This was used to disable the timeout functionality where a flash message is removed after a delay. For most test suites this is a sensible default.
Apps in which the blueprint ran will have a tests/helpers/flash-message.js
file.
Take note of whether this helper is present in your app.
You should remove the test helper and its import.
// tests/helpers/flash-message.js
-import FlashObject from 'ember-cli-flash/flash/object';
-
-FlashObject.reopen({ init() {} });
// tests/test-helper.js
import Application from 'example-app/app';
import config from 'example-app/config/environment';
import * as QUnit from 'qunit';
import { setApplication } from '@ember/test-helpers';
import { setup } from 'qunit-dom';
import { start } from 'ember-qunit';
- import './helpers/flash-message';
setApplication(Application.create(config.APP));
setup(QUnit.assert);
start();
Flash messages should behave as they did before in your test runs.
Try running your app tests. If they pass then you have nothing more to do.
If your tests failed then they may have been relying on flash message timeouts being enabled.
You may import and invoke the enableTimeout
helper within your tests/test-helper.js
. This should restore the flash message timeout behaviour that your tests expect.
// tests/test-helper.js
import Application from 'example-app/app';
import config from 'example-app/config/environment';
import * as QUnit from 'qunit';
import { setApplication } from '@ember/test-helpers';
import { setup } from 'qunit-dom';
import { start } from 'ember-qunit';
+ import { enableTimeout } from 'ember-cli-flash/test-support';
+ enableTimeout();
setApplication(Application.create(config.APP));
setup(QUnit.assert);
start();