Add ember to project

This commit is contained in:
Tom Price
2016-08-09 13:18:19 +01:00
parent 024f08562b
commit bfdf0cabbe
139 changed files with 454 additions and 1 deletions

52
tests/.jshintrc Normal file
View File

@@ -0,0 +1,52 @@
{
"predef": [
"document",
"window",
"location",
"setTimeout",
"$",
"-Promise",
"define",
"console",
"visit",
"exists",
"fillIn",
"click",
"keyEvent",
"triggerEvent",
"find",
"findWithAssert",
"wait",
"DS",
"andThen",
"currentURL",
"currentPath",
"currentRouteName"
],
"node": false,
"browser": false,
"boss": true,
"curly": true,
"debug": false,
"devel": false,
"eqeqeq": true,
"evil": true,
"forin": false,
"immed": false,
"laxbreak": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": false,
"nomen": false,
"onevar": false,
"plusplus": false,
"regexp": false,
"undef": true,
"sub": true,
"strict": false,
"white": false,
"eqnull": true,
"esversion": 6,
"unused": true
}

View File

@@ -0,0 +1,5 @@
import Ember from 'ember';
export default function destroyApp(application) {
Ember.run(application, 'destroy');
}

View File

@@ -0,0 +1,24 @@
import {module} from 'qunit';
import Ember from 'ember';
import startApp from '../helpers/start-app';
import destroyApp from '../helpers/destroy-app';
const {RSVP: {Promise}} = Ember;
export default function (name, options = {}) {
module(name, {
beforeEach() {
this.application = startApp();
if (options.beforeEach) {
return options.beforeEach.apply(this, arguments);
}
},
afterEach() {
let afterEach = options.afterEach && options.afterEach.apply(this, arguments);
return Promise.resolve(afterEach).then(() = > destroyApp(this.application)
)
};
});
}

11
tests/helpers/resolver.js Normal file
View File

@@ -0,0 +1,11 @@
import Resolver from '../../resolver';
import config from '../../config/environment';
const resolver = Resolver.create();
resolver.namespace = {
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix
};
export default resolver;

View File

@@ -0,0 +1,17 @@
import Ember from 'ember';
import Application from '../../app';
import config from '../../config/environment';
export default function startApp(attrs) {
let application;
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();
})
return application;
}

33
tests/index.html Normal file
View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>PyRIGS Tests</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
{{ content-for "head"}}
{{ content-for "test-head"}}
<link rel="stylesheet" href="{{ rootURL }}assets/vendor.css">
<link rel="stylesheet" href="{{ rootURL }}assets/py-rigs.css">
<link rel="stylesheet" href="{{ rootURL }}assets/test-support.css">
{{ content-for "head-footer"}}
{{ content-for "test-head-footer"}}
</head>
<body>
{{ content-for "body"}}
{{ content-for "test-body"}}
<script src="{{ rootURL }}testem.js" integrity=""></script>
<script src="{{ rootURL }}assets/vendor.js"></script>
<script src="{{ rootURL }}assets/test-support.js"></script>
<script src="{{ rootURL }}assets/py-rigs.js"></script>
<script src="{{ rootURL }}assets/tests.js"></script>
{{ content-for "body-footer"}}
{{ content-for "test-body-footer"}}
</body>
</html>

View File

6
tests/test-helper.js Normal file
View File

@@ -0,0 +1,6 @@
import resolver from './helpers/resolver';
import {
setResolver
} from 'ember-qunit';
setResolver(resolver);

0
tests/unit/.gitkeep Normal file
View File