mirror of
https://github.com/documize/community.git
synced 2025-07-25 08:09:43 +02:00
Move mirage server create to module-for-acceptance tests file
This commit is contained in:
parent
a74b14ae76
commit
68271646eb
5 changed files with 296 additions and 70 deletions
|
@ -32,7 +32,8 @@
|
|||
"waitToAppear",
|
||||
"stubUserNotification",
|
||||
"is",
|
||||
"authenticateUser"
|
||||
"authenticateUser",
|
||||
"localStorage"
|
||||
],
|
||||
"node": false,
|
||||
"browser": false,
|
||||
|
|
|
@ -2,31 +2,38 @@ import { module } from 'qunit';
|
|||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
|
||||
export default function(name, options = {}) {
|
||||
module(name, {
|
||||
beforeEach() {
|
||||
this.application = startApp();
|
||||
stubAudit(this);
|
||||
stubUserNotification(this);
|
||||
export default function (name, options = {}) {
|
||||
module(name, {
|
||||
beforeEach() {
|
||||
this.application = startApp();
|
||||
localStorage.setItem('folder', 'VzMuyEw_3WqiafcG');
|
||||
stubAudit(this);
|
||||
stubUserNotification(this);
|
||||
server.createList('folder', 2);
|
||||
server.createList('user', 2);
|
||||
server.createList('document', 2);
|
||||
server.createList('permission', 4);
|
||||
server.createList('folder-permission', 2);
|
||||
server.createList('organization', 1);
|
||||
|
||||
if (options.beforeEach) {
|
||||
options.beforeEach.apply(this, arguments);
|
||||
}
|
||||
if (options.beforeEach) {
|
||||
options.beforeEach.apply(this, arguments);
|
||||
}
|
||||
|
||||
this.register = (fullName, Factory) => {
|
||||
let instance = this.application.__deprecatedInstance__;
|
||||
let registry = instance.register ? instance : instance.registry;
|
||||
this.register = (fullName, Factory) => {
|
||||
let instance = this.application.__deprecatedInstance__;
|
||||
let registry = instance.register ? instance : instance.registry;
|
||||
|
||||
return registry.register(fullName, Factory);
|
||||
};
|
||||
},
|
||||
return registry.register(fullName, Factory);
|
||||
};
|
||||
},
|
||||
|
||||
afterEach() {
|
||||
destroyApp(this.application);
|
||||
afterEach() {
|
||||
destroyApp(this.application);
|
||||
|
||||
if (options.afterEach) {
|
||||
options.afterEach.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (options.afterEach) {
|
||||
options.afterEach.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,16 +9,16 @@ import './stub-user-notification';
|
|||
import './authenticate-user';
|
||||
|
||||
export default function startApp(attrs) {
|
||||
let application;
|
||||
let application;
|
||||
|
||||
let attributes = Ember.merge({}, config.APP);
|
||||
attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
|
||||
let attributes = Ember.merge({}, config.APP);
|
||||
attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
|
||||
|
||||
Ember.run(() => {
|
||||
application = Application.create(attributes);
|
||||
application.setupForTesting();
|
||||
application.injectTestHelpers();
|
||||
});
|
||||
Ember.run(() => {
|
||||
application = Application.create(attributes);
|
||||
application.setupForTesting();
|
||||
application.injectTestHelpers();
|
||||
});
|
||||
|
||||
return application;
|
||||
return application;
|
||||
}
|
||||
|
|
|
@ -10,17 +10,16 @@
|
|||
<meta property="dbname" content="{{.DBname}}" />
|
||||
<meta property="dbhash" content="{{.DBhash}}" />
|
||||
<meta name="author" content="Documize" />
|
||||
|
||||
<style>
|
||||
#ember-testing-container, #ember-testing-container * {
|
||||
/* Set position static to short-circuit Hubspot Tether's positioning */
|
||||
/* https://github.com/HubSpot/tether/pull/98/ */
|
||||
position: static !important;
|
||||
}
|
||||
.tether-container * {
|
||||
z-index: 9999;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
#ember-testing {
|
||||
zoom: 100% !important;
|
||||
}
|
||||
#ember-testing-container {
|
||||
/* Set position static to short-circuit Hubspot Tether's positioning */
|
||||
/* https://github.com/HubSpot/tether/pull/98/ */
|
||||
position: static !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
{{content-for "head"}}
|
||||
{{content-for "test-head"}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue