Merge branch 'master' into clostridium
* master: (27 commits) Temporary fix for quill editor use in strains edit Test new species (plus minor cleanup) Wrapping up form cleanup Quill DDAU Fixed up checkbox input WIP (checkbox) ember-one-way-input DeleteModel Mixin Using mixins on new species ElevatedAccess Mixin SaveModel Mixin Refactor species edit Refactor species/show fix format date import nvm Drop node version trying a different phantomjs route Rough in species index test Tweak mirage config ember-cli-mirage ...
This commit is contained in:
commit
d674d07951
54 changed files with 549 additions and 267 deletions
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"predef": [
|
||||
"server",
|
||||
"document",
|
||||
"window",
|
||||
"location",
|
||||
|
|
70
tests/acceptance/species-test.js
Normal file
70
tests/acceptance/species-test.js
Normal file
|
@ -0,0 +1,70 @@
|
|||
import Ember from 'ember';
|
||||
import { module, test } from 'qunit';
|
||||
import startApp from '../helpers/start-app';
|
||||
import { authenticateSession } from '../helpers/ember-simple-auth';
|
||||
|
||||
module('Acceptance | species', {
|
||||
beforeEach: function() {
|
||||
this.application = startApp();
|
||||
authenticateSession(this.application, {
|
||||
access_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiYWN0ZGIiLCJzdWIiOiIxIiwiZXhwIjoxNDQ2NTAyMjI2LCJpYXQiOjE0NDY0OTg2MjZ9.vIjKHAsp2TkCV505EbtCo2xQT-2oQkB-Nv5y0b6E7Mg"
|
||||
});
|
||||
server.create('users', { role: 'A', canEdit: true });
|
||||
},
|
||||
|
||||
afterEach: function() {
|
||||
Ember.run(this.application, 'destroy');
|
||||
}
|
||||
});
|
||||
|
||||
test('visiting /species', function(assert) {
|
||||
const species = server.createList('species', 20);
|
||||
visit('/species');
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(currentURL(), '/species');
|
||||
assert.equal(find(".flakes-table > tbody > tr").length, species.length);
|
||||
assert.equal(find("#total-species").text(), "Total species: 20");
|
||||
});
|
||||
});
|
||||
|
||||
test('visiting /species/:id', function(assert) {
|
||||
const species = server.create('species');
|
||||
visit(`/species/${species.id}`);
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(currentURL(), `/species/${species.id}`);
|
||||
assert.equal(find(".flakes-information-box > legend > em").text().trim(), species.speciesName);
|
||||
});
|
||||
});
|
||||
|
||||
test('editing /species/:id/edit', function(assert) {
|
||||
const species = server.create('species', { 'canEdit': true });
|
||||
visit(`/species/${species.id}/edit`);
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(currentURL(), `/species/${species.id}/edit`);
|
||||
|
||||
fillIn('.species-name', 'Revised Species Name');
|
||||
click('.save-species');
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(currentURL(), `/species/${species.id}`);
|
||||
assert.equal(find(".flakes-information-box > legend > em").text().trim(), 'Revised Species Name');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('creating /species/new', function(assert) {
|
||||
visit(`/species/new`);
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(currentURL(), `/species/new`);
|
||||
fillIn('.species-name', 'New Species Name');
|
||||
click('.save-species');
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(find(".flakes-information-box > legend > em").text().trim(), 'New Species Name');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,5 +1,5 @@
|
|||
import resolver from './helpers/resolver';
|
||||
import flashMessageHelper from './helpers/flash-message';
|
||||
// import flashMessageHelper from './helpers/flash-message';
|
||||
|
||||
import {
|
||||
setResolver
|
||||
|
|
12
tests/unit/mixins/delete-model-test.js
Normal file
12
tests/unit/mixins/delete-model-test.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import Ember from 'ember';
|
||||
import DeleteModelMixin from '../../../mixins/delete-model';
|
||||
import { module, test } from 'qunit';
|
||||
|
||||
module('Unit | Mixin | delete model');
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it works', function(assert) {
|
||||
var DeleteModelObject = Ember.Object.extend(DeleteModelMixin);
|
||||
var subject = DeleteModelObject.create();
|
||||
assert.ok(subject);
|
||||
});
|
12
tests/unit/mixins/elevated-access-test.js
Normal file
12
tests/unit/mixins/elevated-access-test.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import Ember from 'ember';
|
||||
import ElevatedAccessMixin from '../../../mixins/elevated-access';
|
||||
import { module, test } from 'qunit';
|
||||
|
||||
module('Unit | Mixin | elevated access');
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it works', function(assert) {
|
||||
var ElevatedAccessObject = Ember.Object.extend(ElevatedAccessMixin);
|
||||
var subject = ElevatedAccessObject.create();
|
||||
assert.ok(subject);
|
||||
});
|
12
tests/unit/mixins/save-model-test.js
Normal file
12
tests/unit/mixins/save-model-test.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import Ember from 'ember';
|
||||
import SaveModelMixin from '../../../mixins/save-model';
|
||||
import { module, test } from 'qunit';
|
||||
|
||||
module('Unit | Mixin | save model');
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it works', function(assert) {
|
||||
var SaveModelObject = Ember.Object.extend(SaveModelMixin);
|
||||
var subject = SaveModelObject.create();
|
||||
assert.ok(subject);
|
||||
});
|
|
@ -5,7 +5,7 @@ import {
|
|||
|
||||
moduleForModel('measurement', {
|
||||
// Specify the other units that are required for this test.
|
||||
needs: ['model:strain']
|
||||
needs: ['model:strain', 'model:characteristic']
|
||||
});
|
||||
|
||||
test('it exists', function(assert) {
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
|
||||
moduleForModel('strain', {
|
||||
// Specify the other units that are required for this test.
|
||||
needs: ['model:measurement']
|
||||
needs: ['model:measurement', 'model:characteristic', 'model:species']
|
||||
});
|
||||
|
||||
test('it exists', function(assert) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import parseBase64 from '../../../utils/parse-base64';
|
||||
import { module, test } from 'qunit';
|
||||
|
||||
module('Unit | Utility | parse base64');
|
||||
module('parseBase64');
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it works', function(assert) {
|
||||
var result = parseBase64();
|
||||
var result = parseBase64('123');
|
||||
assert.ok(result);
|
||||
});
|
||||
|
|
Reference in a new issue