deps: upgrade ember to 2.18
This commit is contained in:
parent
0749668435
commit
11265cb82d
87 changed files with 1697 additions and 1373 deletions
47
.eslintrc.js
47
.eslintrc.js
|
@ -7,11 +7,54 @@ module.exports = {
|
||||||
ecmaVersion: 2017,
|
ecmaVersion: 2017,
|
||||||
sourceType: 'module'
|
sourceType: 'module'
|
||||||
},
|
},
|
||||||
extends: 'eslint:recommended',
|
plugins: [
|
||||||
|
'ember'
|
||||||
|
],
|
||||||
|
extends: [
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:ember/recommended'
|
||||||
|
],
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
es6: true
|
es6: true
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
}
|
},
|
||||||
|
overrides: [
|
||||||
|
// node files
|
||||||
|
{
|
||||||
|
files: [
|
||||||
|
'testem.js',
|
||||||
|
'ember-cli-build.js',
|
||||||
|
'config/**/*.js',
|
||||||
|
'lib/*/index.js'
|
||||||
|
],
|
||||||
|
parserOptions: {
|
||||||
|
sourceType: 'script',
|
||||||
|
ecmaVersion: 2015
|
||||||
|
},
|
||||||
|
env: {
|
||||||
|
browser: false,
|
||||||
|
node: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// test files
|
||||||
|
{
|
||||||
|
files: ['tests/**/*.js'],
|
||||||
|
excludedFiles: ['tests/dummy/**/*.js'],
|
||||||
|
env: {
|
||||||
|
embertest: true
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
backButton: true,
|
||||||
|
pollHasUser: true,
|
||||||
|
pollHasUsersCount: true,
|
||||||
|
pollParticipate: true,
|
||||||
|
setupBrowserNavigationButtons: true,
|
||||||
|
switchTab: true,
|
||||||
|
t: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
7
.jscsrc
7
.jscsrc
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"preset": "ember-suave",
|
|
||||||
"disallowConstOutsideModuleScope": false,
|
|
||||||
"disallowDirectPropertyAccess": false,
|
|
||||||
"disallowEmberView": false,
|
|
||||||
"requireSpread": false
|
|
||||||
}
|
|
|
@ -45,6 +45,7 @@ before_script:
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# run frontend and integration tests
|
# run frontend and integration tests
|
||||||
|
- if $TEST_EMBER; then yarn run lint:js; fi
|
||||||
- if $TEST_EMBER; then yarn test; fi
|
- if $TEST_EMBER; then yarn test; fi
|
||||||
# test against different browsers using sauce lab
|
# test against different browsers using sauce lab
|
||||||
- if $TEST_SAUCE; then node_modules/ember-cli/bin/ember test --launch='SL_chrome,SL_firefox,SL_edge,SL_ie,SL_safari' --test-port 8080; fi
|
- if $TEST_SAUCE; then node_modules/ember-cli/bin/ember test --launch='SL_chrome,SL_firefox,SL_edge,SL_ie,SL_safari' --test-port 8080; fi
|
||||||
|
|
252
MODULE_REPORT.md
Normal file
252
MODULE_REPORT.md
Normal file
|
@ -0,0 +1,252 @@
|
||||||
|
## Module Report
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/controllers/create.js` at line 3
|
||||||
|
|
||||||
|
```js
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
const { computed, Controller, getOwner, inject } = Ember;
|
||||||
|
|
||||||
|
const formStepObject = Ember.Object.extend({
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/adapters/application.js` at line 5
|
||||||
|
|
||||||
|
```js
|
||||||
|
|
||||||
|
const { RESTAdapter } = DS;
|
||||||
|
const { inject } = Ember;
|
||||||
|
|
||||||
|
export default RESTAdapter.extend({
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/controllers/poll.js` at line 7
|
||||||
|
|
||||||
|
```js
|
||||||
|
computed,
|
||||||
|
Controller,
|
||||||
|
inject,
|
||||||
|
isEmpty,
|
||||||
|
isPresent,
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/components/create-options-dates.js` at line 4
|
||||||
|
|
||||||
|
```js
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
|
const { computed, Component, inject, isArray, isEmpty } = Ember;
|
||||||
|
|
||||||
|
export default Component.extend({
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/components/create-options-datetime.js` at line 9
|
||||||
|
|
||||||
|
```js
|
||||||
|
import Form from 'ember-bootstrap/components/bs-form';
|
||||||
|
|
||||||
|
const { computed, Component, inject, isArray, isEmpty, isPresent, observer } = Ember;
|
||||||
|
const { filter, mapBy, readOnly } = computed;
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/components/create-options-text.js` at line 5
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { anyBy } from 'ember-array-computed-macros';
|
||||||
|
|
||||||
|
const { Component, computed, inject, observer, run } = Ember;
|
||||||
|
|
||||||
|
export default Component.extend({
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/components/create-options.js` at line 7
|
||||||
|
|
||||||
|
```js
|
||||||
|
from 'ember-cp-validations';
|
||||||
|
|
||||||
|
const { Component, inject } = Ember;
|
||||||
|
|
||||||
|
let Validations = buildValidations({
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/components/form-navigation-buttons.js` at line 4
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { translationMacro as t } from 'ember-i18n';
|
||||||
|
|
||||||
|
const { Component, computed, get, inject } = Ember;
|
||||||
|
|
||||||
|
export default Component.extend({
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/components/language-select.js` at line 4
|
||||||
|
|
||||||
|
```js
|
||||||
|
import localesMeta from 'croodle/locales/meta';
|
||||||
|
|
||||||
|
const { Component, computed, inject } = Ember;
|
||||||
|
|
||||||
|
export default Component.extend({
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/components/poll-evaluation-chart.js` at line 4
|
||||||
|
|
||||||
|
```js
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
|
const { Component, computed, get, inject, isArray, isPresent } = Ember;
|
||||||
|
|
||||||
|
const addArrays = function() {
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/models/option.js` at line 12
|
||||||
|
|
||||||
|
```js
|
||||||
|
|
||||||
|
const { attr } = DS;
|
||||||
|
const { assert, computed, inject, isEmpty } = Ember;
|
||||||
|
|
||||||
|
const Validations = buildValidations({
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/controllers/create/index.js` at line 7
|
||||||
|
|
||||||
|
```js
|
||||||
|
from 'ember-cp-validations';
|
||||||
|
|
||||||
|
const { computed, Controller, getOwner, Object: EmberObject, inject } = Ember;
|
||||||
|
|
||||||
|
const Validations = buildValidations({
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/controllers/create/meta.js` at line 7
|
||||||
|
|
||||||
|
```js
|
||||||
|
from 'ember-cp-validations';
|
||||||
|
|
||||||
|
const { computed, Controller, inject } = Ember;
|
||||||
|
|
||||||
|
const Validations = buildValidations({
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/controllers/create/settings.js` at line 13
|
||||||
|
|
||||||
|
```js
|
||||||
|
copy,
|
||||||
|
getOwner,
|
||||||
|
inject,
|
||||||
|
isEmpty,
|
||||||
|
Object: EmberObject,
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.ObjectController`
|
||||||
|
|
||||||
|
**Location**: `app/controllers/modal/save-retry.js` at line 3
|
||||||
|
|
||||||
|
```js
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
const { $, ObjectController } = Ember;
|
||||||
|
|
||||||
|
export default ObjectController.extend({
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/controllers/poll/evaluation.js` at line 3
|
||||||
|
|
||||||
|
```js
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
const { $, computed, Controller, inject } = Ember;
|
||||||
|
|
||||||
|
export default Controller.extend({
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.inject`
|
||||||
|
|
||||||
|
**Location**: `app/controllers/poll/participation.js` at line 12
|
||||||
|
|
||||||
|
```js
|
||||||
|
Controller,
|
||||||
|
getOwner,
|
||||||
|
inject,
|
||||||
|
isEmpty,
|
||||||
|
isPresent,
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.K`
|
||||||
|
|
||||||
|
**Location**: `tests/helpers/flash-message.js` at line 4
|
||||||
|
|
||||||
|
```js
|
||||||
|
import FlashObject from 'ember-cli-flash/flash/object';
|
||||||
|
|
||||||
|
const { K } = Ember;
|
||||||
|
|
||||||
|
FlashObject.reopen({ init: K });
|
||||||
|
```
|
|
@ -1,11 +1,10 @@
|
||||||
|
import { inject as service } from '@ember/service';
|
||||||
import DS from 'ember-data';
|
import DS from 'ember-data';
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
const { RESTAdapter } = DS;
|
const { RESTAdapter } = DS;
|
||||||
const { inject } = Ember;
|
|
||||||
|
|
||||||
export default RESTAdapter.extend({
|
export default RESTAdapter.extend({
|
||||||
encryption: inject.service(),
|
encryption: service(),
|
||||||
|
|
||||||
// set namespace to api.php in same subdirectory
|
// set namespace to api.php in same subdirectory
|
||||||
namespace:
|
namespace:
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
import Ember from 'ember';
|
import Application from '@ember/application';
|
||||||
import Resolver from './resolver';
|
import Resolver from './resolver';
|
||||||
import loadInitializers from 'ember-load-initializers';
|
import loadInitializers from 'ember-load-initializers';
|
||||||
import config from './config/environment';
|
import config from './config/environment';
|
||||||
|
|
||||||
const { Application } = Ember;
|
const App = Application.extend({
|
||||||
|
|
||||||
let App;
|
|
||||||
|
|
||||||
App = Application.extend({
|
|
||||||
modulePrefix: config.modulePrefix,
|
modulePrefix: config.modulePrefix,
|
||||||
podModulePrefix: config.podModulePrefix,
|
podModulePrefix: config.podModulePrefix,
|
||||||
Resolver
|
Resolver
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import { computed } from '@ember/object';
|
||||||
|
import Component from '@ember/component';
|
||||||
|
import { isArray } from '@ember/array';
|
||||||
|
import { isEmpty } from '@ember/utils';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
const { computed, Component, inject, isArray, isEmpty } = Ember;
|
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* maps optionsDates for bootstrap datepicker as a simple array of date objects
|
* maps optionsDates for bootstrap datepicker as a simple array of date objects
|
||||||
|
@ -89,5 +91,5 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
store: inject.service('store')
|
store: service('store')
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import { readOnly, mapBy, filter } from '@ember/object/computed';
|
||||||
|
import Component from '@ember/component';
|
||||||
|
import { isArray } from '@ember/array';
|
||||||
|
import { isPresent, isEmpty } from '@ember/utils';
|
||||||
|
import { observer, computed } from '@ember/object';
|
||||||
import {
|
import {
|
||||||
validator, buildValidations
|
validator, buildValidations
|
||||||
}
|
}
|
||||||
|
@ -6,9 +11,6 @@ from 'ember-cp-validations';
|
||||||
import { groupBy } from 'ember-array-computed-macros';
|
import { groupBy } from 'ember-array-computed-macros';
|
||||||
import Form from 'ember-bootstrap/components/bs-form';
|
import Form from 'ember-bootstrap/components/bs-form';
|
||||||
|
|
||||||
const { computed, Component, inject, isArray, isEmpty, isPresent, observer } = Ember;
|
|
||||||
const { filter, mapBy, readOnly } = computed;
|
|
||||||
|
|
||||||
let modelValidations = buildValidations({
|
let modelValidations = buildValidations({
|
||||||
dates: [
|
dates: [
|
||||||
validator('collection', true),
|
validator('collection', true),
|
||||||
|
@ -191,5 +193,5 @@ export default Component.extend(modelValidations, {
|
||||||
}, {});
|
}, {});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
store: inject.service()
|
store: service()
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import { filter } from '@ember/object/computed';
|
||||||
|
import Component from '@ember/component';
|
||||||
|
import { observer, computed } from '@ember/object';
|
||||||
|
import { run } from '@ember/runloop';
|
||||||
import BsFormElement from 'ember-bootstrap/components/bs-form/element';
|
import BsFormElement from 'ember-bootstrap/components/bs-form/element';
|
||||||
import { anyBy } from 'ember-array-computed-macros';
|
import { anyBy } from 'ember-array-computed-macros';
|
||||||
|
|
||||||
const { Component, computed, inject, observer, run } = Ember;
|
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
actions: {
|
actions: {
|
||||||
addOption(element) {
|
addOption(element) {
|
||||||
|
@ -44,7 +46,7 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
childFormElements: computed.filter('childViews', function(childView) {
|
childFormElements: filter('childViews', function(childView) {
|
||||||
return childView instanceof BsFormElement;
|
return childView instanceof BsFormElement;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -80,5 +82,5 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
}).on('init'),
|
}).on('init'),
|
||||||
|
|
||||||
store: inject.service('store')
|
store: service('store')
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import Component from '@ember/component';
|
||||||
import {
|
import {
|
||||||
validator, buildValidations
|
validator, buildValidations
|
||||||
}
|
}
|
||||||
from 'ember-cp-validations';
|
from 'ember-cp-validations';
|
||||||
|
|
||||||
const { Component, inject } = Ember;
|
|
||||||
|
|
||||||
let Validations = buildValidations({
|
let Validations = buildValidations({
|
||||||
options: [
|
options: [
|
||||||
validator('collection', true),
|
validator('collection', true),
|
||||||
|
@ -36,6 +35,6 @@ export default Component.extend(Validations, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// consumed by validator
|
// consumed by validator
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
shouldShowErrors: false
|
shouldShowErrors: false
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import Component from '@ember/component';
|
||||||
|
import { get, computed } from '@ember/object';
|
||||||
import { translationMacro as t } from 'ember-i18n';
|
import { translationMacro as t } from 'ember-i18n';
|
||||||
|
|
||||||
const { Component, computed, get, inject } = Ember;
|
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
actions: {
|
actions: {
|
||||||
prev() {
|
prev() {
|
||||||
|
@ -30,7 +30,7 @@ export default Component.extend({
|
||||||
*/
|
*/
|
||||||
disablePrevButton: false,
|
disablePrevButton: false,
|
||||||
|
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property nextButtonClasses
|
* @property nextButtonClasses
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import { readOnly } from '@ember/object/computed';
|
||||||
|
import Component from '@ember/component';
|
||||||
|
import { computed } from '@ember/object';
|
||||||
import localesMeta from 'croodle/locales/meta';
|
import localesMeta from 'croodle/locales/meta';
|
||||||
|
|
||||||
const { Component, computed, inject } = Ember;
|
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
tagName: 'select',
|
tagName: 'select',
|
||||||
classNames: [ 'language-select' ],
|
classNames: [ 'language-select' ],
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
moment: inject.service(),
|
moment: service(),
|
||||||
current: computed.readOnly('i18n.locale'),
|
current: readOnly('i18n.locale'),
|
||||||
|
|
||||||
locales: computed('i18n.locales', function() {
|
locales: computed('i18n.locales', function() {
|
||||||
let currentLocale = this.get('i18n.locale');
|
let currentLocale = this.get('i18n.locale');
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import Component from '@ember/component';
|
||||||
|
import { get, computed } from '@ember/object';
|
||||||
|
import { isArray } from '@ember/array';
|
||||||
|
import { isPresent } from '@ember/utils';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
const { Component, computed, get, inject, isArray, isPresent } = Ember;
|
|
||||||
|
|
||||||
const addArrays = function() {
|
const addArrays = function() {
|
||||||
let args = Array.prototype.slice.call(arguments);
|
let args = Array.prototype.slice.call(arguments);
|
||||||
let basis = args.shift();
|
let basis = args.shift();
|
||||||
|
@ -22,9 +24,9 @@ const addArrays = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: computed('users.[]', 'options.[]', 'options.@each.title', 'currentLocale', function() {
|
data: computed('users.[]', 'options.{[],each.title}', 'currentLocale', function() {
|
||||||
let labels = this.get('options').map((option) => {
|
let labels = this.get('options').map((option) => {
|
||||||
let value = get(option, 'title');
|
let value = get(option, 'title');
|
||||||
if (!get(this, 'isFindADate')) {
|
if (!get(this, 'isFindADate')) {
|
||||||
|
@ -77,36 +79,38 @@ export default Component.extend({
|
||||||
labels
|
labels
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
chartOptions: {
|
chartOptions: computed(function () {
|
||||||
legend: {
|
return {
|
||||||
display: false
|
legend: {
|
||||||
},
|
display: false
|
||||||
scales: {
|
},
|
||||||
xAxes: [{
|
scales: {
|
||||||
stacked: true
|
xAxes: [{
|
||||||
}],
|
stacked: true
|
||||||
yAxes: [{
|
}],
|
||||||
stacked: true,
|
yAxes: [{
|
||||||
ticks: {
|
stacked: true,
|
||||||
callback(value) {
|
ticks: {
|
||||||
return `${value} %`;
|
callback(value) {
|
||||||
},
|
return `${value} %`;
|
||||||
max: 100,
|
},
|
||||||
min: 0
|
max: 100,
|
||||||
}
|
min: 0
|
||||||
}]
|
}
|
||||||
},
|
}]
|
||||||
tooltips: {
|
},
|
||||||
mode: 'label',
|
tooltips: {
|
||||||
callbacks: {
|
mode: 'label',
|
||||||
label(tooltipItem, data) {
|
callbacks: {
|
||||||
let { datasets } = data;
|
label(tooltipItem, data) {
|
||||||
let { datasetIndex } = tooltipItem;
|
let { datasets } = data;
|
||||||
let { label } = datasets[datasetIndex];
|
let { datasetIndex } = tooltipItem;
|
||||||
let value = tooltipItem.yLabel;
|
let { label } = datasets[datasetIndex];
|
||||||
return `${label}: ${value} %`;
|
let value = tooltipItem.yLabel;
|
||||||
|
return `${label}: ${value} %`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
import Ember from 'ember';
|
import { observer } from '@ember/object';
|
||||||
|
import $ from 'jquery';
|
||||||
|
import { scheduleOnce, next } from '@ember/runloop';
|
||||||
|
import Component from '@ember/component';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { groupBy } from 'ember-awesome-macros/array';
|
import { groupBy } from 'ember-awesome-macros/array';
|
||||||
|
|
||||||
const {
|
|
||||||
Component
|
|
||||||
} = Ember;
|
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super();
|
this._super();
|
||||||
Ember.run.scheduleOnce('afterRender', this, function() {
|
scheduleOnce('afterRender', this, function() {
|
||||||
/*
|
/*
|
||||||
* adding floatThead jQuery plugin to poll table
|
* adding floatThead jQuery plugin to poll table
|
||||||
* https://mkoryak.github.io/floatThead/
|
* https://mkoryak.github.io/floatThead/
|
||||||
|
@ -21,7 +20,7 @@ export default Component.extend({
|
||||||
* has to be set to height of horizontal scrollbar which depends on
|
* has to be set to height of horizontal scrollbar which depends on
|
||||||
* used browser
|
* used browser
|
||||||
*/
|
*/
|
||||||
Ember.$('.user-selections-table').floatThead({
|
$('.user-selections-table').floatThead({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: this.getScrollbarHeight
|
top: this.getScrollbarHeight
|
||||||
});
|
});
|
||||||
|
@ -29,68 +28,68 @@ export default Component.extend({
|
||||||
/*
|
/*
|
||||||
* fix width calculation error caused by bootstrap glyphicon on webkit
|
* fix width calculation error caused by bootstrap glyphicon on webkit
|
||||||
*/
|
*/
|
||||||
Ember.$('.glyphicon').css('width', '14px');
|
$('.glyphicon').css('width', '14px');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* scrollbar on top of table
|
* scrollbar on top of table
|
||||||
*/
|
*/
|
||||||
const topScrollbarInner = Ember.$('<div></div>')
|
const topScrollbarInner = $('<div></div>')
|
||||||
.css('width', Ember.$('.user-selections-table').width())
|
.css('width', $('.user-selections-table').width())
|
||||||
.css('height', '1px');
|
.css('height', '1px');
|
||||||
const topScrollbarOuter = Ember.$('<div></div>')
|
const topScrollbarOuter = $('<div></div>')
|
||||||
.addClass('top-scrollbar')
|
.addClass('top-scrollbar')
|
||||||
.css('width', '100%')
|
.css('width', '100%')
|
||||||
.css('overflow-x', 'scroll')
|
.css('overflow-x', 'scroll')
|
||||||
.css('overflow-y', 'hidden')
|
.css('overflow-y', 'hidden')
|
||||||
.css('position', 'relative')
|
.css('position', 'relative')
|
||||||
.css('z-index', '1002');
|
.css('z-index', '1002');
|
||||||
Ember.$('.table-scroll').before(
|
$('.table-scroll').before(
|
||||||
topScrollbarOuter.append(topScrollbarInner)
|
topScrollbarOuter.append(topScrollbarInner)
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* scrollbar on top of table for thead
|
* scrollbar on top of table for thead
|
||||||
*/
|
*/
|
||||||
const topScrollbarInnerThead = Ember.$('<div></div>')
|
const topScrollbarInnerThead = $('<div></div>')
|
||||||
.css('width', Ember.$('.user-selections-table').width())
|
.css('width', $('.user-selections-table').width())
|
||||||
.css('height', '1px');
|
.css('height', '1px');
|
||||||
const topScrollbarOuterThead = Ember.$('<div></div>')
|
const topScrollbarOuterThead = $('<div></div>')
|
||||||
.addClass('top-scrollbar-floatThead')
|
.addClass('top-scrollbar-floatThead')
|
||||||
.css('width', Ember.$('.table-scroll').outerWidth())
|
.css('width', $('.table-scroll').outerWidth())
|
||||||
.css('overflow-x', 'scroll')
|
.css('overflow-x', 'scroll')
|
||||||
.css('overflow-y', 'hidden')
|
.css('overflow-y', 'hidden')
|
||||||
.css('position', 'fixed')
|
.css('position', 'fixed')
|
||||||
.css('top', '-1px')
|
.css('top', '-1px')
|
||||||
.css('z-index', '1002')
|
.css('z-index', '1002')
|
||||||
.css('margin-left', `${(Ember.$('.table-scroll').outerWidth() - Ember.$('.table-scroll').width()) / 2 * (-1)}px`)
|
.css('margin-left', `${($('.table-scroll').outerWidth() - $('.table-scroll').width()) / 2 * (-1)}px`)
|
||||||
.css('margin-right', `${(Ember.$('.table-scroll').outerWidth() - Ember.$('.table-scroll').width()) / 2 * (-1)}px`);
|
.css('margin-right', `${($('.table-scroll').outerWidth() - $('.table-scroll').width()) / 2 * (-1)}px`);
|
||||||
Ember.$('.table-scroll').prepend(
|
$('.table-scroll').prepend(
|
||||||
topScrollbarOuterThead.append(topScrollbarInnerThead).hide()
|
topScrollbarOuterThead.append(topScrollbarInnerThead).hide()
|
||||||
);
|
);
|
||||||
|
|
||||||
// add listener to resize scrollbars if window get resized
|
// add listener to resize scrollbars if window get resized
|
||||||
Ember.$(window).resize(this.resizeScrollbars);
|
$(window).resize(this.resizeScrollbars);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bind scroll event on all scrollbars
|
* bind scroll event on all scrollbars
|
||||||
*/
|
*/
|
||||||
Ember.$('.table-scroll').scroll(function() {
|
$('.table-scroll').scroll(function() {
|
||||||
Ember.$('.top-scrollbar').scrollLeft(Ember.$('.table-scroll').scrollLeft());
|
$('.top-scrollbar').scrollLeft($('.table-scroll').scrollLeft());
|
||||||
Ember.$('.top-scrollbar-floatThead').scrollLeft(Ember.$('.table-scroll').scrollLeft());
|
$('.top-scrollbar-floatThead').scrollLeft($('.table-scroll').scrollLeft());
|
||||||
});
|
});
|
||||||
Ember.$('.top-scrollbar').scroll(function() {
|
$('.top-scrollbar').scroll(function() {
|
||||||
Ember.$('.table-scroll').scrollLeft(Ember.$('.top-scrollbar').scrollLeft());
|
$('.table-scroll').scrollLeft($('.top-scrollbar').scrollLeft());
|
||||||
Ember.$('.top-scrollbar-floatThead').scrollLeft(Ember.$('.top-scrollbar').scrollLeft());
|
$('.top-scrollbar-floatThead').scrollLeft($('.top-scrollbar').scrollLeft());
|
||||||
});
|
});
|
||||||
Ember.$('.top-scrollbar-floatThead').scroll(function() {
|
$('.top-scrollbar-floatThead').scroll(function() {
|
||||||
Ember.$('.table-scroll').scrollLeft(Ember.$('.top-scrollbar-floatThead').scrollLeft());
|
$('.table-scroll').scrollLeft($('.top-scrollbar-floatThead').scrollLeft());
|
||||||
Ember.$('.top-scrollbar').scrollLeft(Ember.$('.top-scrollbar-floatThead').scrollLeft());
|
$('.top-scrollbar').scrollLeft($('.top-scrollbar-floatThead').scrollLeft());
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* show inner scrollbar only, if header is fixed
|
* show inner scrollbar only, if header is fixed
|
||||||
*/
|
*/
|
||||||
Ember.$(window).scroll(Ember.$.proxy(this.updateScrollbarTopVisibility, this));
|
$(window).scroll($.proxy(this.updateScrollbarTopVisibility, this));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -98,7 +97,7 @@ export default Component.extend({
|
||||||
* calculates horizontal scrollbar height depending on current browser
|
* calculates horizontal scrollbar height depending on current browser
|
||||||
*/
|
*/
|
||||||
getScrollbarHeight() {
|
getScrollbarHeight() {
|
||||||
const wideScrollWtml = Ember.$('<div>').attr('id', 'wide_scroll_div_one').css({
|
const wideScrollWtml = $('<div>').attr('id', 'wide_scroll_div_one').css({
|
||||||
'width': 50,
|
'width': 50,
|
||||||
'height': 50,
|
'height': 50,
|
||||||
'overflow-y': 'scroll',
|
'overflow-y': 'scroll',
|
||||||
|
@ -106,16 +105,16 @@ export default Component.extend({
|
||||||
'top': -200,
|
'top': -200,
|
||||||
'left': -200
|
'left': -200
|
||||||
}).append(
|
}).append(
|
||||||
Ember.$('<div>').attr('id', 'wide_scroll_div_two').css({
|
$('<div>').attr('id', 'wide_scroll_div_two').css({
|
||||||
'height': '100%',
|
'height': '100%',
|
||||||
'width': 100
|
'width': 100
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
Ember.$('body').append(wideScrollWtml); // Append our div and add the hmtl to your document for calculations
|
$('body').append(wideScrollWtml); // Append our div and add the hmtl to your document for calculations
|
||||||
const scrollW1 = Ember.$('#wide_scroll_div_one').height(); // Getting the width of the surrounding(parent) div - we already know it is 50px since we styled it but just to make sure.
|
const scrollW1 = $('#wide_scroll_div_one').height(); // Getting the width of the surrounding(parent) div - we already know it is 50px since we styled it but just to make sure.
|
||||||
const scrollW2 = Ember.$('#wide_scroll_div_two').innerHeight(); // Find the inner width of the inner(child) div.
|
const scrollW2 = $('#wide_scroll_div_two').innerHeight(); // Find the inner width of the inner(child) div.
|
||||||
const scrollBarWidth = scrollW1 - scrollW2; // subtract the difference
|
const scrollBarWidth = scrollW1 - scrollW2; // subtract the difference
|
||||||
Ember.$('#wide_scroll_div_one').remove(); // remove the html from your document
|
$('#wide_scroll_div_one').remove(); // remove the html from your document
|
||||||
return scrollBarWidth;
|
return scrollBarWidth;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -131,17 +130,17 @@ export default Component.extend({
|
||||||
* used as event callback when window is resized
|
* used as event callback when window is resized
|
||||||
*/
|
*/
|
||||||
resizeScrollbars() {
|
resizeScrollbars() {
|
||||||
Ember.$('.top-scrollbar div').css('width', Ember.$('.user-selections-table').width());
|
$('.top-scrollbar div').css('width', $('.user-selections-table').width());
|
||||||
Ember.$('.top-scrollbar-floatThead').css('width', Ember.$('.table-scroll').outerWidth());
|
$('.top-scrollbar-floatThead').css('width', $('.table-scroll').outerWidth());
|
||||||
Ember.$('.top-scrollbar-floatThead div').css('width', Ember.$('.user-selections-table').width());
|
$('.top-scrollbar-floatThead div').css('width', $('.user-selections-table').width());
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* resize scrollbars if document height might be changed
|
* resize scrollbars if document height might be changed
|
||||||
* and therefore scrollbars might be added
|
* and therefore scrollbars might be added
|
||||||
*/
|
*/
|
||||||
triggerResizeScrollbars: Ember.observer('controller.isEvaluable', 'controller.model.users.[]', function() {
|
triggerResizeScrollbars: observer('controller.isEvaluable', 'controller.model.users.[]', function() {
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
this.resizeScrollbars();
|
this.resizeScrollbars();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
@ -151,15 +150,15 @@ export default Component.extend({
|
||||||
* used as event callback when window is scrolled
|
* used as event callback when window is scrolled
|
||||||
*/
|
*/
|
||||||
updateScrollbarTopVisibility() {
|
updateScrollbarTopVisibility() {
|
||||||
const windowTop = Ember.$(window).scrollTop();
|
const windowTop = $(window).scrollTop();
|
||||||
const tableTop = Ember.$('.table-scroll table').offset().top;
|
const tableTop = $('.table-scroll table').offset().top;
|
||||||
if (windowTop >= tableTop - this.getScrollbarHeight()) {
|
if (windowTop >= tableTop - this.getScrollbarHeight()) {
|
||||||
Ember.$('.top-scrollbar-floatThead').show();
|
$('.top-scrollbar-floatThead').show();
|
||||||
|
|
||||||
// update scroll position
|
// update scroll position
|
||||||
Ember.$('.top-scrollbar-floatThead').scrollLeft(Ember.$('.table-scroll').scrollLeft());
|
$('.top-scrollbar-floatThead').scrollLeft($('.table-scroll').scrollLeft());
|
||||||
} else {
|
} else {
|
||||||
Ember.$('.top-scrollbar-floatThead').hide();
|
$('.top-scrollbar-floatThead').hide();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -168,7 +167,7 @@ export default Component.extend({
|
||||||
* especially remove event listeners
|
* especially remove event listeners
|
||||||
*/
|
*/
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
Ember.$(window).off('resize', this.resizeScrollbars);
|
$(window).off('resize', this.resizeScrollbars);
|
||||||
Ember.$(window).off('scroll', this.updateScrollbarTopVisibility);
|
$(window).off('scroll', this.updateScrollbarTopVisibility);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import Ember from 'ember';
|
import Component from '@ember/component';
|
||||||
|
import { computed } from '@ember/object';
|
||||||
const { Component, computed, copy, isEmpty } = Ember;
|
import { copy } from '@ember/object/internals';
|
||||||
|
import { isEmpty } from '@ember/utils';
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
classNames: ['evaluation-summary'],
|
classNames: ['evaluation-summary'],
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import { readOnly } from '@ember/object/computed';
|
||||||
|
import EmberObject, { computed, observer } from '@ember/object';
|
||||||
|
import Controller from '@ember/controller';
|
||||||
|
import { getOwner } from '@ember/application';
|
||||||
|
|
||||||
const { computed, Controller, getOwner, inject } = Ember;
|
const formStepObject = EmberObject.extend({
|
||||||
|
|
||||||
const formStepObject = Ember.Object.extend({
|
|
||||||
active: computed('routing.currentRouteName', function() {
|
active: computed('routing.currentRouteName', function() {
|
||||||
const currentRouteName = this.get('routing.currentRouteName');
|
const currentRouteName = this.get('routing.currentRouteName');
|
||||||
const active = currentRouteName === this.get('route');
|
return currentRouteName === this.get('route');
|
||||||
|
|
||||||
if (active) {
|
|
||||||
this.set('disabled', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return active;
|
|
||||||
}),
|
}),
|
||||||
disabled: true,
|
disabled: true,
|
||||||
hidden: false,
|
hidden: false,
|
||||||
label: null,
|
label: null,
|
||||||
route: null,
|
route: null,
|
||||||
routing: inject.service('-routing')
|
routing: service('-routing'),
|
||||||
|
updateDisabledState: observer('active', function() {
|
||||||
|
if (this.get('active')) {
|
||||||
|
this.set('disabled', false);
|
||||||
|
}
|
||||||
|
}).on('init'),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
|
@ -41,7 +42,7 @@ export default Controller.extend({
|
||||||
return 'create.formStep.options.text';
|
return 'create.formStep.options.text';
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
pollType: computed.readOnly('model.pollType')
|
pollType: readOnly('model.pollType')
|
||||||
}).create(owner.ownerInjection(), {
|
}).create(owner.ownerInjection(), {
|
||||||
model: this.get('model'),
|
model: this.get('model'),
|
||||||
route: 'create.options'
|
route: 'create.options'
|
||||||
|
@ -51,7 +52,7 @@ export default Controller.extend({
|
||||||
const pollType = this.get('pollType');
|
const pollType = this.get('pollType');
|
||||||
return pollType !== 'FindADate';
|
return pollType !== 'FindADate';
|
||||||
}),
|
}),
|
||||||
pollType: computed.readOnly('model.pollType')
|
pollType: readOnly('model.pollType')
|
||||||
}).create(owner.ownerInjection(), {
|
}).create(owner.ownerInjection(), {
|
||||||
label: 'create.formStep.options-datetime',
|
label: 'create.formStep.options-datetime',
|
||||||
model: this.get('model'),
|
model: this.get('model'),
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import { alias } from '@ember/object/computed';
|
||||||
|
import Controller from '@ember/controller';
|
||||||
|
import { getOwner } from '@ember/application';
|
||||||
|
import EmberObject, { computed } from '@ember/object';
|
||||||
import {
|
import {
|
||||||
validator, buildValidations
|
validator, buildValidations
|
||||||
}
|
}
|
||||||
from 'ember-cp-validations';
|
from 'ember-cp-validations';
|
||||||
|
|
||||||
const { computed, Controller, getOwner, Object: EmberObject, inject } = Ember;
|
|
||||||
|
|
||||||
const Validations = buildValidations({
|
const Validations = buildValidations({
|
||||||
pollType: [
|
pollType: [
|
||||||
validator('presence', {
|
validator('presence', {
|
||||||
|
@ -20,7 +22,7 @@ const Validations = buildValidations({
|
||||||
});
|
});
|
||||||
|
|
||||||
const TranslateableObject = EmberObject.extend({
|
const TranslateableObject = EmberObject.extend({
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
label: computed('labelTranslation', 'i18n.locale', function() {
|
label: computed('labelTranslation', 'i18n.locale', function() {
|
||||||
return this.get('i18n').t(this.get('labelTranslation'));
|
return this.get('i18n').t(this.get('labelTranslation'));
|
||||||
}),
|
}),
|
||||||
|
@ -36,13 +38,15 @@ export default Controller.extend(Validations, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
this._super(...arguments);
|
||||||
|
|
||||||
this.get('i18n.locale');
|
this.get('i18n.locale');
|
||||||
},
|
},
|
||||||
|
|
||||||
pollType: computed.alias('model.pollType'),
|
pollType: alias('model.pollType'),
|
||||||
|
|
||||||
pollTypes: computed('', function() {
|
pollTypes: computed('', function() {
|
||||||
const owner = getOwner(this);
|
const owner = getOwner(this);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import { alias } from '@ember/object/computed';
|
||||||
|
import Controller from '@ember/controller';
|
||||||
import {
|
import {
|
||||||
validator, buildValidations
|
validator, buildValidations
|
||||||
}
|
}
|
||||||
from 'ember-cp-validations';
|
from 'ember-cp-validations';
|
||||||
|
|
||||||
const { computed, Controller, inject } = Ember;
|
|
||||||
|
|
||||||
const Validations = buildValidations({
|
const Validations = buildValidations({
|
||||||
title: [
|
title: [
|
||||||
validator('presence', {
|
validator('presence', {
|
||||||
|
@ -28,13 +28,15 @@ export default Controller.extend(Validations, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
description: computed.alias('model.description'),
|
description: alias('model.description'),
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
this._super(...arguments);
|
||||||
|
|
||||||
this.get('i18n.locale');
|
this.get('i18n.locale');
|
||||||
},
|
},
|
||||||
|
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
|
|
||||||
title: computed.alias('model.title')
|
title: alias('model.title')
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import Ember from 'ember';
|
import { alias } from '@ember/object/computed';
|
||||||
|
import Controller from '@ember/controller';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
const { computed, Controller } = Ember;
|
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
actions: {
|
actions: {
|
||||||
nextPage() {
|
nextPage() {
|
||||||
|
@ -35,5 +34,5 @@ export default Controller.extend({
|
||||||
// ToDo: Find a better way without reseting the options
|
// ToDo: Find a better way without reseting the options
|
||||||
this.set('options', options.sortBy('title'));
|
this.set('options', options.sortBy('title'));
|
||||||
},
|
},
|
||||||
options: computed.alias('model.options')
|
options: alias('model.options')
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import Ember from 'ember';
|
import { alias } from '@ember/object/computed';
|
||||||
|
import Controller from '@ember/controller';
|
||||||
const { computed, Controller } = Ember;
|
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -13,5 +12,5 @@ export default Controller.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
isFindADate: computed.alias('model.isFindADate')
|
isFindADate: alias('model.isFindADate')
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,21 +1,16 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import { alias } from '@ember/object/computed';
|
||||||
|
import Controller from '@ember/controller';
|
||||||
|
import { copy } from '@ember/object/internals';
|
||||||
|
import { getOwner } from '@ember/application';
|
||||||
|
import { isEmpty } from '@ember/utils';
|
||||||
|
import EmberObject, { observer, computed } from '@ember/object';
|
||||||
import {
|
import {
|
||||||
validator, buildValidations
|
validator, buildValidations
|
||||||
}
|
}
|
||||||
from 'ember-cp-validations';
|
from 'ember-cp-validations';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
const {
|
|
||||||
computed,
|
|
||||||
Controller,
|
|
||||||
copy,
|
|
||||||
getOwner,
|
|
||||||
inject,
|
|
||||||
isEmpty,
|
|
||||||
Object: EmberObject,
|
|
||||||
observer
|
|
||||||
} = Ember;
|
|
||||||
|
|
||||||
const Validations = buildValidations({
|
const Validations = buildValidations({
|
||||||
anonymousUser: validator('presence', {
|
anonymousUser: validator('presence', {
|
||||||
presence: true,
|
presence: true,
|
||||||
|
@ -35,7 +30,7 @@ const Validations = buildValidations({
|
||||||
});
|
});
|
||||||
|
|
||||||
const TranslateableObject = EmberObject.extend({
|
const TranslateableObject = EmberObject.extend({
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
label: computed('labelTranslation', 'i18n.locale', function() {
|
label: computed('labelTranslation', 'i18n.locale', function() {
|
||||||
return this.get('i18n').t(this.get('labelTranslation'));
|
return this.get('i18n').t(this.get('labelTranslation'));
|
||||||
}),
|
}),
|
||||||
|
@ -74,8 +69,8 @@ export default Controller.extend(Validations, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
anonymousUser: computed.alias('model.anonymousUser'),
|
anonymousUser: alias('model.anonymousUser'),
|
||||||
answerType: computed.alias('model.answerType'),
|
answerType: alias('model.answerType'),
|
||||||
|
|
||||||
answerTypes: computed('', function() {
|
answerTypes: computed('', function() {
|
||||||
const owner = getOwner(this);
|
const owner = getOwner(this);
|
||||||
|
@ -159,11 +154,13 @@ export default Controller.extend(Validations, {
|
||||||
];
|
];
|
||||||
}),
|
}),
|
||||||
|
|
||||||
forceAnswer: computed.alias('model.forceAnswer'),
|
forceAnswer: alias('model.forceAnswer'),
|
||||||
|
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
this._super(...arguments);
|
||||||
|
|
||||||
this.get('i18n.locale');
|
this.get('i18n.locale');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import Ember from 'ember';
|
import { computed } from '@ember/object';
|
||||||
|
import Controller from '@ember/controller';
|
||||||
const { computed, Controller } = Ember;
|
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
isDecryptionError: computed('model.type', function() {
|
isDecryptionError: computed('model.type', function() {
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
|
import $ from 'jquery';
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
|
||||||
const { $, ObjectController } = Ember;
|
const {
|
||||||
|
ObjectController
|
||||||
|
} = Ember;
|
||||||
|
|
||||||
export default ObjectController.extend({
|
export default ObjectController.extend({
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import { readOnly } from '@ember/object/computed';
|
||||||
|
import Controller from '@ember/controller';
|
||||||
|
import { isPresent, isEmpty } from '@ember/utils';
|
||||||
|
import { observer, computed } from '@ember/object';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
const {
|
|
||||||
computed,
|
|
||||||
Controller,
|
|
||||||
inject,
|
|
||||||
isEmpty,
|
|
||||||
isPresent,
|
|
||||||
observer
|
|
||||||
} = Ember;
|
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
actions: {
|
actions: {
|
||||||
linkAction(type) {
|
linkAction(type) {
|
||||||
|
@ -30,13 +25,13 @@ export default Controller.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
currentLocale: computed.readOnly('i18n.locale'),
|
currentLocale: readOnly('i18n.locale'),
|
||||||
|
|
||||||
encryption: inject.service(),
|
encryption: service(),
|
||||||
encryptionKey: '',
|
encryptionKey: '',
|
||||||
queryParams: ['encryptionKey'],
|
queryParams: ['encryptionKey'],
|
||||||
|
|
||||||
flashMessages: inject.service(),
|
flashMessages: service(),
|
||||||
|
|
||||||
hasTimes: computed('model.options.[]', function() {
|
hasTimes: computed('model.options.[]', function() {
|
||||||
if (this.get('model.isMakeAPoll')) {
|
if (this.get('model.isMakeAPoll')) {
|
||||||
|
@ -49,7 +44,7 @@ export default Controller.extend({
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
|
|
||||||
momentLongDayFormat: computed('currentLocale', function() {
|
momentLongDayFormat: computed('currentLocale', function() {
|
||||||
let currentLocale = this.get('currentLocale');
|
let currentLocale = this.get('currentLocale');
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import { reads, readOnly, sort } from '@ember/object/computed';
|
||||||
const { $, computed, Controller, inject } = Ember;
|
import $ from 'jquery';
|
||||||
|
import { computed } from '@ember/object';
|
||||||
|
import Controller, { inject as controller } from '@ember/controller';
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
currentLocale: computed.reads('i18n.locale'),
|
currentLocale: reads('i18n.locale'),
|
||||||
|
|
||||||
hasTimes: computed.reads('pollController.hasTimes'),
|
hasTimes: reads('pollController.hasTimes'),
|
||||||
|
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
|
|
||||||
momentLongDayFormat: computed.readOnly('pollController.momentLongDayFormat'),
|
momentLongDayFormat: readOnly('pollController.momentLongDayFormat'),
|
||||||
|
|
||||||
pollController: inject.controller('poll'),
|
pollController: controller('poll'),
|
||||||
|
|
||||||
sortedUsers: computed.sort('pollController.model.users', 'usersSorting'),
|
sortedUsers: sort('pollController.model.users', 'usersSorting'),
|
||||||
usersSorting: ['creationDate'],
|
usersSorting: computed(() => ['creationDate']),
|
||||||
|
|
||||||
timezone: computed.reads('pollController.timezone'),
|
timezone: reads('pollController.timezone'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* evaluates poll data
|
* evaluates poll data
|
||||||
|
@ -93,7 +95,7 @@ export default Controller.extend({
|
||||||
return this.get('model.options.length') + 2;
|
return this.get('model.options.length') + 2;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
isEvaluable: computed('model.users.[]', 'model.isFreeText', function() {
|
isEvaluable: computed('model.{users.[],isFreeText}', function() {
|
||||||
if (
|
if (
|
||||||
!this.get('model.isFreeText') &&
|
!this.get('model.isFreeText') &&
|
||||||
this.get('model.users.length') > 0
|
this.get('model.users.length') > 0
|
||||||
|
|
|
@ -1,20 +1,15 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import { readOnly, not } from '@ember/object/computed';
|
||||||
|
import Controller, { inject as controller } from '@ember/controller';
|
||||||
|
import { getOwner } from '@ember/application';
|
||||||
|
import { isPresent, isEmpty } from '@ember/utils';
|
||||||
|
import EmberObject, { computed } from '@ember/object';
|
||||||
import {
|
import {
|
||||||
validator, buildValidations
|
validator, buildValidations
|
||||||
}
|
}
|
||||||
from 'ember-cp-validations';
|
from 'ember-cp-validations';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
const {
|
|
||||||
computed,
|
|
||||||
Controller,
|
|
||||||
getOwner,
|
|
||||||
inject,
|
|
||||||
isEmpty,
|
|
||||||
isPresent,
|
|
||||||
Object: EmberObject
|
|
||||||
} = Ember;
|
|
||||||
|
|
||||||
const validCollection = function(collection) {
|
const validCollection = function(collection) {
|
||||||
// return false if any object in collection is inValid
|
// return false if any object in collection is inValid
|
||||||
return !collection.any((object) => {
|
return !collection.any((object) => {
|
||||||
|
@ -25,14 +20,14 @@ const Validations = buildValidations({
|
||||||
name: [
|
name: [
|
||||||
validator('presence', {
|
validator('presence', {
|
||||||
presence: true,
|
presence: true,
|
||||||
disabled: computed.readOnly('model.anonymousUser'),
|
disabled: readOnly('model.anonymousUser'),
|
||||||
dependentKeys: ['model.i18n.locale']
|
dependentKeys: ['model.i18n.locale']
|
||||||
}),
|
}),
|
||||||
validator('unique', {
|
validator('unique', {
|
||||||
parent: 'pollController.model',
|
parent: 'pollController.model',
|
||||||
attributeInParent: 'users',
|
attributeInParent: 'users',
|
||||||
dependentKeys: ['model.poll.users.[]', 'model.poll.users.@each.name', 'model.i18n.locale'],
|
dependentKeys: ['model.poll.users.[]', 'model.poll.users.@each.name', 'model.i18n.locale'],
|
||||||
disable: computed.readOnly('model.anonymousUser'),
|
disable: readOnly('model.anonymousUser'),
|
||||||
messageKey: 'unique.name'
|
messageKey: 'unique.name'
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
@ -51,7 +46,7 @@ const Validations = buildValidations({
|
||||||
const SelectionValidations = buildValidations({
|
const SelectionValidations = buildValidations({
|
||||||
value: validator('presence', {
|
value: validator('presence', {
|
||||||
presence: true,
|
presence: true,
|
||||||
disabled: computed.not('model.forceAnswer'),
|
disabled: not('model.forceAnswer'),
|
||||||
messageKey: computed('model.isFreeText', function() {
|
messageKey: computed('model.isFreeText', function() {
|
||||||
return this.get('model.isFreeText') ? 'errors.present' : 'errors.present.answer.selection';
|
return this.get('model.isFreeText') ? 'errors.present' : 'errors.present.answer.selection';
|
||||||
}),
|
}),
|
||||||
|
@ -119,26 +114,28 @@ export default Controller.extend(Validations, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
anonymousUser: computed.readOnly('pollController.model.anonymousUser'),
|
anonymousUser: readOnly('pollController.model.anonymousUser'),
|
||||||
currentLocale: computed.readOnly('i18n.locale'),
|
currentLocale: readOnly('i18n.locale'),
|
||||||
encryption: inject.service(),
|
encryption: service(),
|
||||||
forceAnswer: computed.readOnly('pollController.model.forceAnswer'),
|
forceAnswer: readOnly('pollController.model.forceAnswer'),
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
this._super(...arguments);
|
||||||
|
|
||||||
this.get('i18n.locale');
|
this.get('i18n.locale');
|
||||||
},
|
},
|
||||||
|
|
||||||
isFreeText: computed.readOnly('pollController.model.isFreeText'),
|
isFreeText: readOnly('pollController.model.isFreeText'),
|
||||||
isFindADate: computed.readOnly('pollController.model.isFindADate'),
|
isFindADate: readOnly('pollController.model.isFindADate'),
|
||||||
|
|
||||||
momentLongDayFormat: computed.readOnly('pollController.momentLongDayFormat'),
|
momentLongDayFormat: readOnly('pollController.momentLongDayFormat'),
|
||||||
|
|
||||||
name: '',
|
name: '',
|
||||||
|
|
||||||
options: computed.readOnly('pollController.model.options'),
|
options: readOnly('pollController.model.options'),
|
||||||
|
|
||||||
pollController: inject.controller('poll'),
|
pollController: controller('poll'),
|
||||||
|
|
||||||
possibleAnswers: computed('pollController.model.answers', function() {
|
possibleAnswers: computed('pollController.model.answers', function() {
|
||||||
return this.get('pollController.model.answers').map((answer) => {
|
return this.get('pollController.model.answers').map((answer) => {
|
||||||
|
@ -151,7 +148,7 @@ export default Controller.extend(Validations, {
|
||||||
|
|
||||||
if (!isEmpty(answer.get('labelTranslation'))) {
|
if (!isEmpty(answer.get('labelTranslation'))) {
|
||||||
return AnswerObject.extend(owner.ownerInjection(), {
|
return AnswerObject.extend(owner.ownerInjection(), {
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
label: computed('i18n.locale', function() {
|
label: computed('i18n.locale', function() {
|
||||||
return this.get('i18n').t(this.get('labelTranslation'));
|
return this.get('i18n').t(this.get('labelTranslation'));
|
||||||
}),
|
}),
|
||||||
|
@ -214,5 +211,5 @@ export default Controller.extend(Validations, {
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
timezone: computed.readOnly('pollController.timezone')
|
timezone: readOnly('pollController.timezone')
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,14 +3,15 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<title>Croodle</title>
|
||||||
<meta name="description" content="">
|
<meta name="description" content="">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta name="referrer" content="no-referrer">
|
<meta name="referrer" content="no-referrer">
|
||||||
|
|
||||||
{{content-for "head"}}
|
{{content-for "head"}}
|
||||||
|
|
||||||
<link rel="stylesheet" href="{{rootURL}}assets/vendor.css">
|
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
|
||||||
<link rel="stylesheet" href="{{rootURL}}assets/croodle.css">
|
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/croodle.css">
|
||||||
|
|
||||||
{{content-for "head-footer"}}
|
{{content-for "head-footer"}}
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import Ember from 'ember';
|
import { getOwner } from '@ember/application';
|
||||||
|
import { isPresent, isEmpty } from '@ember/utils';
|
||||||
const { getOwner, isEmpty, isPresent } = Ember;
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'i18n',
|
name: 'i18n',
|
||||||
|
|
|
@ -109,15 +109,15 @@ export default {
|
||||||
exclusion: '{{description}} está reservada',
|
exclusion: '{{description}} está reservada',
|
||||||
invalid: '{{description}} no es válida',
|
invalid: '{{description}} no es válida',
|
||||||
confirmation: '{{description}} no encaja con {{attribute}}',
|
confirmation: '{{description}} no encaja con {{attribute}}',
|
||||||
accepted: '{{description}} debe ser aceptado\/a',
|
accepted: '{{description}} debe ser aceptado/a',
|
||||||
empty: '{{description}} no puede estar vacio',
|
empty: '{{description}} no puede estar vacio',
|
||||||
blank: '{{description}} no puede estar en blanco',
|
blank: '{{description}} no puede estar en blanco',
|
||||||
present: '{{description}} debe estar en blanco',
|
present: '{{description}} debe estar en blanco',
|
||||||
'present.answer.selection': 'Hay que escoger una respuesta.',
|
'present.answer.selection': 'Hay que escoger una respuesta.',
|
||||||
collection: '{{description}} tiene que ser una colección',
|
collection: '{{description}} tiene que ser una colección',
|
||||||
singular: '{{description}} no puede ser una colección',
|
singular: '{{description}} no puede ser una colección',
|
||||||
tooLong: '{{description}} es demasiado largo\/a (el máximo son {{max}} caractéres)',
|
tooLong: '{{description}} es demasiado largo/a (el máximo son {{max}} caractéres)',
|
||||||
tooShort: '{{description}} es muy corto\/a (el mínimo son {{min}} caractéres)',
|
tooShort: '{{description}} es muy corto/a (el mínimo son {{min}} caractéres)',
|
||||||
before: '{{description}} debe de ser antes de {date}',
|
before: '{{description}} debe de ser antes de {date}',
|
||||||
after: '{{description}} debe de ser después de {date}',
|
after: '{{description}} debe de ser después de {date}',
|
||||||
wrongDateFormat: '{{description}} tiene que estar en el formato de {{date}}',
|
wrongDateFormat: '{{description}} tiene que estar en el formato de {{date}}',
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import Ember from 'ember';
|
import Mixin from '@ember/object/mixin';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A work-a-round to support autofocus in Ember.js components.
|
* A work-a-round to support autofocus in Ember.js components.
|
||||||
* Background: https://github.com/emberjs/ember.js/issues/12589
|
* Background: https://github.com/emberjs/ember.js/issues/12589
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default Ember.Mixin.create({
|
export default Mixin.create({
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
|
import { inject as service } from '@ember/service';
|
||||||
|
import { readOnly } from '@ember/object/computed';
|
||||||
|
import { assert } from '@ember/debug';
|
||||||
|
import { computed } from '@ember/object';
|
||||||
|
import { isEmpty } from '@ember/utils';
|
||||||
import DS from 'ember-data';
|
import DS from 'ember-data';
|
||||||
import Ember from 'ember';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import Fragment from 'ember-data-model-fragments/fragment';
|
import Fragment from 'ember-data-model-fragments/fragment';
|
||||||
import { fragmentOwner } from 'ember-data-model-fragments/attributes';
|
import { fragmentOwner } from 'ember-data-model-fragments/attributes';
|
||||||
|
@ -9,12 +13,11 @@ import {
|
||||||
from 'ember-cp-validations';
|
from 'ember-cp-validations';
|
||||||
|
|
||||||
const { attr } = DS;
|
const { attr } = DS;
|
||||||
const { assert, computed, inject, isEmpty } = Ember;
|
|
||||||
|
|
||||||
const Validations = buildValidations({
|
const Validations = buildValidations({
|
||||||
title: [
|
title: [
|
||||||
validator('iso8601', {
|
validator('iso8601', {
|
||||||
active: computed.readOnly('model.poll.isFindADate'),
|
active: readOnly('model.poll.isFindADate'),
|
||||||
validFormats: [
|
validFormats: [
|
||||||
'YYYY-MM-DD',
|
'YYYY-MM-DD',
|
||||||
'YYYY-MM-DDTHH:mmZ',
|
'YYYY-MM-DDTHH:mmZ',
|
||||||
|
@ -59,7 +62,7 @@ export default Fragment.extend(Validations, {
|
||||||
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
||||||
];
|
];
|
||||||
const value = this.get('title');
|
const value = this.get('title');
|
||||||
if (Ember.isEmpty(value)) {
|
if (isEmpty(value)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +137,7 @@ export default Fragment.extend(Validations, {
|
||||||
);
|
);
|
||||||
|
|
||||||
// set time to undefined if value is false
|
// set time to undefined if value is false
|
||||||
if (Ember.isEmpty(value)) {
|
if (isEmpty(value)) {
|
||||||
this.set('title', date.format('YYYY-MM-DD'));
|
this.set('title', date.format('YYYY-MM-DD'));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +152,7 @@ export default Fragment.extend(Validations, {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
i18n: inject.service(),
|
i18n: service(),
|
||||||
init() {
|
init() {
|
||||||
this.get('i18n.locale');
|
this.get('i18n.locale');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import Ember from 'ember';
|
import { computed } from '@ember/object';
|
||||||
import DS from 'ember-data';
|
import DS from 'ember-data';
|
||||||
import {
|
import {
|
||||||
fragmentArray
|
fragmentArray
|
||||||
|
@ -64,15 +64,15 @@ export default Model.extend({
|
||||||
/*
|
/*
|
||||||
* computed properties
|
* computed properties
|
||||||
*/
|
*/
|
||||||
isFindADate: Ember.computed('pollType', function() {
|
isFindADate: computed('pollType', function() {
|
||||||
return this.get('pollType') === 'FindADate';
|
return this.get('pollType') === 'FindADate';
|
||||||
}),
|
}),
|
||||||
|
|
||||||
isFreeText: Ember.computed('answerType', function() {
|
isFreeText: computed('answerType', function() {
|
||||||
return this.get('answerType') === 'FreeText';
|
return this.get('answerType') === 'FreeText';
|
||||||
}),
|
}),
|
||||||
|
|
||||||
isMakeAPoll: Ember.computed('pollType', function() {
|
isMakeAPoll: computed('pollType', function() {
|
||||||
return this.get('pollType') === 'MakeAPoll';
|
return this.get('pollType') === 'MakeAPoll';
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import Ember from 'ember';
|
import EmberRouter from '@ember/routing/router';
|
||||||
import config from './config/environment';
|
import config from './config/environment';
|
||||||
|
|
||||||
const Router = Ember.Router.extend({
|
const Router = EmberRouter.extend({
|
||||||
location: config.locationType,
|
location: config.locationType,
|
||||||
rootURL: config.rootURL
|
rootURL: config.rootURL
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import Ember from 'ember';
|
import { alias } from '@ember/object/computed';
|
||||||
|
import { inject as service } from '@ember/service';
|
||||||
|
import Route from '@ember/routing/route';
|
||||||
/* global moment */
|
/* global moment */
|
||||||
|
|
||||||
export default Ember.Route.extend({
|
export default Route.extend({
|
||||||
actions: {
|
actions: {
|
||||||
transitionToPoll(poll) {
|
transitionToPoll(poll) {
|
||||||
this.transitionTo('poll', poll, {
|
this.transitionTo('poll', poll, {
|
||||||
|
@ -22,8 +24,8 @@ export default Ember.Route.extend({
|
||||||
this.get('encryption').generateKey();
|
this.get('encryption').generateKey();
|
||||||
},
|
},
|
||||||
|
|
||||||
encryption: Ember.inject.service(),
|
encryption: service(),
|
||||||
encryptionKey: Ember.computed.alias('encryption.key'),
|
encryptionKey: alias('encryption.key'),
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
// create empty poll
|
// create empty poll
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import Ember from 'ember';
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
export default Ember.Route.extend({
|
export default Route.extend({
|
||||||
model() {
|
model() {
|
||||||
return this.modelFor('create');
|
return this.modelFor('create');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import Ember from 'ember';
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
export default Ember.Route.extend({
|
export default Route.extend({
|
||||||
actions: {
|
actions: {
|
||||||
previousPage() {
|
previousPage() {
|
||||||
this.transitionTo('create.index');
|
this.transitionTo('create.index');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import Ember from 'ember';
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
export default Ember.Route.extend({
|
export default Route.extend({
|
||||||
actions: {
|
actions: {
|
||||||
previousPage() {
|
previousPage() {
|
||||||
this.transitionTo('create.options');
|
this.transitionTo('create.options');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import Ember from 'ember';
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
export default Ember.Route.extend({
|
export default Route.extend({
|
||||||
actions: {
|
actions: {
|
||||||
previousPage() {
|
previousPage() {
|
||||||
this.transitionTo('create.meta');
|
this.transitionTo('create.meta');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import Ember from 'ember';
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
export default Ember.Route.extend({
|
export default Route.extend({
|
||||||
actions: {
|
actions: {
|
||||||
previousPage() {
|
previousPage() {
|
||||||
let model = this.modelFor(this.routeName);
|
let model = this.modelFor(this.routeName);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import Ember from 'ember';
|
import { inject as service } from '@ember/service';
|
||||||
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
export default Ember.Route.extend({
|
export default Route.extend({
|
||||||
actions: {
|
actions: {
|
||||||
error(error) {
|
error(error) {
|
||||||
if (error && error.status === 404) {
|
if (error && error.status === 404) {
|
||||||
|
@ -11,16 +12,14 @@ export default Ember.Route.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
encryption: Ember.inject.service(),
|
encryption: service(),
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
// get encryption key from query parameter in singleton
|
// get encryption key from query parameter in singleton
|
||||||
// before it's used by serializer to decrypt payload
|
// before it's used by serializer to decrypt payload
|
||||||
this.set('encryption.key', params.encryptionKey);
|
this.set('encryption.key', params.encryptionKey);
|
||||||
|
|
||||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
|
||||||
return this.store.find('poll', params.poll_id);
|
return this.store.find('poll', params.poll_id);
|
||||||
/* jscs:enable requireCamelCaseOrUpperCaseIdentifiers */
|
|
||||||
},
|
},
|
||||||
|
|
||||||
redirect(poll, transition) {
|
redirect(poll, transition) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
import { isEmpty } from '@ember/utils';
|
||||||
|
import { inject as service } from '@ember/service';
|
||||||
import DS from 'ember-data';
|
import DS from 'ember-data';
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* extends DS.RESTSerializer to implement encryption
|
* extends DS.RESTSerializer to implement encryption
|
||||||
|
@ -17,7 +18,7 @@ import Ember from 'ember';
|
||||||
export default DS.RESTSerializer.extend({
|
export default DS.RESTSerializer.extend({
|
||||||
isNewSerializerAPI: true,
|
isNewSerializerAPI: true,
|
||||||
|
|
||||||
encryption: Ember.inject.service(),
|
encryption: service(),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* implement decryption
|
* implement decryption
|
||||||
|
@ -52,7 +53,7 @@ export default DS.RESTSerializer.extend({
|
||||||
// map includePlainOnCreate after serialization of attribute hash
|
// map includePlainOnCreate after serialization of attribute hash
|
||||||
// but before encryption so we can just use the serialized hash
|
// but before encryption so we can just use the serialized hash
|
||||||
if (
|
if (
|
||||||
!Ember.isEmpty(attribute.options.includePlainOnCreate) &&
|
!isEmpty(attribute.options.includePlainOnCreate) &&
|
||||||
typeof attribute.options.includePlainOnCreate === 'string'
|
typeof attribute.options.includePlainOnCreate === 'string'
|
||||||
) {
|
) {
|
||||||
json[attribute.options.includePlainOnCreate] = json[key];
|
json[attribute.options.includePlainOnCreate] = json[key];
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import { isEmpty } from '@ember/utils';
|
||||||
import DS from 'ember-data';
|
import DS from 'ember-data';
|
||||||
import ApplicationAdapter from './application';
|
import ApplicationAdapter from './application';
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
export default ApplicationAdapter.extend(DS.EmbeddedRecordsMixin, {
|
export default ApplicationAdapter.extend(DS.EmbeddedRecordsMixin, {
|
||||||
attrs: {
|
attrs: {
|
||||||
|
@ -14,7 +14,7 @@ export default ApplicationAdapter.extend(DS.EmbeddedRecordsMixin, {
|
||||||
// property 'type' of answers was named 'id'
|
// property 'type' of answers was named 'id'
|
||||||
if (
|
if (
|
||||||
resourceHash.answers.length > 0 &&
|
resourceHash.answers.length > 0 &&
|
||||||
!Ember.isEmpty(resourceHash.answers[0].id)
|
!isEmpty(resourceHash.answers[0].id)
|
||||||
) {
|
) {
|
||||||
resourceHash.answers.forEach((answer, index) => {
|
resourceHash.answers.forEach((answer, index) => {
|
||||||
resourceHash.answers[index].type = answer.id;
|
resourceHash.answers[index].type = answer.id;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { isEmpty } from '@ember/utils';
|
||||||
import ApplicationAdapter from './application';
|
import ApplicationAdapter from './application';
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
export default ApplicationAdapter.extend({
|
export default ApplicationAdapter.extend({
|
||||||
legacySupport(resourceHash) {
|
legacySupport(resourceHash) {
|
||||||
|
@ -11,7 +11,7 @@ export default ApplicationAdapter.extend({
|
||||||
* selections where stored as child object of "value" property
|
* selections where stored as child object of "value" property
|
||||||
* and selection property "type" where named "id"
|
* and selection property "type" where named "id"
|
||||||
*/
|
*/
|
||||||
if (!Ember.isEmpty(resourceHash.selections[0].value)) {
|
if (!isEmpty(resourceHash.selections[0].value)) {
|
||||||
resourceHash.selections.forEach(function(selection, index) {
|
resourceHash.selections.forEach(function(selection, index) {
|
||||||
if (typeof selection.value === 'string') {
|
if (typeof selection.value === 'string') {
|
||||||
resourceHash.selections[index] = {
|
resourceHash.selections[index] = {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import Ember from 'ember';
|
import Service from '@ember/service';
|
||||||
import generatePassphrase from '../utils/generate-passphrase';
|
import generatePassphrase from '../utils/generate-passphrase';
|
||||||
import sjcl from 'sjcl';
|
import sjcl from 'sjcl';
|
||||||
|
|
||||||
export default Ember.Service.extend({
|
export default Service.extend({
|
||||||
key: null,
|
key: null,
|
||||||
|
|
||||||
decrypt(value) {
|
decrypt(value) {
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
|
import { isArray } from '@ember/array';
|
||||||
|
import { isEmpty } from '@ember/utils';
|
||||||
|
import { assert } from '@ember/debug';
|
||||||
import BaseValidator from 'ember-cp-validations/validators/base';
|
import BaseValidator from 'ember-cp-validations/validators/base';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
export default BaseValidator.extend({
|
export default BaseValidator.extend({
|
||||||
validate(value, options = {}) {
|
validate(value, options = {}) {
|
||||||
Ember.assert(
|
assert(
|
||||||
'options.validFormats must not be set or an array of momentJS format strings',
|
'options.validFormats must not be set or an array of momentJS format strings',
|
||||||
Ember.isEmpty(options.validFormats) || Ember.isArray(options.validFormats)
|
isEmpty(options.validFormats) || isArray(options.validFormats)
|
||||||
);
|
);
|
||||||
|
|
||||||
let valid;
|
let valid;
|
||||||
const validFormats = Ember.isEmpty(options.validFormats) ? ['YYYY-MM-DDTHH:mm:ss.SSSZ'] : options.validFormats;
|
const validFormats = isEmpty(options.validFormats) ? ['YYYY-MM-DDTHH:mm:ss.SSSZ'] : options.validFormats;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
options.active === false ||
|
options.active === false ||
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { isEmpty } from '@ember/utils';
|
||||||
import BaseValidator from 'ember-cp-validations/validators/base';
|
import BaseValidator from 'ember-cp-validations/validators/base';
|
||||||
import Ember from 'ember';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
export default BaseValidator.extend({
|
export default BaseValidator.extend({
|
||||||
|
@ -12,11 +12,11 @@ export default BaseValidator.extend({
|
||||||
|
|
||||||
options.value = value;
|
options.value = value;
|
||||||
|
|
||||||
if (options.allowEmpty && Ember.isEmpty(value)) {
|
if (options.allowEmpty && isEmpty(value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Ember.isEmpty(value) && typeof value.trim === 'function') {
|
if (!isEmpty(value) && typeof value.trim === 'function') {
|
||||||
value = value.trim();
|
value = value.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
|
import { isArray } from '@ember/array';
|
||||||
|
import { isPresent, isEmpty } from '@ember/utils';
|
||||||
|
import { assert } from '@ember/debug';
|
||||||
import BaseValidator from 'ember-cp-validations/validators/base';
|
import BaseValidator from 'ember-cp-validations/validators/base';
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
export default BaseValidator.extend({
|
export default BaseValidator.extend({
|
||||||
validate(value, options, model, attribute) {
|
validate(value, options, model, attribute) {
|
||||||
Ember.assert(
|
assert(
|
||||||
'options.parent is required',
|
'options.parent is required',
|
||||||
Ember.isPresent(options.parent)
|
isPresent(options.parent)
|
||||||
);
|
);
|
||||||
Ember.assert(
|
assert(
|
||||||
'options.attributeInParent is required',
|
'options.attributeInParent is required',
|
||||||
Ember.isPresent(options.attributeInParent)
|
isPresent(options.attributeInParent)
|
||||||
);
|
);
|
||||||
Ember.assert(
|
assert(
|
||||||
'options.dependentKeys is required',
|
'options.dependentKeys is required',
|
||||||
Ember.isArray(options.dependentKeys) && options.dependentKeys.length > 0
|
isArray(options.dependentKeys) && options.dependentKeys.length > 0
|
||||||
);
|
);
|
||||||
|
|
||||||
if (options.disable) {
|
if (options.disable) {
|
||||||
|
@ -21,7 +23,7 @@ export default BaseValidator.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore empty values
|
// ignore empty values
|
||||||
if (Ember.isEmpty(value)) {
|
if (isEmpty(value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* global window */
|
||||||
window.deprecationWorkflow = window.deprecationWorkflow || {};
|
window.deprecationWorkflow = window.deprecationWorkflow || {};
|
||||||
window.deprecationWorkflow.config = {
|
window.deprecationWorkflow.config = {
|
||||||
workflow: [
|
workflow: [
|
||||||
|
|
|
@ -1,12 +1,23 @@
|
||||||
/* eslint-env node */
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = function(environment) {
|
module.exports = function(environment) {
|
||||||
const ENV = {
|
let ENV = {
|
||||||
modulePrefix: 'croodle',
|
modulePrefix: 'croodle',
|
||||||
environment: environment,
|
environment,
|
||||||
|
rootURL: '/',
|
||||||
locationType: 'hash',
|
locationType: 'hash',
|
||||||
rootURL: '',
|
EmberENV: {
|
||||||
|
FEATURES: {
|
||||||
|
// Here you can enable experimental features on an ember canary build
|
||||||
|
// e.g. 'with-controller': true
|
||||||
|
},
|
||||||
|
EXTEND_PROTOTYPES: {
|
||||||
|
Array: true,
|
||||||
|
Date: false,
|
||||||
|
String: false,
|
||||||
|
Function: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
APP: {
|
APP: {
|
||||||
// Here you can pass flags/options to your application instance
|
// Here you can pass flags/options to your application instance
|
||||||
|
@ -24,15 +35,6 @@ module.exports = function(environment) {
|
||||||
'referrer': "no-referrer"
|
'referrer': "no-referrer"
|
||||||
},
|
},
|
||||||
|
|
||||||
EmberENV: {
|
|
||||||
EXTEND_PROTOTYPES: {
|
|
||||||
Array: true,
|
|
||||||
Date: false,
|
|
||||||
String: false,
|
|
||||||
Function: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
moment: {
|
moment: {
|
||||||
includeLocales: ['ca', 'de', 'es', 'it'],
|
includeLocales: ['ca', 'de', 'es', 'it'],
|
||||||
includeTimezone: 'subset'
|
includeTimezone: 'subset'
|
||||||
|
@ -43,17 +45,30 @@ module.exports = function(environment) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (environment === 'development') {
|
||||||
|
// ENV.APP.LOG_RESOLVER = true;
|
||||||
|
// ENV.APP.LOG_ACTIVE_GENERATION = true;
|
||||||
|
// ENV.APP.LOG_TRANSITIONS = true;
|
||||||
|
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
|
||||||
|
// ENV.APP.LOG_VIEW_LOOKUPS = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (environment === 'test') {
|
if (environment === 'test') {
|
||||||
ENV.rootURL = '/';
|
ENV.rootURL = '/';
|
||||||
|
|
||||||
// Testem prefers this...
|
// Testem prefers this...
|
||||||
ENV.locationType = 'hash';
|
ENV.locationType = 'none';
|
||||||
|
|
||||||
// keep test console output quieter
|
// keep test console output quieter
|
||||||
ENV.APP.LOG_ACTIVE_GENERATION = false;
|
ENV.APP.LOG_ACTIVE_GENERATION = false;
|
||||||
ENV.APP.LOG_VIEW_LOOKUPS = false;
|
ENV.APP.LOG_VIEW_LOOKUPS = false;
|
||||||
|
|
||||||
ENV.APP.rootElement = '#ember-testing';
|
ENV.APP.rootElement = '#ember-testing';
|
||||||
|
ENV.APP.autoboot = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (environment === 'production') {
|
||||||
|
// here you can enable a production-specific feature
|
||||||
}
|
}
|
||||||
|
|
||||||
return ENV;
|
return ENV;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-env node */
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
browsers: [
|
browsers: [
|
||||||
'ie 9',
|
'ie 9',
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-env node */
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-env node */
|
/* eslint-env node */
|
||||||
|
/* eslint-disable no-console */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
let fse = require('fs-extra');
|
let fse = require('fs-extra');
|
||||||
|
@ -6,7 +7,7 @@ let child_process = require('child_process');
|
||||||
let RSVP = require('rsvp');
|
let RSVP = require('rsvp');
|
||||||
|
|
||||||
let { copy, ensureDirSync, remove } = fse;
|
let { copy, ensureDirSync, remove } = fse;
|
||||||
let { exec, execSync } = child_process;
|
let { exec } = child_process;
|
||||||
let { Promise } = RSVP;
|
let { Promise } = RSVP;
|
||||||
|
|
||||||
const apiPath = 'api/';
|
const apiPath = 'api/';
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable ember/avoid-leaking-state-in-ember-objects */
|
||||||
import { Factory } from 'ember-cli-mirage';
|
import { Factory } from 'ember-cli-mirage';
|
||||||
import encrypt from '../utils/encrypt';
|
import encrypt from '../utils/encrypt';
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable ember/avoid-leaking-state-in-ember-objects */
|
||||||
import { Factory } from 'ember-cli-mirage';
|
import { Factory } from 'ember-cli-mirage';
|
||||||
import encrypt from '../utils/encrypt';
|
import encrypt from '../utils/encrypt';
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable ember/avoid-leaking-state-in-ember-objects */
|
||||||
import ApplicationSerializer from './application';
|
import ApplicationSerializer from './application';
|
||||||
|
|
||||||
export default ApplicationSerializer.extend({
|
export default ApplicationSerializer.extend({
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
* sjcl and encryptionKey property of model as passphrase.
|
* sjcl and encryptionKey property of model as passphrase.
|
||||||
* Unsets encryptionKey property afterwards.
|
* Unsets encryptionKey property afterwards.
|
||||||
*/
|
*/
|
||||||
import Ember from 'ember';
|
import { assert } from '@ember/debug';
|
||||||
|
import { isPresent } from '@ember/utils';
|
||||||
|
import { isArray } from '@ember/array';
|
||||||
|
import { get } from '@ember/object';
|
||||||
import sjcl from 'sjcl';
|
import sjcl from 'sjcl';
|
||||||
|
|
||||||
const { assert, get, isArray, isPresent } = Ember;
|
|
||||||
|
|
||||||
export default function(propertiesToEncrypt, model) {
|
export default function(propertiesToEncrypt, model) {
|
||||||
assert(isArray(propertiesToEncrypt), 'first argument must be an array');
|
assert(isArray(propertiesToEncrypt), 'first argument must be an array');
|
||||||
assert(isPresent(get(model, 'encryptionKey')), 'model must have an encryptionKey property which isn\'t empty');
|
assert(isPresent(get(model, 'encryptionKey')), 'model must have an encryptionKey property which isn\'t empty');
|
||||||
|
|
27
package.json
27
package.json
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "croodle",
|
"name": "croodle",
|
||||||
"version": "0.5.6",
|
"version": "0.5.6",
|
||||||
|
"private": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "",
|
"author": "",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
@ -10,7 +11,8 @@
|
||||||
"repository": "https://github.com/jelhan/croodle",
|
"repository": "https://github.com/jelhan/croodle",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ember build",
|
"build": "ember build",
|
||||||
"start": "ember server",
|
"lint:js": "eslint ./*.js app config lib server tests",
|
||||||
|
"start": "ember serve",
|
||||||
"test": "ember test"
|
"test": "ember test"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -22,35 +24,35 @@
|
||||||
"ember-bootstrap": "^2.1.2",
|
"ember-bootstrap": "^2.1.2",
|
||||||
"ember-bootstrap-cp-validations": "^1.0.0",
|
"ember-bootstrap-cp-validations": "^1.0.0",
|
||||||
"ember-browserify": "^1.1.11",
|
"ember-browserify": "^1.1.11",
|
||||||
"ember-cli": "~2.14.1",
|
"ember-cli": "~2.18.2",
|
||||||
"ember-cli-acceptance-test-helpers": "^1.0.0",
|
"ember-cli-acceptance-test-helpers": "^1.0.0",
|
||||||
"ember-cli-app-version": "^3.0.0",
|
"ember-cli-app-version": "^3.0.0",
|
||||||
"ember-cli-babel": "^6.3.0",
|
"ember-cli-babel": "^6.6.0",
|
||||||
"ember-cli-bootstrap-datepicker": "^0.6.1",
|
"ember-cli-bootstrap-datepicker": "^0.6.1",
|
||||||
"ember-cli-browser-navigation-button-test-helper": "^0.0.4",
|
"ember-cli-browser-navigation-button-test-helper": "^0.0.4",
|
||||||
"ember-cli-build-info": "^0.3.0",
|
"ember-cli-build-info": "^0.3.0",
|
||||||
"ember-cli-chart": "^3.3.1",
|
"ember-cli-chart": "^3.3.1",
|
||||||
"ember-cli-clipboard": "^0.8.0",
|
"ember-cli-clipboard": "^0.8.0",
|
||||||
"ember-cli-content-security-policy": "^0.6.2",
|
"ember-cli-content-security-policy": "^0.6.2",
|
||||||
"ember-cli-dependency-checker": "^1.3.0",
|
"ember-cli-dependency-checker": "^2.0.0",
|
||||||
"ember-cli-deprecation-workflow": "^0.2.3",
|
"ember-cli-deprecation-workflow": "^0.2.3",
|
||||||
"ember-cli-eslint": "^3.0.0",
|
"ember-cli-eslint": "^4.2.1",
|
||||||
"ember-cli-flash": "^1.4.0",
|
"ember-cli-flash": "^1.4.0",
|
||||||
"ember-cli-htmlbars": "^2.0.1",
|
"ember-cli-htmlbars": "^2.0.1",
|
||||||
"ember-cli-htmlbars-inline-precompile": "^0.4.3",
|
"ember-cli-htmlbars-inline-precompile": "^1.0.0",
|
||||||
"ember-cli-inject-live-reload": "^1.4.1",
|
"ember-cli-inject-live-reload": "^1.4.1",
|
||||||
"ember-cli-less": "^1.5.3",
|
"ember-cli-less": "^1.5.3",
|
||||||
"ember-cli-mirage": "^0.4.10",
|
"ember-cli-mirage": "^0.4.10",
|
||||||
"ember-cli-moment-shim": "^3.7.1",
|
"ember-cli-moment-shim": "^3.7.1",
|
||||||
"ember-cli-page-object": "^1.11.0",
|
"ember-cli-page-object": "^1.11.0",
|
||||||
"ember-cli-qunit": "^4.0.0",
|
"ember-cli-qunit": "^4.1.1",
|
||||||
"ember-cli-release": "^0.2.9",
|
"ember-cli-release": "^0.2.9",
|
||||||
"ember-cli-sauce": "^1.6.0",
|
"ember-cli-sauce": "^1.6.0",
|
||||||
"ember-cli-shims": "^1.1.0",
|
"ember-cli-shims": "^1.2.0",
|
||||||
"ember-cli-sri": "^2.1.0",
|
"ember-cli-sri": "^2.1.0",
|
||||||
"ember-cli-uglify": "^1.2.0",
|
"ember-cli-uglify": "^2.0.0",
|
||||||
"ember-cp-validations": "^3.5.0",
|
"ember-cp-validations": "^3.5.0",
|
||||||
"ember-data": "~2.14.3",
|
"ember-data": "~2.18.0",
|
||||||
"ember-data-model-fragments": "^2.14.0",
|
"ember-data-model-fragments": "^2.14.0",
|
||||||
"ember-export-application-global": "^2.0.0",
|
"ember-export-application-global": "^2.0.0",
|
||||||
"ember-i18n": "^5.0.2",
|
"ember-i18n": "^5.0.2",
|
||||||
|
@ -65,16 +67,15 @@
|
||||||
"ember-resolver": "^4.0.0",
|
"ember-resolver": "^4.0.0",
|
||||||
"ember-route-action-helper": "^2.0.6",
|
"ember-route-action-helper": "^2.0.6",
|
||||||
"ember-simple-select": "^0.6.1",
|
"ember-simple-select": "^0.6.1",
|
||||||
"ember-source": "~2.14.1",
|
"ember-source": "~2.18.0",
|
||||||
"ember-suave": "^4.0.0",
|
|
||||||
"ember-transition-helper": "^1.0.0",
|
"ember-transition-helper": "^1.0.0",
|
||||||
"ember-truth-helpers": "^2.1.0",
|
"ember-truth-helpers": "^2.1.0",
|
||||||
|
"eslint-plugin-ember": "^5.0.0",
|
||||||
"loader.js": "^4.2.3"
|
"loader.js": "^4.2.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^4.5 || 6.* || >= 7.*"
|
"node": "^4.5 || 6.* || >= 7.*"
|
||||||
},
|
},
|
||||||
"private": true,
|
|
||||||
"ember-addon": {
|
"ember-addon": {
|
||||||
"paths": [
|
"paths": [
|
||||||
"lib/include-api-in-build"
|
"lib/include-api-in-build"
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
|
|
||||||
<cross-domain-policy>
|
|
||||||
<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
|
|
||||||
|
|
||||||
<!-- Most restrictive policy: -->
|
|
||||||
<site-control permitted-cross-domain-policies="none"/>
|
|
||||||
|
|
||||||
<!-- Least restrictive policy: -->
|
|
||||||
<!--
|
|
||||||
<site-control permitted-cross-domain-policies="all"/>
|
|
||||||
<allow-access-from domain="*" to-ports="*" secure="false"/>
|
|
||||||
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
|
|
||||||
-->
|
|
||||||
</cross-domain-policy>
|
|
20
testem.js
20
testem.js
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-env node */
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
test_page: 'tests/index.html?hidepassed',
|
test_page: 'tests/index.html?hidepassed',
|
||||||
disable_watching: true,
|
disable_watching: true,
|
||||||
|
@ -9,13 +8,18 @@ module.exports = {
|
||||||
'Chrome'
|
'Chrome'
|
||||||
],
|
],
|
||||||
browser_args: {
|
browser_args: {
|
||||||
Chrome: [
|
Chrome: {
|
||||||
process.env.CI ? '--no-sandbox' : null,
|
mode: 'ci',
|
||||||
'--disable-gpu',
|
args: [
|
||||||
'--headless',
|
// --no-sandbox is needed when running Chrome inside a container
|
||||||
'--remote-debugging-port=9222',
|
process.env.TRAVIS ? '--no-sandbox' : null,
|
||||||
'--window-size=1440,900'
|
|
||||||
].filter(Boolean)
|
'--disable-gpu',
|
||||||
|
'--headless',
|
||||||
|
'--remote-debugging-port=0',
|
||||||
|
'--window-size=1440,900'
|
||||||
|
].filter(Boolean)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
proxies: {
|
proxies: {
|
||||||
'/': {
|
'/': {
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
embertest: true
|
|
||||||
},
|
|
||||||
globals: {
|
|
||||||
// ember-cli-acceptance-test-helpers
|
|
||||||
hasComponent: false,
|
|
||||||
// i18n test helper
|
|
||||||
t: false,
|
|
||||||
// browser-navigation-buttons-test-helper
|
|
||||||
backButton: false,
|
|
||||||
forwardButton: false,
|
|
||||||
setupBrowserNavigationButtons: false,
|
|
||||||
// local test helpers
|
|
||||||
pollHasUser: false,
|
|
||||||
pollHasUsersCount: false,
|
|
||||||
pollParticipate: false,
|
|
||||||
server: false,
|
|
||||||
switchTab: false
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -11,7 +11,7 @@ test('version is included as html meta tag', function(assert) {
|
||||||
// ToDo: figure out why find() helper does not work but jQuery does
|
// ToDo: figure out why find() helper does not work but jQuery does
|
||||||
assert.ok(jQuery('head meta[name="build-info"]').length === 1, 'tag exists');
|
assert.ok(jQuery('head meta[name="build-info"]').length === 1, 'tag exists');
|
||||||
assert.ok(
|
assert.ok(
|
||||||
jQuery('head meta[name="build-info"]').attr('content').match(/^version=\d[\d\.]+\d(-(alpha|beta|rc)\d)?(\+[\da-z]{8})?$/) !== null,
|
jQuery('head meta[name="build-info"]').attr('content').match(/^version=\d[\d.]+\d(-(alpha|beta|rc)\d)?(\+[\da-z]{8})?$/) !== null,
|
||||||
'format '.concat(jQuery('head meta[name="build-info"]').attr('content'), ' is correct')
|
'format '.concat(jQuery('head meta[name="build-info"]').attr('content'), ' is correct')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import Ember from 'ember';
|
import { run } from '@ember/runloop';
|
||||||
|
|
||||||
const { run } = Ember;
|
|
||||||
|
|
||||||
export default function destroyApp(application) {
|
export default function destroyApp(application) {
|
||||||
// this is required to fix "second Pretender instance" warnings
|
// this is required to fix "second Pretender instance" warnings
|
||||||
|
@ -9,7 +7,4 @@ export default function destroyApp(application) {
|
||||||
}
|
}
|
||||||
|
|
||||||
run(application, 'destroy');
|
run(application, 'destroy');
|
||||||
if (window.server) {
|
|
||||||
window.server.shutdown();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import { module } from 'qunit';
|
import { module } from 'qunit';
|
||||||
import Ember from 'ember';
|
import { resolve } from 'rsvp';
|
||||||
import startApp from '../helpers/start-app';
|
import startApp from '../helpers/start-app';
|
||||||
import destroyApp from '../helpers/destroy-app';
|
import destroyApp from '../helpers/destroy-app';
|
||||||
|
|
||||||
const { RSVP: { resolve } } = Ember;
|
|
||||||
|
|
||||||
export default function(name, options = {}) {
|
export default function(name, options = {}) {
|
||||||
module(name, {
|
module(name, {
|
||||||
beforeEach(assert) {
|
beforeEach(assert) {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import Ember from 'ember';
|
import { isEmpty } from '@ember/utils';
|
||||||
|
import { registerHelper } from '@ember/test';
|
||||||
|
|
||||||
const helpers = function() {
|
const helpers = function() {
|
||||||
Ember.Test.registerHelper('pollHasUser', function(app, assert, name, selections) {
|
registerHelper('pollHasUser', function(app, assert, name, selections) {
|
||||||
let elBase;
|
let elBase;
|
||||||
find('.user').each((index, el) => {
|
find('.user').each((index, el) => {
|
||||||
if (find('td:nth-child(1)', el).text().trim() === name) {
|
if (find('td:nth-child(1)', el).text().trim() === name) {
|
||||||
|
@ -21,8 +22,8 @@ const helpers = function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ember.Test.registerHelper('pollHasUsersCount', function(app, assert, count, message) {
|
registerHelper('pollHasUsersCount', function(app, assert, count, message) {
|
||||||
if (Ember.isEmpty(message)) {
|
if (isEmpty(message)) {
|
||||||
message = 'poll has expected count of users';
|
message = 'poll has expected count of users';
|
||||||
}
|
}
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import Ember from 'ember';
|
import { isEmpty } from '@ember/utils';
|
||||||
|
import { registerAsyncHelper } from '@ember/test';
|
||||||
|
|
||||||
export default Ember.Test.registerAsyncHelper('pollParticipate', function(app, name, selections) {
|
export default registerAsyncHelper('pollParticipate', function(app, name, selections) {
|
||||||
if (!Ember.isEmpty(name)) {
|
if (!isEmpty(name)) {
|
||||||
fillIn('.participation .name input', name);
|
fillIn('.participation .name input', name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const isFreeText = find('.participation .selections .radio').length ? false : true;
|
const isFreeText = find('.participation .selections .radio').length ? false : true;
|
||||||
selections.forEach((selection, index) => {
|
selections.forEach((selection, index) => {
|
||||||
if (!Ember.isEmpty(selection)) {
|
if (!isEmpty(selection)) {
|
||||||
if (isFreeText) {
|
if (isFreeText) {
|
||||||
fillIn(`.participation .selections .form-group:nth-child(${index + 1}) input`, selection);
|
fillIn(`.participation .selections .form-group:nth-child(${index + 1}) input`, selection);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -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;
|
|
|
@ -1,18 +1,20 @@
|
||||||
import Ember from 'ember';
|
|
||||||
import Application from '../../app';
|
import Application from '../../app';
|
||||||
import config from '../../config/environment';
|
import config from '../../config/environment';
|
||||||
|
import { merge } from '@ember/polyfills';
|
||||||
|
import { run } from '@ember/runloop';
|
||||||
import './poll-has-users';
|
import './poll-has-users';
|
||||||
import './poll-participate';
|
import './poll-participate';
|
||||||
import './switch-tab';
|
import './switch-tab';
|
||||||
import './t';
|
|
||||||
import registerAcceptanceTestHelpers from './201-created/register-acceptance-test-helpers';
|
import registerAcceptanceTestHelpers from './201-created/register-acceptance-test-helpers';
|
||||||
import registerBrowserNavigationButtonTestHelpers from './browser-navigation-buttons';
|
import registerBrowserNavigationButtonTestHelpers from './browser-navigation-buttons';
|
||||||
|
import './ember-i18n/test-helpers';
|
||||||
|
|
||||||
export default function startApp(attrs) {
|
export default function startApp(attrs) {
|
||||||
let attributes = Ember.merge({}, config.APP);
|
let attributes = merge({}, config.APP);
|
||||||
attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
|
attributes.autoboot = true;
|
||||||
|
attributes = merge(attributes, attrs); // use defaults, but you can override;
|
||||||
|
|
||||||
return Ember.run(() => {
|
return run(() => {
|
||||||
let application = Application.create(attributes);
|
let application = Application.create(attributes);
|
||||||
application.setupForTesting();
|
application.setupForTesting();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import Ember from 'ember';
|
import { registerAsyncHelper } from '@ember/test';
|
||||||
|
|
||||||
export default Ember.Test.registerAsyncHelper('switchTab', function(app, tab) {
|
export default registerAsyncHelper('switchTab', function(app, tab) {
|
||||||
click(`.nav-tabs .${tab} a`);
|
click(`.nav-tabs .${tab} a`);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
export default Ember.Test.registerHelper('t', function(app, key, context) {
|
|
||||||
return app.__container__.lookup('service:i18n').t(key, context);
|
|
||||||
});
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import EmberObject from '@ember/object';
|
||||||
import { moduleForComponent, test } from 'ember-qunit';
|
import { moduleForComponent, test } from 'ember-qunit';
|
||||||
import hbs from 'htmlbars-inline-precompile';
|
import hbs from 'htmlbars-inline-precompile';
|
||||||
import Ember from 'ember';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
moduleForComponent('create-options-dates', 'Integration | Component | create options dates', {
|
moduleForComponent('create-options-dates', 'Integration | Component | create options dates', {
|
||||||
|
@ -18,8 +18,8 @@ test('it renders a ember-cli-bootstrap-datepicker component', function(assert) {
|
||||||
|
|
||||||
test('bootstrap-datepicker shows dates in options', function(assert) {
|
test('bootstrap-datepicker shows dates in options', function(assert) {
|
||||||
this.set('options', [
|
this.set('options', [
|
||||||
Ember.Object.create({ title: '2015-01-01' }),
|
EmberObject.create({ title: '2015-01-01' }),
|
||||||
Ember.Object.create({ title: '2015-01-02' })
|
EmberObject.create({ title: '2015-01-02' })
|
||||||
]);
|
]);
|
||||||
this.render(hbs`{{#bs-form as |form|}}{{create-options-dates options=options form=form}}{{/bs-form}}`);
|
this.render(hbs`{{#bs-form as |form|}}{{create-options-dates options=options form=form}}{{/bs-form}}`);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
import { alias } from '@ember/object/computed';
|
||||||
|
import { run } from '@ember/runloop';
|
||||||
import { moduleForComponent, test } from 'ember-qunit';
|
import { moduleForComponent, test } from 'ember-qunit';
|
||||||
import hbs from 'htmlbars-inline-precompile';
|
import hbs from 'htmlbars-inline-precompile';
|
||||||
import jQuery from 'jquery';
|
import jQuery from 'jquery';
|
||||||
import Ember from 'ember';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
moduleForComponent('create-options-datetime', 'Integration | Component | create options datetime', {
|
moduleForComponent('create-options-datetime', 'Integration | Component | create options datetime', {
|
||||||
|
@ -23,7 +24,7 @@ test('it generates inpute field for options iso 8601 date string (without time)'
|
||||||
// which validates according to poll model it belongs to
|
// which validates according to poll model it belongs to
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.set('poll', this.store.createRecord('poll', {
|
this.set('poll', this.store.createRecord('poll', {
|
||||||
isFindADate: true,
|
isFindADate: true,
|
||||||
isMakeAPoll: false,
|
isMakeAPoll: false,
|
||||||
|
@ -51,7 +52,7 @@ test('it generates inpute field for options iso 8601 datetime string (with time)
|
||||||
// which validates according to poll model it belongs to
|
// which validates according to poll model it belongs to
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.set('poll', this.store.createRecord('poll', {
|
this.set('poll', this.store.createRecord('poll', {
|
||||||
isFindADate: true,
|
isFindADate: true,
|
||||||
isMakeAPoll: false,
|
isMakeAPoll: false,
|
||||||
|
@ -79,7 +80,7 @@ test('it hides repeated labels', function(assert) {
|
||||||
// which validates according to poll model it belongs to
|
// which validates according to poll model it belongs to
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.set('poll', this.store.createRecord('poll', {
|
this.set('poll', this.store.createRecord('poll', {
|
||||||
isFindADate: true,
|
isFindADate: true,
|
||||||
isMakeAPoll: false,
|
isMakeAPoll: false,
|
||||||
|
@ -121,7 +122,7 @@ test('allows to add another option', function(assert) {
|
||||||
// which validates according to poll model it belongs to
|
// which validates according to poll model it belongs to
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.set('poll', this.store.createRecord('poll', {
|
this.set('poll', this.store.createRecord('poll', {
|
||||||
options: [
|
options: [
|
||||||
{ title: '2015-01-01' },
|
{ title: '2015-01-01' },
|
||||||
|
@ -158,7 +159,7 @@ test('allows to delete an option', function(assert) {
|
||||||
// which validates according to poll model it belongs to
|
// which validates according to poll model it belongs to
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.set('poll', this.store.createRecord('poll', {
|
this.set('poll', this.store.createRecord('poll', {
|
||||||
isFindADate: true,
|
isFindADate: true,
|
||||||
isMakeAPoll: false,
|
isMakeAPoll: false,
|
||||||
|
@ -182,7 +183,7 @@ test('allows to delete an option', function(assert) {
|
||||||
'options are deleteable'
|
'options are deleteable'
|
||||||
);
|
);
|
||||||
this.$('.days .form-group').eq(0).find('.delete').click();
|
this.$('.days .form-group').eq(0).find('.delete').click();
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.$('.days .form-group input').length,
|
this.$('.days .form-group input').length,
|
||||||
1,
|
1,
|
||||||
|
@ -211,7 +212,7 @@ test('adopt times of first day - simple', function(assert) {
|
||||||
// which validates according to poll model it belongs to
|
// which validates according to poll model it belongs to
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.set('poll', this.store.createRecord('poll', {
|
this.set('poll', this.store.createRecord('poll', {
|
||||||
options: [
|
options: [
|
||||||
{ title: moment().hour(10).minute(0).toISOString() },
|
{ title: moment().hour(10).minute(0).toISOString() },
|
||||||
|
@ -221,7 +222,7 @@ test('adopt times of first day - simple', function(assert) {
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
this.render(hbs`{{create-options-datetime dates=poll.options}}`);
|
this.render(hbs`{{create-options-datetime dates=poll.options}}`);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.$('button.adopt-times-of-first-day').click();
|
this.$('button.adopt-times-of-first-day').click();
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -246,7 +247,7 @@ test('adopt times of first day - more times on first day than on others', functi
|
||||||
// which validates according to poll model it belongs to
|
// which validates according to poll model it belongs to
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.set('poll', this.store.createRecord('poll', {
|
this.set('poll', this.store.createRecord('poll', {
|
||||||
options: [
|
options: [
|
||||||
{ title: moment().hour(10).minute(0).toISOString() },
|
{ title: moment().hour(10).minute(0).toISOString() },
|
||||||
|
@ -257,7 +258,7 @@ test('adopt times of first day - more times on first day than on others', functi
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
this.render(hbs`{{create-options-datetime dates=poll.options}}`);
|
this.render(hbs`{{create-options-datetime dates=poll.options}}`);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.$('button.adopt-times-of-first-day').click();
|
this.$('button.adopt-times-of-first-day').click();
|
||||||
});
|
});
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
|
@ -272,7 +273,7 @@ test('adopt times of first day - excess times on other days got deleted', functi
|
||||||
// which validates according to poll model it belongs to
|
// which validates according to poll model it belongs to
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.set('poll', this.store.createRecord('poll', {
|
this.set('poll', this.store.createRecord('poll', {
|
||||||
isFindADate: true,
|
isFindADate: true,
|
||||||
isMakeAPoll: false,
|
isMakeAPoll: false,
|
||||||
|
@ -284,7 +285,7 @@ test('adopt times of first day - excess times on other days got deleted', functi
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
this.render(hbs`{{create-options-datetime dates=poll.options}}`);
|
this.render(hbs`{{create-options-datetime dates=poll.options}}`);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.$('button.adopt-times-of-first-day').click();
|
this.$('button.adopt-times-of-first-day').click();
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -304,12 +305,12 @@ test('validation', function(assert) {
|
||||||
// which validates according to poll model it belongs to
|
// which validates according to poll model it belongs to
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.set('poll', this.store.createRecord('poll', {
|
this.set('poll', this.store.createRecord('poll', {
|
||||||
isFindADate: true,
|
isFindADate: true,
|
||||||
isMakeAPoll: false
|
isMakeAPoll: false
|
||||||
}));
|
}));
|
||||||
this.set('options', Ember.computed.alias('poll.options'));
|
this.set('options', alias('poll.options'));
|
||||||
this.get('options').pushObjects([
|
this.get('options').pushObjects([
|
||||||
{ title: '2015-01-01' },
|
{ title: '2015-01-01' },
|
||||||
{ title: '2015-02-02' }
|
{ title: '2015-02-02' }
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { run } from '@ember/runloop';
|
||||||
import { moduleForComponent, test } from 'ember-qunit';
|
import { moduleForComponent, test } from 'ember-qunit';
|
||||||
import { blur, fillIn, findAll, focus } from 'ember-native-dom-helpers';
|
import { blur, fillIn, findAll, focus } from 'ember-native-dom-helpers';
|
||||||
import hbs from 'htmlbars-inline-precompile';
|
import hbs from 'htmlbars-inline-precompile';
|
||||||
import hasComponent from 'croodle/tests/helpers/201-created/raw/has-component';
|
import hasComponent from 'croodle/tests/helpers/201-created/raw/has-component';
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
moduleForComponent('create-options', 'Integration | Component | create options', {
|
moduleForComponent('create-options', 'Integration | Component | create options', {
|
||||||
integration: true,
|
integration: true,
|
||||||
|
@ -49,7 +49,7 @@ test('shows validation errors if options are not unique (makeAPoll)', async func
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
let poll;
|
let poll;
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
poll = this.store.createRecord('poll', {
|
poll = this.store.createRecord('poll', {
|
||||||
isFindADate: this.get('isFindADate'),
|
isFindADate: this.get('isFindADate'),
|
||||||
isDateTime: this.get('isDateTime'),
|
isDateTime: this.get('isDateTime'),
|
||||||
|
@ -102,7 +102,7 @@ test('shows validation errors if option is empty (makeAPoll)', async function(as
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
let poll;
|
let poll;
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
poll = this.store.createRecord('poll', {
|
poll = this.store.createRecord('poll', {
|
||||||
isFindADate: this.get('isFindADate'),
|
isFindADate: this.get('isFindADate'),
|
||||||
isDateTime: this.get('isDateTime'),
|
isDateTime: this.get('isDateTime'),
|
||||||
|
@ -148,7 +148,7 @@ test('label reflects validation state of all inputs (makeAPoll)', async function
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
let poll;
|
let poll;
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
poll = this.store.createRecord('poll', {
|
poll = this.store.createRecord('poll', {
|
||||||
isFindADate: this.get('isFindADate'),
|
isFindADate: this.get('isFindADate'),
|
||||||
isDateTime: this.get('isDateTime'),
|
isDateTime: this.get('isDateTime'),
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
import { run } from '@ember/runloop';
|
||||||
|
import EmberObject from '@ember/object';
|
||||||
import { moduleForComponent, test } from 'ember-qunit';
|
import { moduleForComponent, test } from 'ember-qunit';
|
||||||
import hbs from 'htmlbars-inline-precompile';
|
import hbs from 'htmlbars-inline-precompile';
|
||||||
import jQuery from 'jquery';
|
import jQuery from 'jquery';
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
moduleForComponent('create-options-text', 'Integration | Component | create options text', {
|
moduleForComponent('create-options-text', 'Integration | Component | create options text', {
|
||||||
integration: true,
|
integration: true,
|
||||||
|
@ -19,9 +20,9 @@ test('it generates at least two input fields', function(assert) {
|
||||||
|
|
||||||
test('generates input fields according options', function(assert) {
|
test('generates input fields according options', function(assert) {
|
||||||
this.set('options', [
|
this.set('options', [
|
||||||
Ember.Object.create({ title: 'foo' }),
|
EmberObject.create({ title: 'foo' }),
|
||||||
Ember.Object.create({ title: 'bar' }),
|
EmberObject.create({ title: 'bar' }),
|
||||||
Ember.Object.create({ title: 'baz' })
|
EmberObject.create({ title: 'baz' })
|
||||||
]);
|
]);
|
||||||
this.render(hbs`{{#bs-form as |form|}}{{create-options-text options=options form=form}}{{/bs-form}}`);
|
this.render(hbs`{{#bs-form as |form|}}{{create-options-text options=options form=form}}{{/bs-form}}`);
|
||||||
|
|
||||||
|
@ -41,8 +42,8 @@ test('generates input fields according options', function(assert) {
|
||||||
|
|
||||||
test('observes changes to options', function(assert) {
|
test('observes changes to options', function(assert) {
|
||||||
this.set('options', [
|
this.set('options', [
|
||||||
Ember.Object.create({ title: 'foo' }),
|
EmberObject.create({ title: 'foo' }),
|
||||||
Ember.Object.create({ title: 'bar' })
|
EmberObject.create({ title: 'bar' })
|
||||||
]);
|
]);
|
||||||
this.render(hbs`{{#bs-form as |form|}}{{create-options-text options=options form=form}}{{/bs-form}}`);
|
this.render(hbs`{{#bs-form as |form|}}{{create-options-text options=options form=form}}{{/bs-form}}`);
|
||||||
|
|
||||||
|
@ -52,9 +53,9 @@ test('observes changes to options', function(assert) {
|
||||||
'has correct amount of input fields before change'
|
'has correct amount of input fields before change'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.get('options').pushObject(
|
this.get('options').pushObject(
|
||||||
Ember.Object.create({ title: 'baz' })
|
EmberObject.create({ title: 'baz' })
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -72,8 +73,8 @@ test('observes changes to options', function(assert) {
|
||||||
|
|
||||||
test('changes to value updates option', function(assert) {
|
test('changes to value updates option', function(assert) {
|
||||||
this.set('options', [
|
this.set('options', [
|
||||||
Ember.Object.create({ title: 'foo' }),
|
EmberObject.create({ title: 'foo' }),
|
||||||
Ember.Object.create({ title: 'bar' })
|
EmberObject.create({ title: 'bar' })
|
||||||
]);
|
]);
|
||||||
this.render(hbs`{{#bs-form as |form|}}{{create-options-text options=options form=form}}{{/bs-form}}`);
|
this.render(hbs`{{#bs-form as |form|}}{{create-options-text options=options form=form}}{{/bs-form}}`);
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ test('allows to add another option', function(assert) {
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
let poll;
|
let poll;
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
poll = this.store.createRecord('poll', {
|
poll = this.store.createRecord('poll', {
|
||||||
isFindADate: this.get('isFindADate'),
|
isFindADate: this.get('isFindADate'),
|
||||||
isDateTime: this.get('isDateTime'),
|
isDateTime: this.get('isDateTime'),
|
||||||
|
@ -111,7 +112,7 @@ test('allows to add another option', function(assert) {
|
||||||
'there are two input fields before'
|
'there are two input fields before'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.$('.form-group .add').eq(0).click();
|
this.$('.form-group .add').eq(0).click();
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -127,7 +128,7 @@ test('allows to add another option', function(assert) {
|
||||||
'it is added at correct position'
|
'it is added at correct position'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.$('.form-group input').eq(1).val('baz').trigger('change');
|
this.$('.form-group input').eq(1).val('baz').trigger('change');
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -139,9 +140,9 @@ test('allows to add another option', function(assert) {
|
||||||
|
|
||||||
test('allows to delete an option', function(assert) {
|
test('allows to delete an option', function(assert) {
|
||||||
this.set('options', [
|
this.set('options', [
|
||||||
Ember.Object.create({ title: 'foo' }),
|
EmberObject.create({ title: 'foo' }),
|
||||||
Ember.Object.create({ title: 'bar' }),
|
EmberObject.create({ title: 'bar' }),
|
||||||
Ember.Object.create({ title: 'baz' })
|
EmberObject.create({ title: 'baz' })
|
||||||
]);
|
]);
|
||||||
this.render(hbs`{{#bs-form as |form|}}{{create-options-text options=options form=form}}{{/bs-form}}`);
|
this.render(hbs`{{#bs-form as |form|}}{{create-options-text options=options form=form}}{{/bs-form}}`);
|
||||||
|
|
||||||
|
@ -157,7 +158,7 @@ test('allows to delete an option', function(assert) {
|
||||||
'options are deleteable'
|
'options are deleteable'
|
||||||
);
|
);
|
||||||
this.$('.form-group .delete').eq(1).click();
|
this.$('.form-group .delete').eq(1).click();
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.$('.form-group input').length,
|
this.$('.form-group input').length,
|
||||||
2,
|
2,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import EmberObject from '@ember/object';
|
||||||
import { moduleForComponent, test } from 'ember-qunit';
|
import { moduleForComponent, test } from 'ember-qunit';
|
||||||
import hbs from 'htmlbars-inline-precompile';
|
import hbs from 'htmlbars-inline-precompile';
|
||||||
import Ember from 'ember';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
moduleForComponent('poll-evaluation-chart', 'Integration | Component | poll evaluation chart', {
|
moduleForComponent('poll-evaluation-chart', 'Integration | Component | poll evaluation chart', {
|
||||||
|
@ -12,22 +12,22 @@ moduleForComponent('poll-evaluation-chart', 'Integration | Component | poll eval
|
||||||
|
|
||||||
test('it renders', function(assert) {
|
test('it renders', function(assert) {
|
||||||
this.set('options', [
|
this.set('options', [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
formatted: 'Thursday, January 1, 2015',
|
formatted: 'Thursday, January 1, 2015',
|
||||||
title: moment('2015-01-01'),
|
title: moment('2015-01-01'),
|
||||||
hasTime: false
|
hasTime: false
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
formatted: 'Monday, February 2, 2015',
|
formatted: 'Monday, February 2, 2015',
|
||||||
title: moment('2015-02-02'),
|
title: moment('2015-02-02'),
|
||||||
hasTime: false
|
hasTime: false
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
formatted: 'Tuesday, March 3, 2015 1:00 AM',
|
formatted: 'Tuesday, March 3, 2015 1:00 AM',
|
||||||
title: moment('2015-03-03T01:00'),
|
title: moment('2015-03-03T01:00'),
|
||||||
hasTime: true
|
hasTime: true
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
formatted: 'Tuesday, March 3, 2015 11:00 AM',
|
formatted: 'Tuesday, March 3, 2015 11:00 AM',
|
||||||
title: moment('2015-03-03T11:00'),
|
title: moment('2015-03-03T11:00'),
|
||||||
hasTime: true
|
hasTime: true
|
||||||
|
@ -35,36 +35,36 @@ test('it renders', function(assert) {
|
||||||
]);
|
]);
|
||||||
this.set('answerType', 'YesNoMaybe');
|
this.set('answerType', 'YesNoMaybe');
|
||||||
this.set('users', [
|
this.set('users', [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
id: 1,
|
id: 1,
|
||||||
selections: [
|
selections: [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'yes'
|
type: 'yes'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'yes'
|
type: 'yes'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'maybe'
|
type: 'maybe'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'no'
|
type: 'no'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
id: 2,
|
id: 2,
|
||||||
selections: [
|
selections: [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'yes'
|
type: 'yes'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'maybe'
|
type: 'maybe'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'no'
|
type: 'no'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'no'
|
type: 'no'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
|
import { get } from '@ember/object';
|
||||||
import { module, test } from 'qunit';
|
import { module, test } from 'qunit';
|
||||||
import { startMirage } from 'croodle/initializers/ember-cli-mirage';
|
import { startMirage } from 'croodle/initializers/ember-cli-mirage';
|
||||||
import sjcl from 'sjcl';
|
import sjcl from 'sjcl';
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
const { get } = Ember;
|
|
||||||
|
|
||||||
module('Integration | Mirage api mocking', {
|
module('Integration | Mirage api mocking', {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
|
import { getOwner } from '@ember/application';
|
||||||
import { moduleFor, test } from 'ember-qunit';
|
import { moduleFor, test } from 'ember-qunit';
|
||||||
import Ember from 'ember';
|
|
||||||
import config from 'croodle/config/environment';
|
import config from 'croodle/config/environment';
|
||||||
import LocaleHelper from 'ember-i18n/utils/locale';
|
import LocaleHelper from 'ember-i18n/utils/locale';
|
||||||
import localesMeta from 'croodle/locales/meta';
|
import localesMeta from 'croodle/locales/meta';
|
||||||
|
|
||||||
const { getOwner } = Ember;
|
|
||||||
|
|
||||||
moduleFor('service:i18n', 'Integration | translations', {
|
moduleFor('service:i18n', 'Integration | translations', {
|
||||||
integration: true
|
integration: true
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import Ember from 'ember';
|
import { isPresent } from '@ember/utils';
|
||||||
import PageObject from 'ember-cli-page-object';
|
import PageObject from 'ember-cli-page-object';
|
||||||
import { findElementWithAssert } from 'ember-cli-page-object';
|
import { findElementWithAssert } from 'ember-cli-page-object';
|
||||||
import { defaultsForCreate } from 'croodle/tests/pages/defaults';
|
import { defaultsForCreate } from 'croodle/tests/pages/defaults';
|
||||||
|
@ -22,7 +22,7 @@ const setBootstrapDatepicker = function(selector, options = {}) {
|
||||||
isDescriptor: true,
|
isDescriptor: true,
|
||||||
value(dates) {
|
value(dates) {
|
||||||
const el = findElementWithAssert(this, selector, options);
|
const el = findElementWithAssert(this, selector, options);
|
||||||
if (Ember.isPresent(dates)) {
|
if (isPresent(dates)) {
|
||||||
const normalizedDates = dates.map((date) => {
|
const normalizedDates = dates.map((date) => {
|
||||||
if (typeof date.toDate === 'function') {
|
if (typeof date.toDate === 'function') {
|
||||||
date = date.toDate();
|
date = date.toDate();
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import resolver from './helpers/resolver';
|
import Application from '../app';
|
||||||
import {
|
import config from '../config/environment';
|
||||||
setResolver
|
import { setApplication } from '@ember/test-helpers';
|
||||||
} from 'ember-qunit';
|
import { start } from 'ember-qunit';
|
||||||
import { start } from 'ember-cli-qunit';
|
|
||||||
|
setApplication(Application.create(config.APP));
|
||||||
|
|
||||||
setResolver(resolver);
|
|
||||||
start();
|
start();
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { isArray } from '@ember/array';
|
||||||
|
import EmberObject from '@ember/object';
|
||||||
|
import { run } from '@ember/runloop';
|
||||||
import { moduleForComponent, test } from 'ember-qunit';
|
import { moduleForComponent, test } from 'ember-qunit';
|
||||||
import Ember from 'ember';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
const { Object: EmberObject, run } = Ember;
|
|
||||||
|
|
||||||
moduleForComponent('create-options-dates', 'Unit | Component | create options dates', {
|
moduleForComponent('create-options-dates', 'Unit | Component | create options dates', {
|
||||||
needs: ['config:environment', 'model:option', 'service:i18n'],
|
needs: ['config:environment', 'model:option', 'service:i18n'],
|
||||||
unit: true,
|
unit: true,
|
||||||
|
@ -20,7 +20,7 @@ test('options get mapped to dates as optionsBootstrapDatepicker (used by ember-c
|
||||||
EmberObject.create({ title: 'non valid date string' })
|
EmberObject.create({ title: 'non valid date string' })
|
||||||
]);
|
]);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
Ember.isArray(
|
isArray(
|
||||||
controller.get('optionsBootstrapDatepicker')
|
controller.get('optionsBootstrapDatepicker')
|
||||||
),
|
),
|
||||||
"it's an array"
|
"it's an array"
|
||||||
|
@ -52,7 +52,7 @@ test('options having times get mapped to dates as optionsBootstrapDatepicker (us
|
||||||
EmberObject.create({ title: '2016-03-03' })
|
EmberObject.create({ title: '2016-03-03' })
|
||||||
]);
|
]);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
Ember.isArray(
|
isArray(
|
||||||
controller.get('optionsBootstrapDatepicker')
|
controller.get('optionsBootstrapDatepicker')
|
||||||
),
|
),
|
||||||
"it's an array"
|
"it's an array"
|
||||||
|
@ -92,7 +92,7 @@ test('options get set correctly by optionsBootstrapDatepicker (used by ember-cli
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
assert.ok(
|
assert.ok(
|
||||||
Ember.isArray(
|
isArray(
|
||||||
controller.get('options')
|
controller.get('options')
|
||||||
),
|
),
|
||||||
'options is still an array'
|
'options is still an array'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { run } from '@ember/runloop';
|
||||||
import { moduleForComponent, test } from 'ember-qunit';
|
import { moduleForComponent, test } from 'ember-qunit';
|
||||||
import Ember from 'ember';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
moduleForComponent('create-options-datetime', 'Unit | Component | create options datetime', {
|
moduleForComponent('create-options-datetime', 'Unit | Component | create options datetime', {
|
||||||
|
@ -18,7 +18,7 @@ moduleForComponent('create-options-datetime', 'Unit | Component | create options
|
||||||
test('delete a date', function(assert) {
|
test('delete a date', function(assert) {
|
||||||
let component = this.subject();
|
let component = this.subject();
|
||||||
let a, b, c, d, e;
|
let a, b, c, d, e;
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
a = this.store.createFragment('option', { title: moment('2015-01-01T01:01:00.000').toISOString() });
|
a = this.store.createFragment('option', { title: moment('2015-01-01T01:01:00.000').toISOString() });
|
||||||
b = this.store.createFragment('option', { title: moment('2015-01-01T11:11:00.000').toISOString() });
|
b = this.store.createFragment('option', { title: moment('2015-01-01T11:11:00.000').toISOString() });
|
||||||
c = this.store.createFragment('option', { title: moment('2015-02-02T11:11:00.000').toISOString() });
|
c = this.store.createFragment('option', { title: moment('2015-02-02T11:11:00.000').toISOString() });
|
||||||
|
@ -47,7 +47,7 @@ test('delete a date', function(assert) {
|
||||||
],
|
],
|
||||||
'date get deleted if there is another date with same day (date does not have a time)'
|
'date get deleted if there is another date with same day (date does not have a time)'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
component.send('deleteOption', c);
|
component.send('deleteOption', c);
|
||||||
});
|
});
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
|
@ -76,7 +76,7 @@ test('datetimes are grouped by date', function(assert) {
|
||||||
let a, b, c;
|
let a, b, c;
|
||||||
// have to set dates in local time and than convert to ISO 8601 strings
|
// have to set dates in local time and than convert to ISO 8601 strings
|
||||||
// because otherwise test could fail caused by timezone
|
// because otherwise test could fail caused by timezone
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
a = this.store.createFragment('option', { title: moment('2015-01-01T01:01:00').toISOString() });
|
a = this.store.createFragment('option', { title: moment('2015-01-01T01:01:00').toISOString() });
|
||||||
b = this.store.createFragment('option', { title: moment('2015-01-01T11:11:00').toISOString() });
|
b = this.store.createFragment('option', { title: moment('2015-01-01T11:11:00').toISOString() });
|
||||||
c = this.store.createFragment('option', { title: moment('2015-02-02T01:01:00').toISOString() });
|
c = this.store.createFragment('option', { title: moment('2015-02-02T01:01:00').toISOString() });
|
||||||
|
@ -103,7 +103,7 @@ test('datetimes are grouped by date', function(assert) {
|
||||||
|
|
||||||
test('bindings are working on grouped datetimes', function(assert) {
|
test('bindings are working on grouped datetimes', function(assert) {
|
||||||
let component = this.subject();
|
let component = this.subject();
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
component.set('dates', [
|
component.set('dates', [
|
||||||
this.store.createFragment('option', {
|
this.store.createFragment('option', {
|
||||||
title: moment('2015-01-01T11:11:00.000Z').toISOString()
|
title: moment('2015-01-01T11:11:00.000Z').toISOString()
|
||||||
|
@ -115,7 +115,7 @@ test('bindings are working on grouped datetimes', function(assert) {
|
||||||
moment('2015-01-01T11:11:00.000Z').format('HH:mm'),
|
moment('2015-01-01T11:11:00.000Z').format('HH:mm'),
|
||||||
'time is correct before'
|
'time is correct before'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
component.set(
|
component.set(
|
||||||
'groupedDates.firstObject.firstObject.time',
|
'groupedDates.firstObject.firstObject.time',
|
||||||
'00:00'
|
'00:00'
|
||||||
|
@ -126,7 +126,7 @@ test('bindings are working on grouped datetimes', function(assert) {
|
||||||
moment('2015-01-01T00:00').toISOString(),
|
moment('2015-01-01T00:00').toISOString(),
|
||||||
'option is updated after time changed on grouped datetimes'
|
'option is updated after time changed on grouped datetimes'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
component.get('dates').pushObject(
|
component.get('dates').pushObject(
|
||||||
this.store.createFragment('option', { title: moment('2015-01-01T12:12').toISOString() })
|
this.store.createFragment('option', { title: moment('2015-01-01T12:12').toISOString() })
|
||||||
);
|
);
|
||||||
|
@ -141,7 +141,7 @@ test('bindings are working on grouped datetimes', function(assert) {
|
||||||
'12:12',
|
'12:12',
|
||||||
'grouped datetimes got updated correctly after option was added (same day)'
|
'grouped datetimes got updated correctly after option was added (same day)'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
component.get('dates').pushObject(
|
component.get('dates').pushObject(
|
||||||
this.store.createFragment('option', { title: moment('2015-02-02T01:01').toISOString() })
|
this.store.createFragment('option', { title: moment('2015-02-02T01:01').toISOString() })
|
||||||
);
|
);
|
||||||
|
@ -161,7 +161,7 @@ test('bindings are working on grouped datetimes', function(assert) {
|
||||||
test('adopt times of first day - simple', function(assert) {
|
test('adopt times of first day - simple', function(assert) {
|
||||||
let component;
|
let component;
|
||||||
let poll;
|
let poll;
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
poll = this.store.createRecord('poll', {
|
poll = this.store.createRecord('poll', {
|
||||||
options: [
|
options: [
|
||||||
{ title: moment('2015-01-01T11:11:00.000').toISOString() },
|
{ title: moment('2015-01-01T11:11:00.000').toISOString() },
|
||||||
|
@ -192,7 +192,7 @@ test('adopt times of first day - simple', function(assert) {
|
||||||
test('adopt times of first day - having times on the other days', function(assert) {
|
test('adopt times of first day - having times on the other days', function(assert) {
|
||||||
let component;
|
let component;
|
||||||
let poll;
|
let poll;
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
poll = this.store.createRecord('poll', {
|
poll = this.store.createRecord('poll', {
|
||||||
options: [
|
options: [
|
||||||
{ title: moment('2015-01-01T11:11:00.000').toISOString() },
|
{ title: moment('2015-01-01T11:11:00.000').toISOString() },
|
||||||
|
@ -229,7 +229,7 @@ test('adopt times of first day - having times on the other days', function(asser
|
||||||
test('adopt times of first day - no times on first day', function(assert) {
|
test('adopt times of first day - no times on first day', function(assert) {
|
||||||
let component;
|
let component;
|
||||||
let poll;
|
let poll;
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
poll = this.store.createRecord('poll', {
|
poll = this.store.createRecord('poll', {
|
||||||
options: [
|
options: [
|
||||||
{ title: '2015-01-01' },
|
{ title: '2015-01-01' },
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { run } from '@ember/runloop';
|
||||||
import { moduleForComponent, test } from 'ember-qunit';
|
import { moduleForComponent, test } from 'ember-qunit';
|
||||||
import Ember from 'ember';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
// validator consumes i18n service
|
// validator consumes i18n service
|
||||||
// have to register it therefore
|
// have to register it therefore
|
||||||
|
@ -50,7 +50,7 @@ test('validation for make a poll', function(assert) {
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
let poll;
|
let poll;
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
poll = this.store.createRecord('poll', {
|
poll = this.store.createRecord('poll', {
|
||||||
isFindADate: component.get('isFindADate'),
|
isFindADate: component.get('isFindADate'),
|
||||||
isMakeAPoll: component.get('isMakeAPoll')
|
isMakeAPoll: component.get('isMakeAPoll')
|
||||||
|
@ -61,7 +61,7 @@ test('validation for make a poll', function(assert) {
|
||||||
component.get('validations.isValid'),
|
component.get('validations.isValid'),
|
||||||
'invalid without any options'
|
'invalid without any options'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
let option = this.store.createFragment('option', {
|
let option = this.store.createFragment('option', {
|
||||||
title: 'first option'
|
title: 'first option'
|
||||||
});
|
});
|
||||||
|
@ -72,7 +72,7 @@ test('validation for make a poll', function(assert) {
|
||||||
component.get('validations.isValid'),
|
component.get('validations.isValid'),
|
||||||
'valid if there is atleast one valid option'
|
'valid if there is atleast one valid option'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
let option = this.store.createFragment('option', {
|
let option = this.store.createFragment('option', {
|
||||||
title: 'second option'
|
title: 'second option'
|
||||||
});
|
});
|
||||||
|
@ -83,7 +83,7 @@ test('validation for make a poll', function(assert) {
|
||||||
component.get('validations.isValid'),
|
component.get('validations.isValid'),
|
||||||
'valid for two options which are not empty strings'
|
'valid for two options which are not empty strings'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
component.set('options.firstObject.title', '');
|
component.set('options.firstObject.title', '');
|
||||||
});
|
});
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
|
@ -103,7 +103,7 @@ test('validation for find a date without times', function(assert) {
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
let poll;
|
let poll;
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
poll = this.store.createRecord('poll', {
|
poll = this.store.createRecord('poll', {
|
||||||
isFindADate: component.get('isFindADate'),
|
isFindADate: component.get('isFindADate'),
|
||||||
isMakeAPoll: component.get('isMakeAPoll')
|
isMakeAPoll: component.get('isMakeAPoll')
|
||||||
|
@ -114,7 +114,7 @@ test('validation for find a date without times', function(assert) {
|
||||||
component.get('validations.isValid'),
|
component.get('validations.isValid'),
|
||||||
'invalid without any options'
|
'invalid without any options'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
let option = this.store.createFragment('option', {
|
let option = this.store.createFragment('option', {
|
||||||
title: '2015-01-01'
|
title: '2015-01-01'
|
||||||
});
|
});
|
||||||
|
@ -125,7 +125,7 @@ test('validation for find a date without times', function(assert) {
|
||||||
component.get('validations.isValid'),
|
component.get('validations.isValid'),
|
||||||
'valid if there is atleast one valid date'
|
'valid if there is atleast one valid date'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
let option = this.store.createFragment('option', {
|
let option = this.store.createFragment('option', {
|
||||||
title: '2015-01-02'
|
title: '2015-01-02'
|
||||||
});
|
});
|
||||||
|
@ -136,7 +136,7 @@ test('validation for find a date without times', function(assert) {
|
||||||
component.get('validations.isValid'),
|
component.get('validations.isValid'),
|
||||||
'valid for two valid dates'
|
'valid for two valid dates'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
let option = this.store.createFragment('option', {
|
let option = this.store.createFragment('option', {
|
||||||
title: 'foo'
|
title: 'foo'
|
||||||
});
|
});
|
||||||
|
@ -147,14 +147,14 @@ test('validation for find a date without times', function(assert) {
|
||||||
component.get('validations.isValid'),
|
component.get('validations.isValid'),
|
||||||
'invalid if atleast one option is not a valid date'
|
'invalid if atleast one option is not a valid date'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
component.set('options.lastObject.title', '2015-01-03');
|
component.set('options.lastObject.title', '2015-01-03');
|
||||||
});
|
});
|
||||||
assert.ok(
|
assert.ok(
|
||||||
component.get('validations.isValid'),
|
component.get('validations.isValid'),
|
||||||
'valid again after title is a valid date again'
|
'valid again after title is a valid date again'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
component.set('options.firstObject.title', '2015-01-01');
|
component.set('options.firstObject.title', '2015-01-01');
|
||||||
component.set('options.lastObject.title', '2015-01-01');
|
component.set('options.lastObject.title', '2015-01-01');
|
||||||
});
|
});
|
||||||
|
@ -174,7 +174,7 @@ test('validation for find a date with times', function(assert) {
|
||||||
// therefore each option needs to be pushed to poll model to have it as
|
// therefore each option needs to be pushed to poll model to have it as
|
||||||
// it's owner
|
// it's owner
|
||||||
let poll;
|
let poll;
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
poll = this.store.createRecord('poll', {
|
poll = this.store.createRecord('poll', {
|
||||||
isFindADate: component.get('isFindADate'),
|
isFindADate: component.get('isFindADate'),
|
||||||
isMakeAPoll: component.get('isMakeAPoll')
|
isMakeAPoll: component.get('isMakeAPoll')
|
||||||
|
@ -184,7 +184,7 @@ test('validation for find a date with times', function(assert) {
|
||||||
component.get('validations.isValid'),
|
component.get('validations.isValid'),
|
||||||
'invalid without any options'
|
'invalid without any options'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
let option = this.store.createFragment('option', {
|
let option = this.store.createFragment('option', {
|
||||||
title: moment().add('1', 'day').format('YYYY-MM-DD')
|
title: moment().add('1', 'day').format('YYYY-MM-DD')
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import EmberObject from '@ember/object';
|
||||||
import { moduleForComponent, test } from 'ember-qunit';
|
import { moduleForComponent, test } from 'ember-qunit';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import Ember from 'ember';
|
|
||||||
import tHelper from 'ember-i18n/helper';
|
import tHelper from 'ember-i18n/helper';
|
||||||
import localeConfig from 'ember-i18n/config/en';
|
import localeConfig from 'ember-i18n/config/en';
|
||||||
|
|
||||||
|
@ -25,50 +25,50 @@ moduleForComponent('poll-evaluation-chart', 'Unit | Component | poll evaluation
|
||||||
|
|
||||||
test('data is a valid ChartJS dataset for FindADate using poll timezone', function(assert) {
|
test('data is a valid ChartJS dataset for FindADate using poll timezone', function(assert) {
|
||||||
let options = [
|
let options = [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
title: '2015-01-01'
|
title: '2015-01-01'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
title: '2015-02-02'
|
title: '2015-02-02'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
title: '2015-03-03T01:00:00.000Z'
|
title: '2015-03-03T01:00:00.000Z'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
title: '2015-03-03T11:00:00.000Z'
|
title: '2015-03-03T11:00:00.000Z'
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
let users = [
|
let users = [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
id: 1,
|
id: 1,
|
||||||
selections: [
|
selections: [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'yes'
|
type: 'yes'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'yes'
|
type: 'yes'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'maybe'
|
type: 'maybe'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'no'
|
type: 'no'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
id: 2,
|
id: 2,
|
||||||
selections: [
|
selections: [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'yes'
|
type: 'yes'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'maybe'
|
type: 'maybe'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'no'
|
type: 'no'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'no'
|
type: 'no'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
@ -119,16 +119,16 @@ test('data is a valid ChartJS dataset for FindADate using poll timezone', functi
|
||||||
|
|
||||||
test('data is a valid ChartJS dataset for MakeAPoll', function(assert) {
|
test('data is a valid ChartJS dataset for MakeAPoll', function(assert) {
|
||||||
const options = [
|
const options = [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
title: 'first option'
|
title: 'first option'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
title: 'second option'
|
title: 'second option'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
title: 'third option'
|
title: 'third option'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
title: 'fourth option'
|
title: 'fourth option'
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
@ -136,36 +136,36 @@ test('data is a valid ChartJS dataset for MakeAPoll', function(assert) {
|
||||||
answerType: 'YesNoMaybe',
|
answerType: 'YesNoMaybe',
|
||||||
options,
|
options,
|
||||||
users: [
|
users: [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
id: 1,
|
id: 1,
|
||||||
selections: [
|
selections: [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'yes'
|
type: 'yes'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'yes'
|
type: 'yes'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'maybe'
|
type: 'maybe'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'no'
|
type: 'no'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
id: 2,
|
id: 2,
|
||||||
selections: [
|
selections: [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'yes'
|
type: 'yes'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'maybe'
|
type: 'maybe'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'no'
|
type: 'no'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'no'
|
type: 'no'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
@ -202,50 +202,50 @@ test('data is a valid ChartJS dataset for MakeAPoll', function(assert) {
|
||||||
|
|
||||||
test('data is a valid ChartJS dataset for FindADate using poll timezone', function(assert) {
|
test('data is a valid ChartJS dataset for FindADate using poll timezone', function(assert) {
|
||||||
let options = [
|
let options = [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
title: '2015-01-01'
|
title: '2015-01-01'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
title: '2015-02-02'
|
title: '2015-02-02'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
title: '2015-03-03T01:00:00.000Z'
|
title: '2015-03-03T01:00:00.000Z'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
title: '2015-03-03T11:00:00.000Z'
|
title: '2015-03-03T11:00:00.000Z'
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
let users = [
|
let users = [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
id: 1,
|
id: 1,
|
||||||
selections: [
|
selections: [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'yes'
|
type: 'yes'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'yes'
|
type: 'yes'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'maybe'
|
type: 'maybe'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'no'
|
type: 'no'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
id: 2,
|
id: 2,
|
||||||
selections: [
|
selections: [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'yes'
|
type: 'yes'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'maybe'
|
type: 'maybe'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'no'
|
type: 'no'
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
type: 'no'
|
type: 'no'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
@ -296,7 +296,7 @@ test('data is a valid ChartJS dataset for FindADate using poll timezone', functi
|
||||||
|
|
||||||
test('data is a valid ChartJS dataset for FindADate using locale timezone', function(assert) {
|
test('data is a valid ChartJS dataset for FindADate using locale timezone', function(assert) {
|
||||||
let options = [
|
let options = [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
title: '2015-03-03T01:00:00.000Z'
|
title: '2015-03-03T01:00:00.000Z'
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
|
import { run } from '@ember/runloop';
|
||||||
|
import EmberObject from '@ember/object';
|
||||||
import { moduleFor, test } from 'ember-qunit';
|
import { moduleFor, test } from 'ember-qunit';
|
||||||
import Ember from 'ember';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
moduleFor('controller:create/options-datetime', 'Unit | Controller | create/options datetime', {
|
moduleFor('controller:create/options-datetime', 'Unit | Controller | create/options datetime', {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('normalize options - remove days without time if there is another option with a time for that day', function(assert) {
|
test('normalize options - remove days without time if there is another option with a time for that day', function(assert) {
|
||||||
const dirtyOption = Ember.Object.create({ title: '2015-01-01' });
|
const dirtyOption = EmberObject.create({ title: '2015-01-01' });
|
||||||
let controller = this.subject({
|
let controller = this.subject({
|
||||||
model: {
|
model: {
|
||||||
options: [
|
options: [
|
||||||
Ember.Object.create({ title: '2015-01-01T12:00:00.000Z' }),
|
EmberObject.create({ title: '2015-01-01T12:00:00.000Z' }),
|
||||||
dirtyOption,
|
dirtyOption,
|
||||||
Ember.Object.create({ title: '2017-11-11' }),
|
EmberObject.create({ title: '2017-11-11' }),
|
||||||
Ember.Object.create({ title: '2018-04-04T11:11:00.000Z' })
|
EmberObject.create({ title: '2018-04-04T11:11:00.000Z' })
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
controller.normalizeOptions();
|
controller.normalizeOptions();
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -39,14 +40,14 @@ test('normalize options - sort them', function(assert) {
|
||||||
let controller = this.subject({
|
let controller = this.subject({
|
||||||
model: {
|
model: {
|
||||||
options: [
|
options: [
|
||||||
Ember.Object.create({ title: dateB }),
|
EmberObject.create({ title: dateB }),
|
||||||
Ember.Object.create({ title: dateA }),
|
EmberObject.create({ title: dateA }),
|
||||||
Ember.Object.create({ title: dateC }),
|
EmberObject.create({ title: dateC }),
|
||||||
Ember.Object.create({ title: dateD })
|
EmberObject.create({ title: dateD })
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
controller.normalizeOptions();
|
controller.normalizeOptions();
|
||||||
});
|
});
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import Ember from 'ember';
|
import EmberObject from '@ember/object';
|
||||||
import AutofocusSupportMixin from 'croodle/mixins/autofocus-support';
|
import AutofocusSupportMixin from 'croodle/mixins/autofocus-support';
|
||||||
import { module, test } from 'qunit';
|
import { module, test } from 'qunit';
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ module('Unit | Mixin | autofocus support');
|
||||||
|
|
||||||
// Replace this with your real tests.
|
// Replace this with your real tests.
|
||||||
test('it works', function(assert) {
|
test('it works', function(assert) {
|
||||||
let AutofocusSupportObject = Ember.Object.extend(AutofocusSupportMixin);
|
let AutofocusSupportObject = EmberObject.extend(AutofocusSupportMixin);
|
||||||
let subject = AutofocusSupportObject.create();
|
let subject = AutofocusSupportObject.create();
|
||||||
assert.ok(subject);
|
assert.ok(subject);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
import { run } from '@ember/runloop';
|
||||||
|
import Service from '@ember/service';
|
||||||
import { moduleForModel, test } from 'ember-qunit';
|
import { moduleForModel, test } from 'ember-qunit';
|
||||||
import Ember from 'ember';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
const i18nStub = Ember.Service.extend({
|
const i18nStub = Service.extend({
|
||||||
exists() {
|
exists() {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
@ -42,7 +43,7 @@ test('date property (get)', function(assert) {
|
||||||
'string to date conversion is correct for ISO 8601 day string'
|
'string to date conversion is correct for ISO 8601 day string'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', '2015-01-01T11:11:00.000Z');
|
option.set('title', '2015-01-01T11:11:00.000Z');
|
||||||
});
|
});
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -55,7 +56,7 @@ test('date property (get)', function(assert) {
|
||||||
'string to date conversion is correct for ISO 8601 datetime string'
|
'string to date conversion is correct for ISO 8601 datetime string'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', null);
|
option.set('title', null);
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -64,7 +65,7 @@ test('date property (get)', function(assert) {
|
||||||
'returns undefined if title is empty'
|
'returns undefined if title is empty'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', 'abc');
|
option.set('title', 'abc');
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -73,7 +74,7 @@ test('date property (get)', function(assert) {
|
||||||
'returns undefined if title is not a valid ISO 8601 date string'
|
'returns undefined if title is not a valid ISO 8601 date string'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', '2015');
|
option.set('title', '2015');
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -82,7 +83,7 @@ test('date property (get)', function(assert) {
|
||||||
'returns undefined if title ISO 8601 string only contains a year'
|
'returns undefined if title ISO 8601 string only contains a year'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', '2015-01');
|
option.set('title', '2015-01');
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -91,7 +92,7 @@ test('date property (get)', function(assert) {
|
||||||
'returns undefined if title ISO 8601 string only contains a year and a month'
|
'returns undefined if title ISO 8601 string only contains a year and a month'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', '2013W06');
|
option.set('title', '2013W06');
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -111,7 +112,7 @@ test('day property (get)', function(assert) {
|
||||||
'returns ISO 8601 day string if title is ISO 8601 day string'
|
'returns ISO 8601 day string if title is ISO 8601 day string'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', '2015-01-01T11:11:00.000Z');
|
option.set('title', '2015-01-01T11:11:00.000Z');
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -120,7 +121,7 @@ test('day property (get)', function(assert) {
|
||||||
'returns ISO 8601 day string if title is ISO 8601 datetime string'
|
'returns ISO 8601 day string if title is ISO 8601 datetime string'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', 'abc');
|
option.set('title', 'abc');
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -129,7 +130,7 @@ test('day property (get)', function(assert) {
|
||||||
'returns undefined if title is not a valid ISO 8601 string'
|
'returns undefined if title is not a valid ISO 8601 string'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', null);
|
option.set('title', null);
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -149,7 +150,7 @@ test('dayFormatted property (get)', function(assert) {
|
||||||
'returns formatted date if title is ISO 8601 day string'
|
'returns formatted date if title is ISO 8601 day string'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', moment('2015-01-01').toISOString());
|
option.set('title', moment('2015-01-01').toISOString());
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -158,7 +159,7 @@ test('dayFormatted property (get)', function(assert) {
|
||||||
'returns formatted date if title is ISO 8601 datetime string'
|
'returns formatted date if title is ISO 8601 datetime string'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('i18n.locale', 'de');
|
option.set('i18n.locale', 'de');
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -167,7 +168,7 @@ test('dayFormatted property (get)', function(assert) {
|
||||||
'observes locale changes'
|
'observes locale changes'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', 'abc');
|
option.set('title', 'abc');
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -182,11 +183,11 @@ test('hasTime property', function(assert) {
|
||||||
title: '2015-01-01T11:11:00.000Z'
|
title: '2015-01-01T11:11:00.000Z'
|
||||||
});
|
});
|
||||||
assert.ok(option.get('hasTime'));
|
assert.ok(option.get('hasTime'));
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', '2015-01-01');
|
option.set('title', '2015-01-01');
|
||||||
});
|
});
|
||||||
assert.notOk(option.get('hasTime'));
|
assert.notOk(option.get('hasTime'));
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', 'foo');
|
option.set('title', 'foo');
|
||||||
});
|
});
|
||||||
assert.notOk(option.get('hasTime'));
|
assert.notOk(option.get('hasTime'));
|
||||||
|
@ -202,7 +203,7 @@ test('time property (get)', function(assert) {
|
||||||
'returns time if title is ISO 8601 datetime string'
|
'returns time if title is ISO 8601 datetime string'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', '2015-01-01');
|
option.set('title', '2015-01-01');
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -211,7 +212,7 @@ test('time property (get)', function(assert) {
|
||||||
'returns undefined if title is ISO 8601 day string'
|
'returns undefined if title is ISO 8601 day string'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', 'abc');
|
option.set('title', 'abc');
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -226,7 +227,7 @@ test('time property (set)', function(assert) {
|
||||||
title: '2015-01-01'
|
title: '2015-01-01'
|
||||||
});
|
});
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('time', '11:00');
|
option.set('time', '11:00');
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -235,7 +236,7 @@ test('time property (set)', function(assert) {
|
||||||
'sets title according to time'
|
'sets title according to time'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('time', null);
|
option.set('time', null);
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -245,7 +246,7 @@ test('time property (set)', function(assert) {
|
||||||
);
|
);
|
||||||
|
|
||||||
const before = option.get('title');
|
const before = option.get('title');
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('time', 'abc');
|
option.set('time', 'abc');
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -254,7 +255,7 @@ test('time property (set)', function(assert) {
|
||||||
'does not set title if time is invalid'
|
'does not set title if time is invalid'
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', 'abc');
|
option.set('title', 'abc');
|
||||||
});
|
});
|
||||||
assert.throws(
|
assert.throws(
|
||||||
|
@ -266,7 +267,7 @@ test('time property (set)', function(assert) {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('validation for MakeAPoll', function(assert) {
|
test('validation for MakeAPoll', function(assert) {
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
let store = this.store();
|
let store = this.store();
|
||||||
let poll = store.createRecord('poll', {
|
let poll = store.createRecord('poll', {
|
||||||
pollType: 'MakeAPoll'
|
pollType: 'MakeAPoll'
|
||||||
|
@ -278,14 +279,14 @@ test('validation for MakeAPoll', function(assert) {
|
||||||
option.get('validations.isValid'),
|
option.get('validations.isValid'),
|
||||||
'default value is not valid'
|
'default value is not valid'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', 'Spasibo!');
|
option.set('title', 'Spasibo!');
|
||||||
});
|
});
|
||||||
assert.ok(
|
assert.ok(
|
||||||
option.get('validations.isValid'),
|
option.get('validations.isValid'),
|
||||||
'is valid for a non empty string'
|
'is valid for a non empty string'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', '!');
|
option.set('title', '!');
|
||||||
});
|
});
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -296,7 +297,7 @@ test('validation for MakeAPoll', function(assert) {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('validation for FindADate', function(assert) {
|
test('validation for FindADate', function(assert) {
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
let store = this.store();
|
let store = this.store();
|
||||||
let poll = store.createRecord('poll', {
|
let poll = store.createRecord('poll', {
|
||||||
isDateTime: false,
|
isDateTime: false,
|
||||||
|
@ -309,14 +310,14 @@ test('validation for FindADate', function(assert) {
|
||||||
option.get('validations.isValid'),
|
option.get('validations.isValid'),
|
||||||
'default value is not valid'
|
'default value is not valid'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', '1945-05-08');
|
option.set('title', '1945-05-08');
|
||||||
});
|
});
|
||||||
assert.ok(
|
assert.ok(
|
||||||
option.get('validations.isValid'),
|
option.get('validations.isValid'),
|
||||||
'iso 8601 date string is valid'
|
'iso 8601 date string is valid'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', 'Spasibo!');
|
option.set('title', 'Spasibo!');
|
||||||
});
|
});
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
|
@ -327,7 +328,7 @@ test('validation for FindADate', function(assert) {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('validation for FindADate', function(assert) {
|
test('validation for FindADate', function(assert) {
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
let store = this.store();
|
let store = this.store();
|
||||||
let poll = store.createRecord('poll', {
|
let poll = store.createRecord('poll', {
|
||||||
pollType: 'FindADate'
|
pollType: 'FindADate'
|
||||||
|
@ -339,21 +340,21 @@ test('validation for FindADate', function(assert) {
|
||||||
option.get('validations.isValid'),
|
option.get('validations.isValid'),
|
||||||
'default value is not valid'
|
'default value is not valid'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', '1945-05-08T00:00:00.000Z');
|
option.set('title', '1945-05-08T00:00:00.000Z');
|
||||||
});
|
});
|
||||||
assert.ok(
|
assert.ok(
|
||||||
option.get('validations.isValid'),
|
option.get('validations.isValid'),
|
||||||
'iso 8601 datetime string is valid'
|
'iso 8601 datetime string is valid'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', 'Spasibo!');
|
option.set('title', 'Spasibo!');
|
||||||
});
|
});
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
option.get('validations.isValid'),
|
option.get('validations.isValid'),
|
||||||
'random string is not valid'
|
'random string is not valid'
|
||||||
);
|
);
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
option.set('title', '1945-05-08');
|
option.set('title', '1945-05-08');
|
||||||
});
|
});
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
import { A } from '@ember/array';
|
||||||
|
import EmberObject from '@ember/object';
|
||||||
import { moduleFor, test } from 'ember-qunit';
|
import { moduleFor, test } from 'ember-qunit';
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
moduleFor('validator:unique', 'Unit | Validator | unique', {
|
moduleFor('validator:unique', 'Unit | Validator | unique', {
|
||||||
needs: ['validator:messages']
|
needs: ['validator:messages']
|
||||||
|
@ -38,10 +39,10 @@ test('throws if required option is missing', function(assert) {
|
||||||
|
|
||||||
test('validation', function(assert) {
|
test('validation', function(assert) {
|
||||||
const validator = this.subject();
|
const validator = this.subject();
|
||||||
const parent = Ember.Object.create({
|
const parent = EmberObject.create({
|
||||||
collection: Ember.A([])
|
collection: A([])
|
||||||
});
|
});
|
||||||
const childObject = Ember.Object.extend({
|
const childObject = EmberObject.extend({
|
||||||
parent
|
parent
|
||||||
});
|
});
|
||||||
const options = {
|
const options = {
|
||||||
|
|
Loading…
Reference in a new issue