deps: upgrade ember to 2.18

This commit is contained in:
Jeldrik Hanschke 2018-12-29 01:27:37 +01:00 committed by jelhan
parent 0749668435
commit 11265cb82d
87 changed files with 1697 additions and 1373 deletions

View file

@ -7,11 +7,54 @@ module.exports = {
ecmaVersion: 2017,
sourceType: 'module'
},
extends: 'eslint:recommended',
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
],
env: {
browser: true,
es6: true
},
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,
}
}
]
};

View file

@ -1,7 +0,0 @@
{
"preset": "ember-suave",
"disallowConstOutsideModuleScope": false,
"disallowDirectPropertyAccess": false,
"disallowEmberView": false,
"requireSpread": false
}

View file

@ -45,6 +45,7 @@ before_script:
script:
# run frontend and integration tests
- if $TEST_EMBER; then yarn run lint:js; fi
- if $TEST_EMBER; then yarn test; fi
# 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

252
MODULE_REPORT.md Normal file
View 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 });
```

View file

@ -1,11 +1,10 @@
import { inject as service } from '@ember/service';
import DS from 'ember-data';
import Ember from 'ember';
const { RESTAdapter } = DS;
const { inject } = Ember;
export default RESTAdapter.extend({
encryption: inject.service(),
encryption: service(),
// set namespace to api.php in same subdirectory
namespace:

View file

@ -1,13 +1,9 @@
import Ember from 'ember';
import Application from '@ember/application';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';
const { Application } = Ember;
let App;
App = Application.extend({
const App = Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver

View file

@ -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';
const { computed, Component, inject, isArray, isEmpty } = Ember;
export default Component.extend({
i18n: inject.service(),
i18n: service(),
/*
* 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')
});

View file

@ -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 {
validator, buildValidations
}
@ -6,9 +11,6 @@ from 'ember-cp-validations';
import { groupBy } from 'ember-array-computed-macros';
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({
dates: [
validator('collection', true),
@ -191,5 +193,5 @@ export default Component.extend(modelValidations, {
}, {});
}),
store: inject.service()
store: service()
});

View file

@ -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 { anyBy } from 'ember-array-computed-macros';
const { Component, computed, inject, observer, run } = Ember;
export default Component.extend({
actions: {
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;
}),
@ -80,5 +82,5 @@ export default Component.extend({
}
}).on('init'),
store: inject.service('store')
store: service('store')
});

View file

@ -1,11 +1,10 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import {
validator, buildValidations
}
from 'ember-cp-validations';
const { Component, inject } = Ember;
let Validations = buildValidations({
options: [
validator('collection', true),
@ -36,6 +35,6 @@ export default Component.extend(Validations, {
}
},
// consumed by validator
i18n: inject.service(),
i18n: service(),
shouldShowErrors: false
});

View file

@ -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';
const { Component, computed, get, inject } = Ember;
export default Component.extend({
actions: {
prev() {
@ -30,7 +30,7 @@ export default Component.extend({
*/
disablePrevButton: false,
i18n: inject.service(),
i18n: service(),
/**
* @property nextButtonClasses

View file

@ -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';
const { Component, computed, inject } = Ember;
export default Component.extend({
tagName: 'select',
classNames: [ 'language-select' ],
i18n: inject.service(),
moment: inject.service(),
current: computed.readOnly('i18n.locale'),
i18n: service(),
moment: service(),
current: readOnly('i18n.locale'),
locales: computed('i18n.locales', function() {
let currentLocale = this.get('i18n.locale');

View file

@ -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';
const { Component, computed, get, inject, isArray, isPresent } = Ember;
const addArrays = function() {
let args = Array.prototype.slice.call(arguments);
let basis = args.shift();
@ -22,9 +24,9 @@ const addArrays = function() {
};
export default Component.extend({
i18n: inject.service(),
i18n: service(),
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 value = get(option, 'title');
if (!get(this, 'isFindADate')) {
@ -77,36 +79,38 @@ export default Component.extend({
labels
};
}),
chartOptions: {
legend: {
display: false
},
scales: {
xAxes: [{
stacked: true
}],
yAxes: [{
stacked: true,
ticks: {
callback(value) {
return `${value} %`;
},
max: 100,
min: 0
}
}]
},
tooltips: {
mode: 'label',
callbacks: {
label(tooltipItem, data) {
let { datasets } = data;
let { datasetIndex } = tooltipItem;
let { label } = datasets[datasetIndex];
let value = tooltipItem.yLabel;
return `${label}: ${value} %`;
chartOptions: computed(function () {
return {
legend: {
display: false
},
scales: {
xAxes: [{
stacked: true
}],
yAxes: [{
stacked: true,
ticks: {
callback(value) {
return `${value} %`;
},
max: 100,
min: 0
}
}]
},
tooltips: {
mode: 'label',
callbacks: {
label(tooltipItem, data) {
let { datasets } = data;
let { datasetIndex } = tooltipItem;
let { label } = datasets[datasetIndex];
let value = tooltipItem.yLabel;
return `${label}: ${value} %`;
}
}
}
}
}
}),
});

View file

@ -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 { groupBy } from 'ember-awesome-macros/array';
const {
Component
} = Ember;
export default Component.extend({
didInsertElement() {
this._super();
Ember.run.scheduleOnce('afterRender', this, function() {
scheduleOnce('afterRender', this, function() {
/*
* adding floatThead jQuery plugin to poll table
* 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
* used browser
*/
Ember.$('.user-selections-table').floatThead({
$('.user-selections-table').floatThead({
position: 'absolute',
top: this.getScrollbarHeight
});
@ -29,68 +28,68 @@ export default Component.extend({
/*
* fix width calculation error caused by bootstrap glyphicon on webkit
*/
Ember.$('.glyphicon').css('width', '14px');
$('.glyphicon').css('width', '14px');
/*
* scrollbar on top of table
*/
const topScrollbarInner = Ember.$('<div></div>')
.css('width', Ember.$('.user-selections-table').width())
const topScrollbarInner = $('<div></div>')
.css('width', $('.user-selections-table').width())
.css('height', '1px');
const topScrollbarOuter = Ember.$('<div></div>')
const topScrollbarOuter = $('<div></div>')
.addClass('top-scrollbar')
.css('width', '100%')
.css('overflow-x', 'scroll')
.css('overflow-y', 'hidden')
.css('position', 'relative')
.css('z-index', '1002');
Ember.$('.table-scroll').before(
$('.table-scroll').before(
topScrollbarOuter.append(topScrollbarInner)
);
/*
* scrollbar on top of table for thead
*/
const topScrollbarInnerThead = Ember.$('<div></div>')
.css('width', Ember.$('.user-selections-table').width())
const topScrollbarInnerThead = $('<div></div>')
.css('width', $('.user-selections-table').width())
.css('height', '1px');
const topScrollbarOuterThead = Ember.$('<div></div>')
const topScrollbarOuterThead = $('<div></div>')
.addClass('top-scrollbar-floatThead')
.css('width', Ember.$('.table-scroll').outerWidth())
.css('width', $('.table-scroll').outerWidth())
.css('overflow-x', 'scroll')
.css('overflow-y', 'hidden')
.css('position', 'fixed')
.css('top', '-1px')
.css('z-index', '1002')
.css('margin-left', `${(Ember.$('.table-scroll').outerWidth() - Ember.$('.table-scroll').width()) / 2 * (-1)}px`)
.css('margin-right', `${(Ember.$('.table-scroll').outerWidth() - Ember.$('.table-scroll').width()) / 2 * (-1)}px`);
Ember.$('.table-scroll').prepend(
.css('margin-left', `${($('.table-scroll').outerWidth() - $('.table-scroll').width()) / 2 * (-1)}px`)
.css('margin-right', `${($('.table-scroll').outerWidth() - $('.table-scroll').width()) / 2 * (-1)}px`);
$('.table-scroll').prepend(
topScrollbarOuterThead.append(topScrollbarInnerThead).hide()
);
// add listener to resize scrollbars if window get resized
Ember.$(window).resize(this.resizeScrollbars);
$(window).resize(this.resizeScrollbars);
/*
* bind scroll event on all scrollbars
*/
Ember.$('.table-scroll').scroll(function() {
Ember.$('.top-scrollbar').scrollLeft(Ember.$('.table-scroll').scrollLeft());
Ember.$('.top-scrollbar-floatThead').scrollLeft(Ember.$('.table-scroll').scrollLeft());
$('.table-scroll').scroll(function() {
$('.top-scrollbar').scrollLeft($('.table-scroll').scrollLeft());
$('.top-scrollbar-floatThead').scrollLeft($('.table-scroll').scrollLeft());
});
Ember.$('.top-scrollbar').scroll(function() {
Ember.$('.table-scroll').scrollLeft(Ember.$('.top-scrollbar').scrollLeft());
Ember.$('.top-scrollbar-floatThead').scrollLeft(Ember.$('.top-scrollbar').scrollLeft());
$('.top-scrollbar').scroll(function() {
$('.table-scroll').scrollLeft($('.top-scrollbar').scrollLeft());
$('.top-scrollbar-floatThead').scrollLeft($('.top-scrollbar').scrollLeft());
});
Ember.$('.top-scrollbar-floatThead').scroll(function() {
Ember.$('.table-scroll').scrollLeft(Ember.$('.top-scrollbar-floatThead').scrollLeft());
Ember.$('.top-scrollbar').scrollLeft(Ember.$('.top-scrollbar-floatThead').scrollLeft());
$('.top-scrollbar-floatThead').scroll(function() {
$('.table-scroll').scrollLeft($('.top-scrollbar-floatThead').scrollLeft());
$('.top-scrollbar').scrollLeft($('.top-scrollbar-floatThead').scrollLeft());
});
/*
* 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
*/
getScrollbarHeight() {
const wideScrollWtml = Ember.$('<div>').attr('id', 'wide_scroll_div_one').css({
const wideScrollWtml = $('<div>').attr('id', 'wide_scroll_div_one').css({
'width': 50,
'height': 50,
'overflow-y': 'scroll',
@ -106,16 +105,16 @@ export default Component.extend({
'top': -200,
'left': -200
}).append(
Ember.$('<div>').attr('id', 'wide_scroll_div_two').css({
$('<div>').attr('id', 'wide_scroll_div_two').css({
'height': '100%',
'width': 100
})
);
Ember.$('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 scrollW2 = Ember.$('#wide_scroll_div_two').innerHeight(); // Find the inner width of the inner(child) div.
$('body').append(wideScrollWtml); // Append our div and add the hmtl to your document for calculations
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 = $('#wide_scroll_div_two').innerHeight(); // Find the inner width of the inner(child) div.
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;
},
@ -131,17 +130,17 @@ export default Component.extend({
* used as event callback when window is resized
*/
resizeScrollbars() {
Ember.$('.top-scrollbar div').css('width', Ember.$('.user-selections-table').width());
Ember.$('.top-scrollbar-floatThead').css('width', Ember.$('.table-scroll').outerWidth());
Ember.$('.top-scrollbar-floatThead div').css('width', Ember.$('.user-selections-table').width());
$('.top-scrollbar div').css('width', $('.user-selections-table').width());
$('.top-scrollbar-floatThead').css('width', $('.table-scroll').outerWidth());
$('.top-scrollbar-floatThead div').css('width', $('.user-selections-table').width());
},
/*
* resize scrollbars if document height might be changed
* and therefore scrollbars might be added
*/
triggerResizeScrollbars: Ember.observer('controller.isEvaluable', 'controller.model.users.[]', function() {
Ember.run.next(() => {
triggerResizeScrollbars: observer('controller.isEvaluable', 'controller.model.users.[]', function() {
next(() => {
this.resizeScrollbars();
});
}),
@ -151,15 +150,15 @@ export default Component.extend({
* used as event callback when window is scrolled
*/
updateScrollbarTopVisibility() {
const windowTop = Ember.$(window).scrollTop();
const tableTop = Ember.$('.table-scroll table').offset().top;
const windowTop = $(window).scrollTop();
const tableTop = $('.table-scroll table').offset().top;
if (windowTop >= tableTop - this.getScrollbarHeight()) {
Ember.$('.top-scrollbar-floatThead').show();
$('.top-scrollbar-floatThead').show();
// update scroll position
Ember.$('.top-scrollbar-floatThead').scrollLeft(Ember.$('.table-scroll').scrollLeft());
$('.top-scrollbar-floatThead').scrollLeft($('.table-scroll').scrollLeft());
} else {
Ember.$('.top-scrollbar-floatThead').hide();
$('.top-scrollbar-floatThead').hide();
}
},
@ -168,7 +167,7 @@ export default Component.extend({
* especially remove event listeners
*/
willDestroyElement() {
Ember.$(window).off('resize', this.resizeScrollbars);
Ember.$(window).off('scroll', this.updateScrollbarTopVisibility);
$(window).off('resize', this.resizeScrollbars);
$(window).off('scroll', this.updateScrollbarTopVisibility);
}
});

View file

@ -1,6 +1,7 @@
import Ember from 'ember';
const { Component, computed, copy, isEmpty } = Ember;
import Component from '@ember/component';
import { computed } from '@ember/object';
import { copy } from '@ember/object/internals';
import { isEmpty } from '@ember/utils';
export default Component.extend({
classNames: ['evaluation-summary'],

View file

@ -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 = Ember.Object.extend({
const formStepObject = EmberObject.extend({
active: computed('routing.currentRouteName', function() {
const currentRouteName = this.get('routing.currentRouteName');
const active = currentRouteName === this.get('route');
if (active) {
this.set('disabled', false);
}
return active;
return currentRouteName === this.get('route');
}),
disabled: true,
hidden: false,
label: 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({
@ -41,7 +42,7 @@ export default Controller.extend({
return 'create.formStep.options.text';
}
}),
pollType: computed.readOnly('model.pollType')
pollType: readOnly('model.pollType')
}).create(owner.ownerInjection(), {
model: this.get('model'),
route: 'create.options'
@ -51,7 +52,7 @@ export default Controller.extend({
const pollType = this.get('pollType');
return pollType !== 'FindADate';
}),
pollType: computed.readOnly('model.pollType')
pollType: readOnly('model.pollType')
}).create(owner.ownerInjection(), {
label: 'create.formStep.options-datetime',
model: this.get('model'),

View file

@ -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 {
validator, buildValidations
}
from 'ember-cp-validations';
const { computed, Controller, getOwner, Object: EmberObject, inject } = Ember;
const Validations = buildValidations({
pollType: [
validator('presence', {
@ -20,7 +22,7 @@ const Validations = buildValidations({
});
const TranslateableObject = EmberObject.extend({
i18n: inject.service(),
i18n: service(),
label: computed('labelTranslation', 'i18n.locale', function() {
return this.get('i18n').t(this.get('labelTranslation'));
}),
@ -36,13 +38,15 @@ export default Controller.extend(Validations, {
}
},
i18n: inject.service(),
i18n: service(),
init() {
this._super(...arguments);
this.get('i18n.locale');
},
pollType: computed.alias('model.pollType'),
pollType: alias('model.pollType'),
pollTypes: computed('', function() {
const owner = getOwner(this);

View file

@ -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 {
validator, buildValidations
}
from 'ember-cp-validations';
const { computed, Controller, inject } = Ember;
const Validations = buildValidations({
title: [
validator('presence', {
@ -28,13 +28,15 @@ export default Controller.extend(Validations, {
}
},
description: computed.alias('model.description'),
description: alias('model.description'),
init() {
this._super(...arguments);
this.get('i18n.locale');
},
i18n: inject.service(),
i18n: service(),
title: computed.alias('model.title')
title: alias('model.title')
});

View file

@ -1,8 +1,7 @@
import Ember from 'ember';
import { alias } from '@ember/object/computed';
import Controller from '@ember/controller';
import moment from 'moment';
const { computed, Controller } = Ember;
export default Controller.extend({
actions: {
nextPage() {
@ -35,5 +34,5 @@ export default Controller.extend({
// ToDo: Find a better way without reseting the options
this.set('options', options.sortBy('title'));
},
options: computed.alias('model.options')
options: alias('model.options')
});

View file

@ -1,6 +1,5 @@
import Ember from 'ember';
const { computed, Controller } = Ember;
import { alias } from '@ember/object/computed';
import Controller from '@ember/controller';
export default Controller.extend({
actions: {
@ -13,5 +12,5 @@ export default Controller.extend({
}
},
isFindADate: computed.alias('model.isFindADate')
isFindADate: alias('model.isFindADate')
});

View file

@ -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 {
validator, buildValidations
}
from 'ember-cp-validations';
import moment from 'moment';
const {
computed,
Controller,
copy,
getOwner,
inject,
isEmpty,
Object: EmberObject,
observer
} = Ember;
const Validations = buildValidations({
anonymousUser: validator('presence', {
presence: true,
@ -35,7 +30,7 @@ const Validations = buildValidations({
});
const TranslateableObject = EmberObject.extend({
i18n: inject.service(),
i18n: service(),
label: computed('labelTranslation', 'i18n.locale', function() {
return this.get('i18n').t(this.get('labelTranslation'));
}),
@ -74,8 +69,8 @@ export default Controller.extend(Validations, {
}
},
anonymousUser: computed.alias('model.anonymousUser'),
answerType: computed.alias('model.answerType'),
anonymousUser: alias('model.anonymousUser'),
answerType: alias('model.answerType'),
answerTypes: computed('', function() {
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() {
this._super(...arguments);
this.get('i18n.locale');
},

View file

@ -1,6 +1,5 @@
import Ember from 'ember';
const { computed, Controller } = Ember;
import { computed } from '@ember/object';
import Controller from '@ember/controller';
export default Controller.extend({
isDecryptionError: computed('model.type', function() {

View file

@ -1,6 +1,9 @@
import $ from 'jquery';
import Ember from 'ember';
const { $, ObjectController } = Ember;
const {
ObjectController
} = Ember;
export default ObjectController.extend({
actions: {

View file

@ -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';
const {
computed,
Controller,
inject,
isEmpty,
isPresent,
observer
} = Ember;
export default Controller.extend({
actions: {
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: '',
queryParams: ['encryptionKey'],
flashMessages: inject.service(),
flashMessages: service(),
hasTimes: computed('model.options.[]', function() {
if (this.get('model.isMakeAPoll')) {
@ -49,7 +44,7 @@ export default Controller.extend({
}
}),
i18n: inject.service(),
i18n: service(),
momentLongDayFormat: computed('currentLocale', function() {
let currentLocale = this.get('currentLocale');

View file

@ -1,22 +1,24 @@
import Ember from 'ember';
const { $, computed, Controller, inject } = Ember;
import { inject as service } from '@ember/service';
import { reads, readOnly, sort } from '@ember/object/computed';
import $ from 'jquery';
import { computed } from '@ember/object';
import Controller, { inject as controller } from '@ember/controller';
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'),
usersSorting: ['creationDate'],
sortedUsers: sort('pollController.model.users', 'usersSorting'),
usersSorting: computed(() => ['creationDate']),
timezone: computed.reads('pollController.timezone'),
timezone: reads('pollController.timezone'),
/*
* evaluates poll data
@ -93,7 +95,7 @@ export default Controller.extend({
return this.get('model.options.length') + 2;
}),
isEvaluable: computed('model.users.[]', 'model.isFreeText', function() {
isEvaluable: computed('model.{users.[],isFreeText}', function() {
if (
!this.get('model.isFreeText') &&
this.get('model.users.length') > 0

View file

@ -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 {
validator, buildValidations
}
from 'ember-cp-validations';
import moment from 'moment';
const {
computed,
Controller,
getOwner,
inject,
isEmpty,
isPresent,
Object: EmberObject
} = Ember;
const validCollection = function(collection) {
// return false if any object in collection is inValid
return !collection.any((object) => {
@ -25,14 +20,14 @@ const Validations = buildValidations({
name: [
validator('presence', {
presence: true,
disabled: computed.readOnly('model.anonymousUser'),
disabled: readOnly('model.anonymousUser'),
dependentKeys: ['model.i18n.locale']
}),
validator('unique', {
parent: 'pollController.model',
attributeInParent: 'users',
dependentKeys: ['model.poll.users.[]', 'model.poll.users.@each.name', 'model.i18n.locale'],
disable: computed.readOnly('model.anonymousUser'),
disable: readOnly('model.anonymousUser'),
messageKey: 'unique.name'
})
],
@ -51,7 +46,7 @@ const Validations = buildValidations({
const SelectionValidations = buildValidations({
value: validator('presence', {
presence: true,
disabled: computed.not('model.forceAnswer'),
disabled: not('model.forceAnswer'),
messageKey: computed('model.isFreeText', function() {
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'),
currentLocale: computed.readOnly('i18n.locale'),
encryption: inject.service(),
forceAnswer: computed.readOnly('pollController.model.forceAnswer'),
i18n: inject.service(),
anonymousUser: readOnly('pollController.model.anonymousUser'),
currentLocale: readOnly('i18n.locale'),
encryption: service(),
forceAnswer: readOnly('pollController.model.forceAnswer'),
i18n: service(),
init() {
this._super(...arguments);
this.get('i18n.locale');
},
isFreeText: computed.readOnly('pollController.model.isFreeText'),
isFindADate: computed.readOnly('pollController.model.isFindADate'),
isFreeText: readOnly('pollController.model.isFreeText'),
isFindADate: readOnly('pollController.model.isFindADate'),
momentLongDayFormat: computed.readOnly('pollController.momentLongDayFormat'),
momentLongDayFormat: readOnly('pollController.momentLongDayFormat'),
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() {
return this.get('pollController.model.answers').map((answer) => {
@ -151,7 +148,7 @@ export default Controller.extend(Validations, {
if (!isEmpty(answer.get('labelTranslation'))) {
return AnswerObject.extend(owner.ownerInjection(), {
i18n: inject.service(),
i18n: service(),
label: computed('i18n.locale', function() {
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')
});

View file

@ -3,14 +3,15 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Croodle</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="referrer" content="no-referrer">
{{content-for "head"}}
<link rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link rel="stylesheet" href="{{rootURL}}assets/croodle.css">
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/croodle.css">
{{content-for "head-footer"}}
</head>

View file

@ -1,6 +1,5 @@
import Ember from 'ember';
const { getOwner, isEmpty, isPresent } = Ember;
import { getOwner } from '@ember/application';
import { isPresent, isEmpty } from '@ember/utils';
export default {
name: 'i18n',

View file

@ -109,15 +109,15 @@ export default {
exclusion: '{{description}} está reservada',
invalid: '{{description}} no es válida',
confirmation: '{{description}} no encaja con {{attribute}}',
accepted: '{{description}} debe ser aceptado\/a',
accepted: '{{description}} debe ser aceptado/a',
empty: '{{description}} no puede estar vacio',
blank: '{{description}} no puede estar en blanco',
present: '{{description}} debe estar en blanco',
'present.answer.selection': 'Hay que escoger una respuesta.',
collection: '{{description}} tiene que 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)',
tooShort: '{{description}} es muy corto\/a (el mínimo son {{min}} 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)',
before: '{{description}} debe de ser antes de {date}',
after: '{{description}} debe de ser después de {date}',
wrongDateFormat: '{{description}} tiene que estar en el formato de {{date}}',

View file

@ -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.
* Background: https://github.com/emberjs/ember.js/issues/12589
*/
export default Ember.Mixin.create({
export default Mixin.create({
didInsertElement() {
this._super(...arguments);

View file

@ -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 Ember from 'ember';
import moment from 'moment';
import Fragment from 'ember-data-model-fragments/fragment';
import { fragmentOwner } from 'ember-data-model-fragments/attributes';
@ -9,12 +13,11 @@ import {
from 'ember-cp-validations';
const { attr } = DS;
const { assert, computed, inject, isEmpty } = Ember;
const Validations = buildValidations({
title: [
validator('iso8601', {
active: computed.readOnly('model.poll.isFindADate'),
active: readOnly('model.poll.isFindADate'),
validFormats: [
'YYYY-MM-DD',
'YYYY-MM-DDTHH:mmZ',
@ -59,7 +62,7 @@ export default Fragment.extend(Validations, {
'YYYY-MM-DDTHH:mm:ss.SSSZ'
];
const value = this.get('title');
if (Ember.isEmpty(value)) {
if (isEmpty(value)) {
return;
}
@ -134,7 +137,7 @@ export default Fragment.extend(Validations, {
);
// set time to undefined if value is false
if (Ember.isEmpty(value)) {
if (isEmpty(value)) {
this.set('title', date.format('YYYY-MM-DD'));
return value;
}
@ -149,7 +152,7 @@ export default Fragment.extend(Validations, {
}
}),
i18n: inject.service(),
i18n: service(),
init() {
this.get('i18n.locale');
}

View file

@ -1,4 +1,4 @@
import Ember from 'ember';
import { computed } from '@ember/object';
import DS from 'ember-data';
import {
fragmentArray
@ -64,15 +64,15 @@ export default Model.extend({
/*
* computed properties
*/
isFindADate: Ember.computed('pollType', function() {
isFindADate: computed('pollType', function() {
return this.get('pollType') === 'FindADate';
}),
isFreeText: Ember.computed('answerType', function() {
isFreeText: computed('answerType', function() {
return this.get('answerType') === 'FreeText';
}),
isMakeAPoll: Ember.computed('pollType', function() {
isMakeAPoll: computed('pollType', function() {
return this.get('pollType') === 'MakeAPoll';
})
});

View file

@ -1,7 +1,7 @@
import Ember from 'ember';
import EmberRouter from '@ember/routing/router';
import config from './config/environment';
const Router = Ember.Router.extend({
const Router = EmberRouter.extend({
location: config.locationType,
rootURL: config.rootURL
});

View file

@ -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 */
export default Ember.Route.extend({
export default Route.extend({
actions: {
transitionToPoll(poll) {
this.transitionTo('poll', poll, {
@ -22,8 +24,8 @@ export default Ember.Route.extend({
this.get('encryption').generateKey();
},
encryption: Ember.inject.service(),
encryptionKey: Ember.computed.alias('encryption.key'),
encryption: service(),
encryptionKey: alias('encryption.key'),
model() {
// create empty poll

View file

@ -1,6 +1,6 @@
import Ember from 'ember';
import Route from '@ember/routing/route';
export default Ember.Route.extend({
export default Route.extend({
model() {
return this.modelFor('create');
}

View file

@ -1,6 +1,6 @@
import Ember from 'ember';
import Route from '@ember/routing/route';
export default Ember.Route.extend({
export default Route.extend({
actions: {
previousPage() {
this.transitionTo('create.index');

View file

@ -1,6 +1,6 @@
import Ember from 'ember';
import Route from '@ember/routing/route';
export default Ember.Route.extend({
export default Route.extend({
actions: {
previousPage() {
this.transitionTo('create.options');

View file

@ -1,6 +1,6 @@
import Ember from 'ember';
import Route from '@ember/routing/route';
export default Ember.Route.extend({
export default Route.extend({
actions: {
previousPage() {
this.transitionTo('create.meta');

View file

@ -1,6 +1,6 @@
import Ember from 'ember';
import Route from '@ember/routing/route';
export default Ember.Route.extend({
export default Route.extend({
actions: {
previousPage() {
let model = this.modelFor(this.routeName);

View file

@ -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: {
error(error) {
if (error && error.status === 404) {
@ -11,16 +12,14 @@ export default Ember.Route.extend({
}
},
encryption: Ember.inject.service(),
encryption: service(),
model(params) {
// get encryption key from query parameter in singleton
// before it's used by serializer to decrypt payload
this.set('encryption.key', params.encryptionKey);
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
return this.store.find('poll', params.poll_id);
/* jscs:enable requireCamelCaseOrUpperCaseIdentifiers */
},
redirect(poll, transition) {

View file

@ -1,5 +1,6 @@
import { isEmpty } from '@ember/utils';
import { inject as service } from '@ember/service';
import DS from 'ember-data';
import Ember from 'ember';
/*
* extends DS.RESTSerializer to implement encryption
@ -17,7 +18,7 @@ import Ember from 'ember';
export default DS.RESTSerializer.extend({
isNewSerializerAPI: true,
encryption: Ember.inject.service(),
encryption: service(),
/*
* implement decryption
@ -52,7 +53,7 @@ export default DS.RESTSerializer.extend({
// map includePlainOnCreate after serialization of attribute hash
// but before encryption so we can just use the serialized hash
if (
!Ember.isEmpty(attribute.options.includePlainOnCreate) &&
!isEmpty(attribute.options.includePlainOnCreate) &&
typeof attribute.options.includePlainOnCreate === 'string'
) {
json[attribute.options.includePlainOnCreate] = json[key];

View file

@ -1,6 +1,6 @@
import { isEmpty } from '@ember/utils';
import DS from 'ember-data';
import ApplicationAdapter from './application';
import Ember from 'ember';
export default ApplicationAdapter.extend(DS.EmbeddedRecordsMixin, {
attrs: {
@ -14,7 +14,7 @@ export default ApplicationAdapter.extend(DS.EmbeddedRecordsMixin, {
// property 'type' of answers was named 'id'
if (
resourceHash.answers.length > 0 &&
!Ember.isEmpty(resourceHash.answers[0].id)
!isEmpty(resourceHash.answers[0].id)
) {
resourceHash.answers.forEach((answer, index) => {
resourceHash.answers[index].type = answer.id;

View file

@ -1,5 +1,5 @@
import { isEmpty } from '@ember/utils';
import ApplicationAdapter from './application';
import Ember from 'ember';
export default ApplicationAdapter.extend({
legacySupport(resourceHash) {
@ -11,7 +11,7 @@ export default ApplicationAdapter.extend({
* selections where stored as child object of "value" property
* 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) {
if (typeof selection.value === 'string') {
resourceHash.selections[index] = {

View file

@ -1,8 +1,8 @@
import Ember from 'ember';
import Service from '@ember/service';
import generatePassphrase from '../utils/generate-passphrase';
import sjcl from 'sjcl';
export default Ember.Service.extend({
export default Service.extend({
key: null,
decrypt(value) {

View file

@ -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 moment from 'moment';
import Ember from 'ember';
export default BaseValidator.extend({
validate(value, options = {}) {
Ember.assert(
assert(
'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;
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 (
options.active === false ||

View file

@ -1,5 +1,5 @@
import { isEmpty } from '@ember/utils';
import BaseValidator from 'ember-cp-validations/validators/base';
import Ember from 'ember';
import moment from 'moment';
export default BaseValidator.extend({
@ -12,11 +12,11 @@ export default BaseValidator.extend({
options.value = value;
if (options.allowEmpty && Ember.isEmpty(value)) {
if (options.allowEmpty && isEmpty(value)) {
return true;
}
if (!Ember.isEmpty(value) && typeof value.trim === 'function') {
if (!isEmpty(value) && typeof value.trim === 'function') {
value = value.trim();
}

View file

@ -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 Ember from 'ember';
export default BaseValidator.extend({
validate(value, options, model, attribute) {
Ember.assert(
assert(
'options.parent is required',
Ember.isPresent(options.parent)
isPresent(options.parent)
);
Ember.assert(
assert(
'options.attributeInParent is required',
Ember.isPresent(options.attributeInParent)
isPresent(options.attributeInParent)
);
Ember.assert(
assert(
'options.dependentKeys is required',
Ember.isArray(options.dependentKeys) && options.dependentKeys.length > 0
isArray(options.dependentKeys) && options.dependentKeys.length > 0
);
if (options.disable) {
@ -21,7 +23,7 @@ export default BaseValidator.extend({
}
// ignore empty values
if (Ember.isEmpty(value)) {
if (isEmpty(value)) {
return true;
}

View file

@ -1,3 +1,4 @@
/* global window */
window.deprecationWorkflow = window.deprecationWorkflow || {};
window.deprecationWorkflow.config = {
workflow: [

View file

@ -1,12 +1,23 @@
/* eslint-env node */
'use strict';
module.exports = function(environment) {
const ENV = {
let ENV = {
modulePrefix: 'croodle',
environment: environment,
environment,
rootURL: '/',
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: {
// Here you can pass flags/options to your application instance
@ -24,15 +35,6 @@ module.exports = function(environment) {
'referrer': "no-referrer"
},
EmberENV: {
EXTEND_PROTOTYPES: {
Array: true,
Date: false,
String: false,
Function: true
}
},
moment: {
includeLocales: ['ca', 'de', 'es', 'it'],
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') {
ENV.rootURL = '/';
// Testem prefers this...
ENV.locationType = 'hash';
ENV.locationType = 'none';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
ENV.APP.autoboot = false;
}
if (environment === 'production') {
// here you can enable a production-specific feature
}
return ENV;

View file

@ -1,4 +1,3 @@
/* eslint-env node */
module.exports = {
browsers: [
'ie 9',

View file

@ -1,4 +1,3 @@
/* eslint-env node */
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');

View file

@ -1,4 +1,5 @@
/* eslint-env node */
/* eslint-disable no-console */
'use strict';
let fse = require('fs-extra');
@ -6,7 +7,7 @@ let child_process = require('child_process');
let RSVP = require('rsvp');
let { copy, ensureDirSync, remove } = fse;
let { exec, execSync } = child_process;
let { exec } = child_process;
let { Promise } = RSVP;
const apiPath = 'api/';

View file

@ -1,3 +1,4 @@
/* eslint-disable ember/avoid-leaking-state-in-ember-objects */
import { Factory } from 'ember-cli-mirage';
import encrypt from '../utils/encrypt';

View file

@ -1,3 +1,4 @@
/* eslint-disable ember/avoid-leaking-state-in-ember-objects */
import { Factory } from 'ember-cli-mirage';
import encrypt from '../utils/encrypt';

View file

@ -1,3 +1,4 @@
/* eslint-disable ember/avoid-leaking-state-in-ember-objects */
import ApplicationSerializer from './application';
export default ApplicationSerializer.extend({

View file

@ -3,11 +3,12 @@
* sjcl and encryptionKey property of model as passphrase.
* 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';
const { assert, get, isArray, isPresent } = Ember;
export default function(propertiesToEncrypt, model) {
assert(isArray(propertiesToEncrypt), 'first argument must be an array');
assert(isPresent(get(model, 'encryptionKey')), 'model must have an encryptionKey property which isn\'t empty');

View file

@ -1,6 +1,7 @@
{
"name": "croodle",
"version": "0.5.6",
"private": true,
"license": "MIT",
"author": "",
"directories": {
@ -10,7 +11,8 @@
"repository": "https://github.com/jelhan/croodle",
"scripts": {
"build": "ember build",
"start": "ember server",
"lint:js": "eslint ./*.js app config lib server tests",
"start": "ember serve",
"test": "ember test"
},
"devDependencies": {
@ -22,35 +24,35 @@
"ember-bootstrap": "^2.1.2",
"ember-bootstrap-cp-validations": "^1.0.0",
"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-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-browser-navigation-button-test-helper": "^0.0.4",
"ember-cli-build-info": "^0.3.0",
"ember-cli-chart": "^3.3.1",
"ember-cli-clipboard": "^0.8.0",
"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-eslint": "^3.0.0",
"ember-cli-eslint": "^4.2.1",
"ember-cli-flash": "^1.4.0",
"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-less": "^1.5.3",
"ember-cli-mirage": "^0.4.10",
"ember-cli-moment-shim": "^3.7.1",
"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-sauce": "^1.6.0",
"ember-cli-shims": "^1.1.0",
"ember-cli-shims": "^1.2.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-data": "~2.14.3",
"ember-data": "~2.18.0",
"ember-data-model-fragments": "^2.14.0",
"ember-export-application-global": "^2.0.0",
"ember-i18n": "^5.0.2",
@ -65,16 +67,15 @@
"ember-resolver": "^4.0.0",
"ember-route-action-helper": "^2.0.6",
"ember-simple-select": "^0.6.1",
"ember-source": "~2.14.1",
"ember-suave": "^4.0.0",
"ember-source": "~2.18.0",
"ember-transition-helper": "^1.0.0",
"ember-truth-helpers": "^2.1.0",
"eslint-plugin-ember": "^5.0.0",
"loader.js": "^4.2.3"
},
"engines": {
"node": "^4.5 || 6.* || >= 7.*"
},
"private": true,
"ember-addon": {
"paths": [
"lib/include-api-in-build"

View file

@ -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>

View file

@ -1,4 +1,3 @@
/* eslint-env node */
module.exports = {
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
@ -9,13 +8,18 @@ module.exports = {
'Chrome'
],
browser_args: {
Chrome: [
process.env.CI ? '--no-sandbox' : null,
'--disable-gpu',
'--headless',
'--remote-debugging-port=9222',
'--window-size=1440,900'
].filter(Boolean)
Chrome: {
mode: 'ci',
args: [
// --no-sandbox is needed when running Chrome inside a container
process.env.TRAVIS ? '--no-sandbox' : null,
'--disable-gpu',
'--headless',
'--remote-debugging-port=0',
'--window-size=1440,900'
].filter(Boolean)
}
},
proxies: {
'/': {

View file

@ -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
}
};

View file

@ -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
assert.ok(jQuery('head meta[name="build-info"]').length === 1, 'tag exists');
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')
);
});

View file

@ -1,6 +1,4 @@
import Ember from 'ember';
const { run } = Ember;
import { run } from '@ember/runloop';
export default function destroyApp(application) {
// this is required to fix "second Pretender instance" warnings
@ -9,7 +7,4 @@ export default function destroyApp(application) {
}
run(application, 'destroy');
if (window.server) {
window.server.shutdown();
}
}

View file

@ -1,10 +1,8 @@
import { module } from 'qunit';
import Ember from 'ember';
import { resolve } from 'rsvp';
import startApp from '../helpers/start-app';
import destroyApp from '../helpers/destroy-app';
const { RSVP: { resolve } } = Ember;
export default function(name, options = {}) {
module(name, {
beforeEach(assert) {

View file

@ -1,7 +1,8 @@
import Ember from 'ember';
import { isEmpty } from '@ember/utils';
import { registerHelper } from '@ember/test';
const helpers = function() {
Ember.Test.registerHelper('pollHasUser', function(app, assert, name, selections) {
registerHelper('pollHasUser', function(app, assert, name, selections) {
let elBase;
find('.user').each((index, el) => {
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) {
if (Ember.isEmpty(message)) {
registerHelper('pollHasUsersCount', function(app, assert, count, message) {
if (isEmpty(message)) {
message = 'poll has expected count of users';
}
assert.equal(

View file

@ -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) {
if (!Ember.isEmpty(name)) {
export default registerAsyncHelper('pollParticipate', function(app, name, selections) {
if (!isEmpty(name)) {
fillIn('.participation .name input', name);
}
const isFreeText = find('.participation .selections .radio').length ? false : true;
selections.forEach((selection, index) => {
if (!Ember.isEmpty(selection)) {
if (!isEmpty(selection)) {
if (isFreeText) {
fillIn(`.participation .selections .form-group:nth-child(${index + 1}) input`, selection);
} else {

View file

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

View file

@ -1,18 +1,20 @@
import Ember from 'ember';
import Application from '../../app';
import config from '../../config/environment';
import { merge } from '@ember/polyfills';
import { run } from '@ember/runloop';
import './poll-has-users';
import './poll-participate';
import './switch-tab';
import './t';
import registerAcceptanceTestHelpers from './201-created/register-acceptance-test-helpers';
import registerBrowserNavigationButtonTestHelpers from './browser-navigation-buttons';
import './ember-i18n/test-helpers';
export default function startApp(attrs) {
let attributes = Ember.merge({}, config.APP);
attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
let attributes = merge({}, config.APP);
attributes.autoboot = true;
attributes = merge(attributes, attrs); // use defaults, but you can override;
return Ember.run(() => {
return run(() => {
let application = Application.create(attributes);
application.setupForTesting();

View file

@ -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`);
});

View file

@ -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);
});

View file

@ -1,6 +1,6 @@
import EmberObject from '@ember/object';
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import Ember from 'ember';
import moment from 'moment';
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) {
this.set('options', [
Ember.Object.create({ title: '2015-01-01' }),
Ember.Object.create({ title: '2015-01-02' })
EmberObject.create({ title: '2015-01-01' }),
EmberObject.create({ title: '2015-01-02' })
]);
this.render(hbs`{{#bs-form as |form|}}{{create-options-dates options=options form=form}}{{/bs-form}}`);

View file

@ -1,7 +1,8 @@
import { alias } from '@ember/object/computed';
import { run } from '@ember/runloop';
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import jQuery from 'jquery';
import Ember from 'ember';
import moment from 'moment';
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
// therefore each option needs to be pushed to poll model to have it as
// it's owner
Ember.run(() => {
run(() => {
this.set('poll', this.store.createRecord('poll', {
isFindADate: true,
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
// therefore each option needs to be pushed to poll model to have it as
// it's owner
Ember.run(() => {
run(() => {
this.set('poll', this.store.createRecord('poll', {
isFindADate: true,
isMakeAPoll: false,
@ -79,7 +80,7 @@ test('it hides repeated labels', function(assert) {
// which validates according to poll model it belongs to
// therefore each option needs to be pushed to poll model to have it as
// it's owner
Ember.run(() => {
run(() => {
this.set('poll', this.store.createRecord('poll', {
isFindADate: true,
isMakeAPoll: false,
@ -121,7 +122,7 @@ test('allows to add another option', function(assert) {
// which validates according to poll model it belongs to
// therefore each option needs to be pushed to poll model to have it as
// it's owner
Ember.run(() => {
run(() => {
this.set('poll', this.store.createRecord('poll', {
options: [
{ 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
// therefore each option needs to be pushed to poll model to have it as
// it's owner
Ember.run(() => {
run(() => {
this.set('poll', this.store.createRecord('poll', {
isFindADate: true,
isMakeAPoll: false,
@ -182,7 +183,7 @@ test('allows to delete an option', function(assert) {
'options are deleteable'
);
this.$('.days .form-group').eq(0).find('.delete').click();
Ember.run(() => {
run(() => {
assert.equal(
this.$('.days .form-group input').length,
1,
@ -211,7 +212,7 @@ test('adopt times of first day - simple', function(assert) {
// which validates according to poll model it belongs to
// therefore each option needs to be pushed to poll model to have it as
// it's owner
Ember.run(() => {
run(() => {
this.set('poll', this.store.createRecord('poll', {
options: [
{ 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}}`);
Ember.run(() => {
run(() => {
this.$('button.adopt-times-of-first-day').click();
});
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
// therefore each option needs to be pushed to poll model to have it as
// it's owner
Ember.run(() => {
run(() => {
this.set('poll', this.store.createRecord('poll', {
options: [
{ 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}}`);
Ember.run(() => {
run(() => {
this.$('button.adopt-times-of-first-day').click();
});
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
// therefore each option needs to be pushed to poll model to have it as
// it's owner
Ember.run(() => {
run(() => {
this.set('poll', this.store.createRecord('poll', {
isFindADate: true,
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}}`);
Ember.run(() => {
run(() => {
this.$('button.adopt-times-of-first-day').click();
});
assert.equal(
@ -304,12 +305,12 @@ test('validation', function(assert) {
// which validates according to poll model it belongs to
// therefore each option needs to be pushed to poll model to have it as
// it's owner
Ember.run(() => {
run(() => {
this.set('poll', this.store.createRecord('poll', {
isFindADate: true,
isMakeAPoll: false
}));
this.set('options', Ember.computed.alias('poll.options'));
this.set('options', alias('poll.options'));
this.get('options').pushObjects([
{ title: '2015-01-01' },
{ title: '2015-02-02' }

View file

@ -1,8 +1,8 @@
import { run } from '@ember/runloop';
import { moduleForComponent, test } from 'ember-qunit';
import { blur, fillIn, findAll, focus } from 'ember-native-dom-helpers';
import hbs from 'htmlbars-inline-precompile';
import hasComponent from 'croodle/tests/helpers/201-created/raw/has-component';
import Ember from 'ember';
moduleForComponent('create-options', 'Integration | Component | create options', {
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
// it's owner
let poll;
Ember.run(() => {
run(() => {
poll = this.store.createRecord('poll', {
isFindADate: this.get('isFindADate'),
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
// it's owner
let poll;
Ember.run(() => {
run(() => {
poll = this.store.createRecord('poll', {
isFindADate: this.get('isFindADate'),
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
// it's owner
let poll;
Ember.run(() => {
run(() => {
poll = this.store.createRecord('poll', {
isFindADate: this.get('isFindADate'),
isDateTime: this.get('isDateTime'),

View file

@ -1,7 +1,8 @@
import { run } from '@ember/runloop';
import EmberObject from '@ember/object';
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import jQuery from 'jquery';
import Ember from 'ember';
moduleForComponent('create-options-text', 'Integration | Component | create options text', {
integration: true,
@ -19,9 +20,9 @@ test('it generates at least two input fields', function(assert) {
test('generates input fields according options', function(assert) {
this.set('options', [
Ember.Object.create({ title: 'foo' }),
Ember.Object.create({ title: 'bar' }),
Ember.Object.create({ title: 'baz' })
EmberObject.create({ title: 'foo' }),
EmberObject.create({ title: 'bar' }),
EmberObject.create({ title: 'baz' })
]);
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) {
this.set('options', [
Ember.Object.create({ title: 'foo' }),
Ember.Object.create({ title: 'bar' })
EmberObject.create({ title: 'foo' }),
EmberObject.create({ title: 'bar' })
]);
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'
);
Ember.run(() => {
run(() => {
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) {
this.set('options', [
Ember.Object.create({ title: 'foo' }),
Ember.Object.create({ title: 'bar' })
EmberObject.create({ title: 'foo' }),
EmberObject.create({ title: 'bar' })
]);
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
// it's owner
let poll;
Ember.run(() => {
run(() => {
poll = this.store.createRecord('poll', {
isFindADate: this.get('isFindADate'),
isDateTime: this.get('isDateTime'),
@ -111,7 +112,7 @@ test('allows to add another option', function(assert) {
'there are two input fields before'
);
Ember.run(() => {
run(() => {
this.$('.form-group .add').eq(0).click();
});
assert.equal(
@ -127,7 +128,7 @@ test('allows to add another option', function(assert) {
'it is added at correct position'
);
Ember.run(() => {
run(() => {
this.$('.form-group input').eq(1).val('baz').trigger('change');
});
assert.equal(
@ -139,9 +140,9 @@ test('allows to add another option', function(assert) {
test('allows to delete an option', function(assert) {
this.set('options', [
Ember.Object.create({ title: 'foo' }),
Ember.Object.create({ title: 'bar' }),
Ember.Object.create({ title: 'baz' })
EmberObject.create({ title: 'foo' }),
EmberObject.create({ title: 'bar' }),
EmberObject.create({ title: 'baz' })
]);
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'
);
this.$('.form-group .delete').eq(1).click();
Ember.run(() => {
run(() => {
assert.equal(
this.$('.form-group input').length,
2,

View file

@ -1,6 +1,6 @@
import EmberObject from '@ember/object';
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import Ember from 'ember';
import moment from 'moment';
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) {
this.set('options', [
Ember.Object.create({
EmberObject.create({
formatted: 'Thursday, January 1, 2015',
title: moment('2015-01-01'),
hasTime: false
}),
Ember.Object.create({
EmberObject.create({
formatted: 'Monday, February 2, 2015',
title: moment('2015-02-02'),
hasTime: false
}),
Ember.Object.create({
EmberObject.create({
formatted: 'Tuesday, March 3, 2015 1:00 AM',
title: moment('2015-03-03T01:00'),
hasTime: true
}),
Ember.Object.create({
EmberObject.create({
formatted: 'Tuesday, March 3, 2015 11:00 AM',
title: moment('2015-03-03T11:00'),
hasTime: true
@ -35,36 +35,36 @@ test('it renders', function(assert) {
]);
this.set('answerType', 'YesNoMaybe');
this.set('users', [
Ember.Object.create({
EmberObject.create({
id: 1,
selections: [
Ember.Object.create({
EmberObject.create({
type: 'yes'
}),
Ember.Object.create({
EmberObject.create({
type: 'yes'
}),
Ember.Object.create({
EmberObject.create({
type: 'maybe'
}),
Ember.Object.create({
EmberObject.create({
type: 'no'
})
]
}),
Ember.Object.create({
EmberObject.create({
id: 2,
selections: [
Ember.Object.create({
EmberObject.create({
type: 'yes'
}),
Ember.Object.create({
EmberObject.create({
type: 'maybe'
}),
Ember.Object.create({
EmberObject.create({
type: 'no'
}),
Ember.Object.create({
EmberObject.create({
type: 'no'
})
]

View file

@ -1,9 +1,7 @@
import { get } from '@ember/object';
import { module, test } from 'qunit';
import { startMirage } from 'croodle/initializers/ember-cli-mirage';
import sjcl from 'sjcl';
import Ember from 'ember';
const { get } = Ember;
module('Integration | Mirage api mocking', {
beforeEach() {

View file

@ -1,11 +1,9 @@
import { getOwner } from '@ember/application';
import { moduleFor, test } from 'ember-qunit';
import Ember from 'ember';
import config from 'croodle/config/environment';
import LocaleHelper from 'ember-i18n/utils/locale';
import localesMeta from 'croodle/locales/meta';
const { getOwner } = Ember;
moduleFor('service:i18n', 'Integration | translations', {
integration: true
});

View file

@ -1,4 +1,4 @@
import Ember from 'ember';
import { isPresent } from '@ember/utils';
import PageObject from 'ember-cli-page-object';
import { findElementWithAssert } from 'ember-cli-page-object';
import { defaultsForCreate } from 'croodle/tests/pages/defaults';
@ -22,7 +22,7 @@ const setBootstrapDatepicker = function(selector, options = {}) {
isDescriptor: true,
value(dates) {
const el = findElementWithAssert(this, selector, options);
if (Ember.isPresent(dates)) {
if (isPresent(dates)) {
const normalizedDates = dates.map((date) => {
if (typeof date.toDate === 'function') {
date = date.toDate();

View file

@ -1,8 +1,8 @@
import resolver from './helpers/resolver';
import {
setResolver
} from 'ember-qunit';
import { start } from 'ember-cli-qunit';
import Application from '../app';
import config from '../config/environment';
import { setApplication } from '@ember/test-helpers';
import { start } from 'ember-qunit';
setApplication(Application.create(config.APP));
setResolver(resolver);
start();

View file

@ -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 Ember from 'ember';
import moment from 'moment';
const { Object: EmberObject, run } = Ember;
moduleForComponent('create-options-dates', 'Unit | Component | create options dates', {
needs: ['config:environment', 'model:option', 'service:i18n'],
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' })
]);
assert.ok(
Ember.isArray(
isArray(
controller.get('optionsBootstrapDatepicker')
),
"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' })
]);
assert.ok(
Ember.isArray(
isArray(
controller.get('optionsBootstrapDatepicker')
),
"it's an array"
@ -92,7 +92,7 @@ test('options get set correctly by optionsBootstrapDatepicker (used by ember-cli
]);
});
assert.ok(
Ember.isArray(
isArray(
controller.get('options')
),
'options is still an array'

View file

@ -1,5 +1,5 @@
import { run } from '@ember/runloop';
import { moduleForComponent, test } from 'ember-qunit';
import Ember from 'ember';
import moment from 'moment';
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) {
let component = this.subject();
let a, b, c, d, e;
Ember.run(() => {
run(() => {
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() });
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)'
);
Ember.run(() => {
run(() => {
component.send('deleteOption', c);
});
assert.deepEqual(
@ -76,7 +76,7 @@ test('datetimes are grouped by date', function(assert) {
let a, b, c;
// have to set dates in local time and than convert to ISO 8601 strings
// because otherwise test could fail caused by timezone
Ember.run(() => {
run(() => {
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() });
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) {
let component = this.subject();
Ember.run(() => {
run(() => {
component.set('dates', [
this.store.createFragment('option', {
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'),
'time is correct before'
);
Ember.run(() => {
run(() => {
component.set(
'groupedDates.firstObject.firstObject.time',
'00:00'
@ -126,7 +126,7 @@ test('bindings are working on grouped datetimes', function(assert) {
moment('2015-01-01T00:00').toISOString(),
'option is updated after time changed on grouped datetimes'
);
Ember.run(() => {
run(() => {
component.get('dates').pushObject(
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',
'grouped datetimes got updated correctly after option was added (same day)'
);
Ember.run(() => {
run(() => {
component.get('dates').pushObject(
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) {
let component;
let poll;
Ember.run(() => {
run(() => {
poll = this.store.createRecord('poll', {
options: [
{ 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) {
let component;
let poll;
Ember.run(() => {
run(() => {
poll = this.store.createRecord('poll', {
options: [
{ 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) {
let component;
let poll;
Ember.run(() => {
run(() => {
poll = this.store.createRecord('poll', {
options: [
{ title: '2015-01-01' },

View file

@ -1,5 +1,5 @@
import { run } from '@ember/runloop';
import { moduleForComponent, test } from 'ember-qunit';
import Ember from 'ember';
import moment from 'moment';
// validator consumes i18n service
// 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
// it's owner
let poll;
Ember.run(() => {
run(() => {
poll = this.store.createRecord('poll', {
isFindADate: component.get('isFindADate'),
isMakeAPoll: component.get('isMakeAPoll')
@ -61,7 +61,7 @@ test('validation for make a poll', function(assert) {
component.get('validations.isValid'),
'invalid without any options'
);
Ember.run(() => {
run(() => {
let option = this.store.createFragment('option', {
title: 'first option'
});
@ -72,7 +72,7 @@ test('validation for make a poll', function(assert) {
component.get('validations.isValid'),
'valid if there is atleast one valid option'
);
Ember.run(() => {
run(() => {
let option = this.store.createFragment('option', {
title: 'second option'
});
@ -83,7 +83,7 @@ test('validation for make a poll', function(assert) {
component.get('validations.isValid'),
'valid for two options which are not empty strings'
);
Ember.run(() => {
run(() => {
component.set('options.firstObject.title', '');
});
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
// it's owner
let poll;
Ember.run(() => {
run(() => {
poll = this.store.createRecord('poll', {
isFindADate: component.get('isFindADate'),
isMakeAPoll: component.get('isMakeAPoll')
@ -114,7 +114,7 @@ test('validation for find a date without times', function(assert) {
component.get('validations.isValid'),
'invalid without any options'
);
Ember.run(() => {
run(() => {
let option = this.store.createFragment('option', {
title: '2015-01-01'
});
@ -125,7 +125,7 @@ test('validation for find a date without times', function(assert) {
component.get('validations.isValid'),
'valid if there is atleast one valid date'
);
Ember.run(() => {
run(() => {
let option = this.store.createFragment('option', {
title: '2015-01-02'
});
@ -136,7 +136,7 @@ test('validation for find a date without times', function(assert) {
component.get('validations.isValid'),
'valid for two valid dates'
);
Ember.run(() => {
run(() => {
let option = this.store.createFragment('option', {
title: 'foo'
});
@ -147,14 +147,14 @@ test('validation for find a date without times', function(assert) {
component.get('validations.isValid'),
'invalid if atleast one option is not a valid date'
);
Ember.run(() => {
run(() => {
component.set('options.lastObject.title', '2015-01-03');
});
assert.ok(
component.get('validations.isValid'),
'valid again after title is a valid date again'
);
Ember.run(() => {
run(() => {
component.set('options.firstObject.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
// it's owner
let poll;
Ember.run(() => {
run(() => {
poll = this.store.createRecord('poll', {
isFindADate: component.get('isFindADate'),
isMakeAPoll: component.get('isMakeAPoll')
@ -184,7 +184,7 @@ test('validation for find a date with times', function(assert) {
component.get('validations.isValid'),
'invalid without any options'
);
Ember.run(() => {
run(() => {
let option = this.store.createFragment('option', {
title: moment().add('1', 'day').format('YYYY-MM-DD')
});

View file

@ -1,6 +1,6 @@
import EmberObject from '@ember/object';
import { moduleForComponent, test } from 'ember-qunit';
import moment from 'moment';
import Ember from 'ember';
import tHelper from 'ember-i18n/helper';
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) {
let options = [
Ember.Object.create({
EmberObject.create({
title: '2015-01-01'
}),
Ember.Object.create({
EmberObject.create({
title: '2015-02-02'
}),
Ember.Object.create({
EmberObject.create({
title: '2015-03-03T01:00:00.000Z'
}),
Ember.Object.create({
EmberObject.create({
title: '2015-03-03T11:00:00.000Z'
})
];
let users = [
Ember.Object.create({
EmberObject.create({
id: 1,
selections: [
Ember.Object.create({
EmberObject.create({
type: 'yes'
}),
Ember.Object.create({
EmberObject.create({
type: 'yes'
}),
Ember.Object.create({
EmberObject.create({
type: 'maybe'
}),
Ember.Object.create({
EmberObject.create({
type: 'no'
})
]
}),
Ember.Object.create({
EmberObject.create({
id: 2,
selections: [
Ember.Object.create({
EmberObject.create({
type: 'yes'
}),
Ember.Object.create({
EmberObject.create({
type: 'maybe'
}),
Ember.Object.create({
EmberObject.create({
type: 'no'
}),
Ember.Object.create({
EmberObject.create({
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) {
const options = [
Ember.Object.create({
EmberObject.create({
title: 'first option'
}),
Ember.Object.create({
EmberObject.create({
title: 'second option'
}),
Ember.Object.create({
EmberObject.create({
title: 'third option'
}),
Ember.Object.create({
EmberObject.create({
title: 'fourth option'
})
];
@ -136,36 +136,36 @@ test('data is a valid ChartJS dataset for MakeAPoll', function(assert) {
answerType: 'YesNoMaybe',
options,
users: [
Ember.Object.create({
EmberObject.create({
id: 1,
selections: [
Ember.Object.create({
EmberObject.create({
type: 'yes'
}),
Ember.Object.create({
EmberObject.create({
type: 'yes'
}),
Ember.Object.create({
EmberObject.create({
type: 'maybe'
}),
Ember.Object.create({
EmberObject.create({
type: 'no'
})
]
}),
Ember.Object.create({
EmberObject.create({
id: 2,
selections: [
Ember.Object.create({
EmberObject.create({
type: 'yes'
}),
Ember.Object.create({
EmberObject.create({
type: 'maybe'
}),
Ember.Object.create({
EmberObject.create({
type: 'no'
}),
Ember.Object.create({
EmberObject.create({
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) {
let options = [
Ember.Object.create({
EmberObject.create({
title: '2015-01-01'
}),
Ember.Object.create({
EmberObject.create({
title: '2015-02-02'
}),
Ember.Object.create({
EmberObject.create({
title: '2015-03-03T01:00:00.000Z'
}),
Ember.Object.create({
EmberObject.create({
title: '2015-03-03T11:00:00.000Z'
})
];
let users = [
Ember.Object.create({
EmberObject.create({
id: 1,
selections: [
Ember.Object.create({
EmberObject.create({
type: 'yes'
}),
Ember.Object.create({
EmberObject.create({
type: 'yes'
}),
Ember.Object.create({
EmberObject.create({
type: 'maybe'
}),
Ember.Object.create({
EmberObject.create({
type: 'no'
})
]
}),
Ember.Object.create({
EmberObject.create({
id: 2,
selections: [
Ember.Object.create({
EmberObject.create({
type: 'yes'
}),
Ember.Object.create({
EmberObject.create({
type: 'maybe'
}),
Ember.Object.create({
EmberObject.create({
type: 'no'
}),
Ember.Object.create({
EmberObject.create({
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) {
let options = [
Ember.Object.create({
EmberObject.create({
title: '2015-03-03T01:00:00.000Z'
})
];

View file

@ -1,23 +1,24 @@
import { run } from '@ember/runloop';
import EmberObject from '@ember/object';
import { moduleFor, test } from 'ember-qunit';
import Ember from 'ember';
import moment from 'moment';
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) {
const dirtyOption = Ember.Object.create({ title: '2015-01-01' });
const dirtyOption = EmberObject.create({ title: '2015-01-01' });
let controller = this.subject({
model: {
options: [
Ember.Object.create({ title: '2015-01-01T12:00:00.000Z' }),
EmberObject.create({ title: '2015-01-01T12:00:00.000Z' }),
dirtyOption,
Ember.Object.create({ title: '2017-11-11' }),
Ember.Object.create({ title: '2018-04-04T11:11:00.000Z' })
EmberObject.create({ title: '2017-11-11' }),
EmberObject.create({ title: '2018-04-04T11:11:00.000Z' })
]
}
});
Ember.run(() => {
run(() => {
controller.normalizeOptions();
});
assert.equal(
@ -39,14 +40,14 @@ test('normalize options - sort them', function(assert) {
let controller = this.subject({
model: {
options: [
Ember.Object.create({ title: dateB }),
Ember.Object.create({ title: dateA }),
Ember.Object.create({ title: dateC }),
Ember.Object.create({ title: dateD })
EmberObject.create({ title: dateB }),
EmberObject.create({ title: dateA }),
EmberObject.create({ title: dateC }),
EmberObject.create({ title: dateD })
]
}
});
Ember.run(() => {
run(() => {
controller.normalizeOptions();
});
assert.deepEqual(

View file

@ -1,4 +1,4 @@
import Ember from 'ember';
import EmberObject from '@ember/object';
import AutofocusSupportMixin from 'croodle/mixins/autofocus-support';
import { module, test } from 'qunit';
@ -6,7 +6,7 @@ module('Unit | Mixin | autofocus support');
// Replace this with your real tests.
test('it works', function(assert) {
let AutofocusSupportObject = Ember.Object.extend(AutofocusSupportMixin);
let AutofocusSupportObject = EmberObject.extend(AutofocusSupportMixin);
let subject = AutofocusSupportObject.create();
assert.ok(subject);
});

View file

@ -1,8 +1,9 @@
import { run } from '@ember/runloop';
import Service from '@ember/service';
import { moduleForModel, test } from 'ember-qunit';
import Ember from 'ember';
import moment from 'moment';
const i18nStub = Ember.Service.extend({
const i18nStub = Service.extend({
exists() {
return false;
},
@ -42,7 +43,7 @@ test('date property (get)', function(assert) {
'string to date conversion is correct for ISO 8601 day string'
);
Ember.run(() => {
run(() => {
option.set('title', '2015-01-01T11:11:00.000Z');
});
assert.ok(
@ -55,7 +56,7 @@ test('date property (get)', function(assert) {
'string to date conversion is correct for ISO 8601 datetime string'
);
Ember.run(() => {
run(() => {
option.set('title', null);
});
assert.equal(
@ -64,7 +65,7 @@ test('date property (get)', function(assert) {
'returns undefined if title is empty'
);
Ember.run(() => {
run(() => {
option.set('title', 'abc');
});
assert.equal(
@ -73,7 +74,7 @@ test('date property (get)', function(assert) {
'returns undefined if title is not a valid ISO 8601 date string'
);
Ember.run(() => {
run(() => {
option.set('title', '2015');
});
assert.equal(
@ -82,7 +83,7 @@ test('date property (get)', function(assert) {
'returns undefined if title ISO 8601 string only contains a year'
);
Ember.run(() => {
run(() => {
option.set('title', '2015-01');
});
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'
);
Ember.run(() => {
run(() => {
option.set('title', '2013W06');
});
assert.equal(
@ -111,7 +112,7 @@ test('day property (get)', function(assert) {
'returns ISO 8601 day string if title is ISO 8601 day string'
);
Ember.run(() => {
run(() => {
option.set('title', '2015-01-01T11:11:00.000Z');
});
assert.equal(
@ -120,7 +121,7 @@ test('day property (get)', function(assert) {
'returns ISO 8601 day string if title is ISO 8601 datetime string'
);
Ember.run(() => {
run(() => {
option.set('title', 'abc');
});
assert.equal(
@ -129,7 +130,7 @@ test('day property (get)', function(assert) {
'returns undefined if title is not a valid ISO 8601 string'
);
Ember.run(() => {
run(() => {
option.set('title', null);
});
assert.equal(
@ -149,7 +150,7 @@ test('dayFormatted property (get)', function(assert) {
'returns formatted date if title is ISO 8601 day string'
);
Ember.run(() => {
run(() => {
option.set('title', moment('2015-01-01').toISOString());
});
assert.equal(
@ -158,7 +159,7 @@ test('dayFormatted property (get)', function(assert) {
'returns formatted date if title is ISO 8601 datetime string'
);
Ember.run(() => {
run(() => {
option.set('i18n.locale', 'de');
});
assert.equal(
@ -167,7 +168,7 @@ test('dayFormatted property (get)', function(assert) {
'observes locale changes'
);
Ember.run(() => {
run(() => {
option.set('title', 'abc');
});
assert.equal(
@ -182,11 +183,11 @@ test('hasTime property', function(assert) {
title: '2015-01-01T11:11:00.000Z'
});
assert.ok(option.get('hasTime'));
Ember.run(() => {
run(() => {
option.set('title', '2015-01-01');
});
assert.notOk(option.get('hasTime'));
Ember.run(() => {
run(() => {
option.set('title', 'foo');
});
assert.notOk(option.get('hasTime'));
@ -202,7 +203,7 @@ test('time property (get)', function(assert) {
'returns time if title is ISO 8601 datetime string'
);
Ember.run(() => {
run(() => {
option.set('title', '2015-01-01');
});
assert.equal(
@ -211,7 +212,7 @@ test('time property (get)', function(assert) {
'returns undefined if title is ISO 8601 day string'
);
Ember.run(() => {
run(() => {
option.set('title', 'abc');
});
assert.equal(
@ -226,7 +227,7 @@ test('time property (set)', function(assert) {
title: '2015-01-01'
});
Ember.run(() => {
run(() => {
option.set('time', '11:00');
});
assert.equal(
@ -235,7 +236,7 @@ test('time property (set)', function(assert) {
'sets title according to time'
);
Ember.run(() => {
run(() => {
option.set('time', null);
});
assert.equal(
@ -245,7 +246,7 @@ test('time property (set)', function(assert) {
);
const before = option.get('title');
Ember.run(() => {
run(() => {
option.set('time', 'abc');
});
assert.equal(
@ -254,7 +255,7 @@ test('time property (set)', function(assert) {
'does not set title if time is invalid'
);
Ember.run(() => {
run(() => {
option.set('title', 'abc');
});
assert.throws(
@ -266,7 +267,7 @@ test('time property (set)', function(assert) {
});
test('validation for MakeAPoll', function(assert) {
Ember.run(() => {
run(() => {
let store = this.store();
let poll = store.createRecord('poll', {
pollType: 'MakeAPoll'
@ -278,14 +279,14 @@ test('validation for MakeAPoll', function(assert) {
option.get('validations.isValid'),
'default value is not valid'
);
Ember.run(() => {
run(() => {
option.set('title', 'Spasibo!');
});
assert.ok(
option.get('validations.isValid'),
'is valid for a non empty string'
);
Ember.run(() => {
run(() => {
option.set('title', '!');
});
assert.ok(
@ -296,7 +297,7 @@ test('validation for MakeAPoll', function(assert) {
});
test('validation for FindADate', function(assert) {
Ember.run(() => {
run(() => {
let store = this.store();
let poll = store.createRecord('poll', {
isDateTime: false,
@ -309,14 +310,14 @@ test('validation for FindADate', function(assert) {
option.get('validations.isValid'),
'default value is not valid'
);
Ember.run(() => {
run(() => {
option.set('title', '1945-05-08');
});
assert.ok(
option.get('validations.isValid'),
'iso 8601 date string is valid'
);
Ember.run(() => {
run(() => {
option.set('title', 'Spasibo!');
});
assert.notOk(
@ -327,7 +328,7 @@ test('validation for FindADate', function(assert) {
});
test('validation for FindADate', function(assert) {
Ember.run(() => {
run(() => {
let store = this.store();
let poll = store.createRecord('poll', {
pollType: 'FindADate'
@ -339,21 +340,21 @@ test('validation for FindADate', function(assert) {
option.get('validations.isValid'),
'default value is not valid'
);
Ember.run(() => {
run(() => {
option.set('title', '1945-05-08T00:00:00.000Z');
});
assert.ok(
option.get('validations.isValid'),
'iso 8601 datetime string is valid'
);
Ember.run(() => {
run(() => {
option.set('title', 'Spasibo!');
});
assert.notOk(
option.get('validations.isValid'),
'random string is not valid'
);
Ember.run(() => {
run(() => {
option.set('title', '1945-05-08');
});
assert.ok(

View file

@ -1,5 +1,6 @@
import { A } from '@ember/array';
import EmberObject from '@ember/object';
import { moduleFor, test } from 'ember-qunit';
import Ember from 'ember';
moduleFor('validator:unique', 'Unit | Validator | unique', {
needs: ['validator:messages']
@ -38,10 +39,10 @@ test('throws if required option is missing', function(assert) {
test('validation', function(assert) {
const validator = this.subject();
const parent = Ember.Object.create({
collection: Ember.A([])
const parent = EmberObject.create({
collection: A([])
});
const childObject = Ember.Object.extend({
const childObject = EmberObject.extend({
parent
});
const options = {

1573
yarn.lock

File diff suppressed because it is too large Load diff