Update Ember to 3.1

This commit is contained in:
2018-04-16 13:42:08 +02:00
parent e009caaf25
commit b09f19f399
156 changed files with 10149 additions and 16972 deletions
-52
View File
@@ -1,52 +0,0 @@
{
"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
-5
View File
@@ -1,5 +0,0 @@
import Ember from 'ember';
export default function destroyApp(application) {
Ember.run(application, 'destroy');
}
-23
View File
@@ -1,23 +0,0 @@
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
View File
@@ -1,11 +0,0 @@
import Resolver from '../../resolver';
import config from '../../config/environment';
const resolver = Resolver.create();
resolver.namespace = {
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix
};
export default resolver;
-18
View File
@@ -1,18 +0,0 @@
import Ember from 'ember';
import Application from '../../app';
import config from '../../config/environment';
export default function startApp(attrs) {
let application;
// use defaults, but you can override
let attributes = Ember.assign({}, config.APP, attrs);
Ember.run(() => {
application = Application.create(attributes);
application.setupForTesting();
application.injectTestHelpers();
});
return application;
}
@@ -1,16 +1,18 @@
import { moduleForComponent, test } from 'ember-qunit';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('add-proposal', 'Integration | Component | add proposal', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{add-proposal}}`);
assert.equal(this.$('.actions a').text().trim(), 'Back');
module('Integration | Component | add proposal', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
await render(hbs`{{add-proposal}}`);
assert.equal(find('.actions a').textContent.trim(), 'Back');
});
});
@@ -1,16 +1,18 @@
import { moduleForComponent, test } from 'ember-qunit';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('contributor-list', 'Integration | Component | contributor list', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{contributor-list}}`);
assert.equal(this.$().text().trim(), '');
module('Integration | Component | contributor list', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
await render(hbs`{{contributor-list}}`);
assert.equal(find('*').textContent.trim(), '');
});
});
@@ -1,16 +1,18 @@
import { moduleForComponent, test } from 'ember-qunit';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('loading-spinner', 'Integration | Component | loading spinner', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{loading-spinner}}`);
assert.equal(this.$().text().trim(), 'Loading data from Ethereum...');
module('Integration | Component | loading spinner', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
await render(hbs`{{loading-spinner}}`);
assert.equal(find('*').textContent.trim(), 'Loading data from Ethereum...');
});
});
@@ -1,16 +1,18 @@
import { moduleForComponent, test } from 'ember-qunit';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('proposal-list', 'Integration | Component | proposal list', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{proposal-list}}`);
assert.equal(this.$().text().trim(), '');
module('Integration | Component | proposal list', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
await render(hbs`{{proposal-list}}`);
assert.equal(find('*').textContent.trim(), '');
});
});
+7 -5
View File
@@ -1,6 +1,8 @@
import resolver from './helpers/resolver';
import {
setResolver
} from 'ember-qunit';
import Application from '../app';
import config from '../config/environment';
import { setApplication } from '@ember/test-helpers';
import { start } from 'ember-qunit';
setResolver(resolver);
setApplication(Application.create(config.APP));
start();
+9 -9
View File
@@ -1,12 +1,12 @@
import { moduleFor, test } from 'ember-qunit';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
moduleFor('controller:application', 'Unit | Controller | application', {
// Specify the other units that are required for this test.
// needs: ['controller:foo']
});
module('Unit | Controller | application', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.subject();
assert.ok(controller);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:application');
assert.ok(controller);
});
});
+23 -27
View File
@@ -1,33 +1,29 @@
import Ember from 'ember';
import { isEmpty, isPresent } from '@ember/utils';
import Contributor from 'kredits-web/models/contributor';
import { moduleFor, test } from 'ember-qunit';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
const {
isPresent,
isEmpty
} = Ember;
module('Unit | Controller | index', function(hooks) {
setupTest(hooks);
moduleFor('controller:index', 'Unit | Controller | index', {
needs: ['service:kredits']
});
let addFixtures = function(controller) {
[
{ github_username: "neo", github_uid: "318", balance: 10000 },
{ github_username: "morpheus", github_uid: "843", balance: 15000 },
{ github_username: "trinity", github_uid: "123", balance: 5000 },
{ github_username: "mouse", github_uid: "696", balance: 0 }
].forEach(fixture => {
controller.get('kredits.contributors').push(Contributor.create(fixture));
});
};
let addFixtures = function(controller) {
[
{ github_username: "neo", github_uid: "318", balance: 10000 },
{ github_username: "morpheus", github_uid: "843", balance: 15000 },
{ github_username: "trinity", github_uid: "123", balance: 5000 },
{ github_username: "mouse", github_uid: "696", balance: 0 }
].forEach(fixture => {
controller.get('kredits.contributors').push(Contributor.create(fixture));
test('doesn\'t contain people with 0 balance', function(assert) {
let controller = this.owner.lookup('controller:index');
addFixtures(controller);
let contributorsSorted = controller.get('contributorsSorted');
assert.ok(isPresent(contributorsSorted.findBy('github_username', 'neo')));
assert.ok(isEmpty(contributorsSorted.findBy('github_username', 'mouse')));
});
};
test('doesn\'t contain people with 0 balance', function(assert) {
let controller = this.subject();
addFixtures(controller);
let contributorsSorted = controller.get('contributorsSorted');
assert.ok(isPresent(contributorsSorted.findBy('github_username', 'neo')));
assert.ok(isEmpty(contributorsSorted.findBy('github_username', 'mouse')));
});
+9 -9
View File
@@ -1,12 +1,12 @@
import { moduleFor, test } from 'ember-qunit';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
moduleFor('controller:proposals/new', 'Unit | Controller | proposals/new', {
// Specify the other units that are required for this test.
// needs: ['controller:foo']
});
module('Unit | Controller | proposals/new', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.subject();
assert.ok(controller);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:proposals/new');
assert.ok(controller);
});
});
@@ -1,42 +1,42 @@
import { module, test } from 'ember-qunit';
import { module, test } from 'qunit';
import schemas from 'npm:kosmos-schemas';
import tv4 from 'npm:tv4';
import ContributionSerializer from 'kredits-web/lib/kredits/serializers/contribution';
module('Serializers contribution');
module('Serializers contribution', function() {
test('#serialize returns a valid JSON-LD representation', function(assert) {
let serialized = ContributionSerializer.serialize({
kind: 'design',
description: 'New logo design',
url: 'http://opensourcedesign.org',
contributorIpfsHash: 'QmT2A7rY4e7uoKktkcFHQNN7BD1oXdZTgd8wNkr1u9nNVE'
});
test('#serialize returns a valid JSON-LD representation', function(assert) {
let serialized = ContributionSerializer.serialize({
kind: 'design',
description: 'New logo design',
url: 'http://opensourcedesign.org',
contributorIpfsHash: 'QmT2A7rY4e7uoKktkcFHQNN7BD1oXdZTgd8wNkr1u9nNVE'
let valid = tv4.validate(JSON.parse(serialized), schemas['contribution']);
assert.ok(valid);
});
let valid = tv4.validate(JSON.parse(serialized), schemas['contribution']);
assert.ok(valid);
});
test('#deserialize returns a valid object representation', function(assert) {
let json = JSON.stringify({
"@context": "https://schema.kosmos.org",
"@type": "Contribution",
"contributor": {
"ipfs": "QmT2A7rY4e7uoKktkcFHQNN7BD1oXdZTgd8wNkr1u9nNVE"
},
"kind": "design",
"description": "New logo design",
"details": {},
"url": "http://opensourcedesign.org"
});
let deserialized = ContributionSerializer.deserialize(json);
test('#deserialize returns a valid object representation', function(assert) {
let json = JSON.stringify({
"@context": "https://schema.kosmos.org",
"@type": "Contribution",
"contributor": {
"ipfs": "QmT2A7rY4e7uoKktkcFHQNN7BD1oXdZTgd8wNkr1u9nNVE"
},
"kind": "design",
"description": "New logo design",
"details": {},
"url": "http://opensourcedesign.org"
let expected = {
kind: 'design',
description: 'New logo design',
details: {},
url: 'http://opensourcedesign.org',
ipfsData: json,
};
assert.deepEqual(expected, deserialized);
});
let deserialized = ContributionSerializer.deserialize(json);
let expected = {
kind: 'design',
description: 'New logo design',
details: {},
url: 'http://opensourcedesign.org',
ipfsData: json,
};
assert.deepEqual(expected, deserialized);
});
@@ -1,53 +1,53 @@
import { module, test } from 'ember-qunit';
import { module, test } from 'qunit';
import schemas from 'npm:kosmos-schemas';
import tv4 from 'npm:tv4';
import ContributorSerializer from 'kredits-web/lib/kredits/serializers/contributor';
module('Serializers contributor');
module('Serializers contributor', function() {
test('#serialize returns a valid JSON-LD representation', function(assert) {
let serialized = ContributorSerializer.serialize({
name: 'Satoshi Nakamoto',
kind: 'person',
github_uid: 123,
github_username: 'therealsatoshi',
wiki_username: 'Satoshi',
});
test('#serialize returns a valid JSON-LD representation', function(assert) {
let serialized = ContributorSerializer.serialize({
name: 'Satoshi Nakamoto',
kind: 'person',
github_uid: 123,
github_username: 'therealsatoshi',
wiki_username: 'Satoshi',
let valid = tv4.validate(JSON.parse(serialized), schemas['contributor']);
assert.ok(valid);
});
let valid = tv4.validate(JSON.parse(serialized), schemas['contributor']);
assert.ok(valid);
});
test('#deserialize returns a valid object representation', function(assert) {
let json = JSON.stringify({
"@context": "https://schema.kosmos.org",
"@type": "Contributor",
"kind": "person",
"name": "Satoshi Nakamoto",
"accounts": [
{
"site": "github.com",
"uid": 123,
"username": "therealsatoshi",
"url": "https://github.com/therealsatoshi"
},
{
"site": "wiki.kosmos.org",
"username": "Satoshi",
"url": "https://wiki.kosmos.org/User:Satoshi"
}
]
});
let deserialized = ContributorSerializer.deserialize(json);
test('#deserialize returns a valid object representation', function(assert) {
let json = JSON.stringify({
"@context": "https://schema.kosmos.org",
"@type": "Contributor",
"kind": "person",
"name": "Satoshi Nakamoto",
"accounts": [
{
"site": "github.com",
"uid": 123,
"username": "therealsatoshi",
"url": "https://github.com/therealsatoshi"
},
{
"site": "wiki.kosmos.org",
"username": "Satoshi",
"url": "https://wiki.kosmos.org/User:Satoshi"
}
]
let expected = {
name: 'Satoshi Nakamoto',
kind: 'person',
github_uid: 123,
github_username: 'therealsatoshi',
wiki_username: 'Satoshi',
url: undefined,
ipfsData: json,
};
assert.deepEqual(expected, deserialized);
});
let deserialized = ContributorSerializer.deserialize(json);
let expected = {
name: 'Satoshi Nakamoto',
kind: 'person',
github_uid: 123,
github_username: 'therealsatoshi',
wiki_username: 'Satoshi',
url: undefined,
ipfsData: json,
};
assert.deepEqual(expected, deserialized);
});
+11 -6
View File
@@ -1,10 +1,15 @@
import { moduleFor, test } from 'ember-qunit';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
moduleFor('model:contributor', 'Unit | Model | contributor');
import { run } from '@ember/runloop';
test('#avatarURL() returns correct URL', function(assert) {
let model = this.subject();
model.set('github_uid', '318');
module('Unit | Model | contributor', function(hooks) {
setupTest(hooks);
assert.equal(model.get('avatarURL'), 'https://avatars2.githubusercontent.com/u/318?v=3&s=128');
test('#avatarURL() returns correct URL', function(assert) {
let model = run(() => this.owner.lookup('service:store').createRecord('contributor'));
model.set('github_uid', '318');
assert.equal(model.get('avatarURL'), 'https://avatars2.githubusercontent.com/u/318?v=3&s=128');
});
});
+8 -8
View File
@@ -1,11 +1,11 @@
import { moduleFor, test } from 'ember-qunit';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
moduleFor('route:application', 'Unit | Route | application', {
// Specify the other units that are required for this test.
// needs: ['controller:foo']
});
module('Unit | Route | application', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.subject();
assert.ok(route);
test('it exists', function(assert) {
let route = this.owner.lookup('route:application');
assert.ok(route);
});
});
+8 -8
View File
@@ -1,11 +1,11 @@
import { moduleFor, test } from 'ember-qunit';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
moduleFor('route:spinner', 'Unit | Route | spinner', {
// Specify the other units that are required for this test.
// needs: ['controller:foo']
});
module('Unit | Route | spinner', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.subject();
assert.ok(route);
test('it exists', function(assert) {
let route = this.owner.lookup('route:spinner');
assert.ok(route);
});
});
+9 -9
View File
@@ -1,12 +1,12 @@
import { moduleFor, test } from 'ember-qunit';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
moduleFor('service:kredits', 'Unit | Service | kredits', {
// Specify the other units that are required for this test.
// needs: ['service:foo']
});
module('Unit | Service | kredits', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let service = this.subject();
assert.ok(service);
// Replace this with your real tests.
test('it exists', function(assert) {
let service = this.owner.lookup('service:kredits');
assert.ok(service);
});
});