Skip to content

Commit

Permalink
⬆️ Moment & Sugar Dependency Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nadnoslen committed Apr 18, 2022
1 parent e9fee9a commit 8530a18
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 197 deletions.
4 changes: 2 additions & 2 deletions addon/components/input-date.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import InputText from 'ember-cli-text-support-mixins/components/input-text';
import moment from 'moment';
import moment from 'moment-timezone';
import * as Sugar from 'sugar';

/* global Sugar */
import { trySet } from '@ember/object';
import { isBlank, isPresent, typeOf } from '@ember/utils';

Expand Down
4 changes: 2 additions & 2 deletions addon/components/input-iso8601.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import InputText from 'ember-cli-text-support-mixins/components/input-text';
import moment from 'moment';
import moment from 'moment-timezone';
import * as Sugar from 'sugar';

/* global Sugar */
import { trySet } from '@ember/object';
import { isBlank, isPresent } from '@ember/utils';

Expand Down
13 changes: 2 additions & 11 deletions blueprints/ember-cli-date-textbox/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
/* eslint-env node */
module.exports = {
description: 'A textbox that will guess the date you want and assign it to your model or query-params.',
description: 'A textbox that will guess the date you want and assign it to your object instance.',
name: 'ember-cli-date-textbox',
normalizeEntityName: function () {},
afterInstall: function (/*options*/) {
var self = this;
return self
.addAddonsToProject({
packages: [{ name: 'ember-cli-text-support-mixins', target: '~1' }, { name: 'ember-moment' }],
})
.then(function () {
return self.addPackagesToProject([{ name: 'sugar-date' }]);
});
},
afterInstall: function (/*options*/) {},
};
10 changes: 1 addition & 9 deletions config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,5 @@
'use strict';

module.exports = function (/* environment, appConfig */) {
return {
moment: {
// Options:
// 'all' - all years, all timezones
// '2010-2020' - 2010-2020, all timezones
// 'none' - no data, just timezone API
includeTimezone: 'all',
},
};
return {};
};
15 changes: 0 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,4 @@

module.exports = {
name: require('./package').name,
options: {
nodeAssets: {
'sugar-date': {
vendor: {
srcDir: 'dist',
destDir: 'ember-cli-date-textbox',
include: ['sugar-date.js'],
},
},
},
},
included(app) {
this._super.included(...arguments);
app.import('vendor/ember-cli-date-textbox/sugar-date.js');
},
};
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@
"ember-auto-import": "^2.4.1",
"ember-cli-babel": "^7.7.3",
"ember-cli-node-assets": "^0.2.2",
"ember-moment": "^7.8.0",
"sugar-date": "^2.0.4"
"keyevent": "^1.1.0",
"moment": "^2.29.3",
"moment-timezone": "^0.5.34",
"sugar": "^2.0.6"
},
"devDependencies": {
"@ember/jquery": "^2.0.0",
Expand All @@ -74,7 +76,6 @@
"ember-cli-eslint": "^5.1.0",
"ember-cli-htmlbars": "^6.0.1",
"ember-cli-inject-live-reload": "^2.1.0",
"ember-cli-moment-shim": "^3.7.1",
"ember-cli-sass": "^10.0.1",
"ember-cli-sri": "^2.1.1",
"ember-cli-template-lint": "^1.0.0-beta.1",
Expand All @@ -93,7 +94,6 @@
"eslint-plugin-ember": "^6.2.0",
"eslint-plugin-node": "^11.1.0",
"font-awesome": "4.7",
"keyevent": "^1.1.0",
"loader.js": "^4.7.0",
"mockdate": "^3.0.5",
"prettier": "^2.6.2",
Expand Down
52 changes: 0 additions & 52 deletions tests/.jshintrc

This file was deleted.

18 changes: 13 additions & 5 deletions tests/integration/components/input-date-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { hbs } from 'ember-cli-htmlbars';
import { setupRenderingTest } from 'ember-qunit';
import moment from 'moment';
import moment from 'moment-timezone';
import { module, test } from 'qunit';

import { fillIn, find, render } from '@ember/test-helpers';
Expand Down Expand Up @@ -112,7 +112,9 @@ module('Integration | Component | input date', function (hooks) {
freezeTime(new Date(2001, 8, 11));

this.set('date', null);
await render(hbs`<InputDate @date={{date}} @displayFormat="llll z" @past?={{false}} @timezone="America/Edmonton" />`);
await render(
hbs`<InputDate @date={{date}} @displayFormat="llll z" @past?={{false}} @timezone="America/Edmonton" />`
);

assert.equal(find('input').value.trim(), '');

Expand All @@ -126,7 +128,9 @@ module('Integration | Component | input date', function (hooks) {
freezeTime(new Date(2001, 8, 11));

this.set('date', null);
await render(hbs`<InputDate @date={{date}} @displayFormat="llll z" @past?={{true}} @timezone="America/Edmonton" />`);
await render(
hbs`<InputDate @date={{date}} @displayFormat="llll z" @past?={{true}} @timezone="America/Edmonton" />`
);

assert.equal(find('input').value.trim(), '');

Expand All @@ -140,7 +144,9 @@ module('Integration | Component | input date', function (hooks) {
freezeTime(new Date(2001, 8, 11));

this.set('date', null);
await render(hbs`<InputDate @date={{date}} @displayFormat="llll z" @future?={{false}} @timezone="America/Edmonton" />`);
await render(
hbs`<InputDate @date={{date}} @displayFormat="llll z" @future?={{false}} @timezone="America/Edmonton" />`
);

assert.equal(find('input').value.trim(), '');

Expand All @@ -154,7 +160,9 @@ module('Integration | Component | input date', function (hooks) {
freezeTime(new Date(2001, 8, 11));

this.set('date', null);
await render(hbs`<InputDate @date={{date}} @displayFormat="llll z" @future?={{true}} @timezone="America/Edmonton" />`);
await render(
hbs`<InputDate @date={{date}} @displayFormat="llll z" @future?={{true}} @timezone="America/Edmonton" />`
);

assert.equal(find('input').value.trim(), '');

Expand Down
10 changes: 7 additions & 3 deletions tests/integration/components/input-iso8601-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { hbs } from 'ember-cli-htmlbars';
import { setupRenderingTest } from 'ember-qunit';
import moment from 'moment';
import moment from 'moment-timezone';
import { module, test } from 'qunit';

import { fillIn, find, render } from '@ember/test-helpers';
Expand Down Expand Up @@ -112,7 +112,9 @@ module('Integration | Component | input iso8601', function (hooks) {
freezeTime(new Date(2001, 8, 11));

this.set('iso8601', null);
await render(hbs`<InputIso8601 @iso8601={{iso8601}} @displayFormat="llll z" @past?={{false}} @timezone="America/Edmonton" />`);
await render(
hbs`<InputIso8601 @iso8601={{iso8601}} @displayFormat="llll z" @past?={{false}} @timezone="America/Edmonton" />`
);

assert.equal(find('input').value.trim(), '');

Expand All @@ -126,7 +128,9 @@ module('Integration | Component | input iso8601', function (hooks) {
freezeTime(new Date(2001, 8, 11));

this.set('iso8601', null);
await render(hbs`<InputIso8601 @iso8601={{iso8601}} @displayFormat="llll z" @past?={{true}} @timezone="America/Edmonton" />`);
await render(
hbs`<InputIso8601 @iso8601={{iso8601}} @displayFormat="llll z" @past?={{true}} @timezone="America/Edmonton" />`
);

assert.equal(find('input').value.trim(), '');

Expand Down
Loading

0 comments on commit 8530a18

Please sign in to comment.