mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 18:11:11 +08:00
Upgrade ember qunit, create new interface for testing components
This commit is contained in:
22
test/javascripts/helpers/component-test.js.es6
Normal file
22
test/javascripts/helpers/component-test.js.es6
Normal file
@ -0,0 +1,22 @@
|
||||
import createStore from 'helpers/create-store';
|
||||
|
||||
export default function(name, opts) {
|
||||
opts = opts || {};
|
||||
|
||||
test(name, function(assert) {
|
||||
if (opts.setup) {
|
||||
const store = createStore();
|
||||
opts.setup.call(this, store);
|
||||
}
|
||||
this.container.register('site-settings:main', Discourse.SiteSettings, { instantiate: false });
|
||||
this.container.injection('component', 'siteSettings', 'site-settings:main');
|
||||
|
||||
andThen(() => {
|
||||
this.render(opts.template);
|
||||
});
|
||||
|
||||
andThen(() => {
|
||||
opts.test.call(this, assert);
|
||||
});
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user