Skip to content

Commit

Permalink
run ember-cli-update and upgrade deps
Browse files Browse the repository at this point in the history
  • Loading branch information
amk221 committed Sep 6, 2024
1 parent 623555a commit b489e3d
Show file tree
Hide file tree
Showing 14 changed files with 9,632 additions and 13,813 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/vendor/

# compiled output
/declarations/
/dist/
/tmp/

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
fail-fast: false
matrix:
try-scenario:
- ember-lts-4.8
- ember-lts-4.12
- ember-lts-5.4
- ember-release
- ember-beta
- ember-canary
Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
/ember-cli-build.js
/testem.js
/tests/
/tsconfig.declarations.json
/tsconfig.json
/yarn-error.log
/yarn.lock
.gitkeep
Expand Down
7 changes: 4 additions & 3 deletions addon/-private/constraints/date.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { isPresent } from '@ember/utils';
import isValid from 'date-fns/isValid';
import parse from 'date-fns/parse';
import { isValid } from 'date-fns/isValid';
import { parse } from 'date-fns/parse';
import { messageFor } from '@zestia/ember-validation';

export default function date(options) {
return function (value, object) {
return function (_value, object) {
const value = _value || '';
const format = options.format;
const referenceDate = options.referenceDate ?? new Date();
const dateFnsOptions = { ...options };
Expand Down
23,304 changes: 9,551 additions & 13,753 deletions package-lock.json

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
{
"author": "Zestia",
"dependencies": {
"@babel/core": "^7.23.6",
"date-fns": "^2.30.0",
"ember-auto-import": "^2.7.1",
"@babel/core": "^7.25.2",
"date-fns": "^3.6.0",
"ember-auto-import": "^2.7.4",
"ember-cli-babel": "^8.2.0",
"ember-cli-htmlbars": "^6.3.0"
},
"description": "Simple validation utilities for Ember apps",
"devDependencies": {
"@ember/optional-features": "^2.0.0",
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^3.2.1",
"@embroider/test-setup": "^3.0.3",
"@ember/optional-features": "^2.1.0",
"@ember/string": "^4.0.0",
"@ember/test-helpers": "^4.0.4",
"@embroider/test-setup": "^4.0.0",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"@zestia/eslint-config": "^5.3.0",
"@zestia/eslint-config": "^6.0.0",
"@zestia/prettier-config": "^1.3.1",
"@zestia/stylelint-config": "^5.3.2",
"@zestia/template-lint-config": "^6.1.0",
"@zestia/stylelint-config": "^6.1.0",
"@zestia/template-lint-config": "^6.2.0",
"broccoli-asset-rev": "^3.0.0",
"concurrently": "^8.2.2",
"ember-cli": "^5.5.0",
"ember-cli": "^5.11.0",
"ember-cli-clean-css": "^3.0.0",
"ember-cli-dependency-checker": "^3.3.2",
"ember-cli-github-pages": "^0.2.2",
"ember-cli-inject-live-reload": "^2.1.0",
"ember-cli-sri": "^2.1.1",
"ember-cli-terser": "^4.0.2",
"ember-data": "^5.3.0",
"ember-data": "^5.3.8",
"ember-load-initializers": "^2.1.2",
"ember-qunit": "^8.0.2",
"ember-resolver": "^11.0.1",
"ember-source": "^5.5.0",
"ember-qunit": "^8.1.0",
"ember-resolver": "^12.0.1",
"ember-source": "^5.11.0",
"ember-source-channel-url": "^3.0.0",
"ember-template-lint": "^5.13.0",
"ember-template-lint": "^6.0.0",
"ember-try": "^3.0.0",
"eslint": "^8.55.0",
"eslint-plugin-n": "^16.4.0",
"eslint": "^8.57.0",
"eslint-plugin-n": "^16.6.2",
"loader.js": "^4.7.0",
"prettier": "^3.1.1",
"qunit": "^2.20.0",
"qunit-dom": "^3.0.0",
"release-it": "^17.0.1",
"stylelint": "^15.11.0",
"webpack": "^5.89.0"
"prettier": "^3.3.3",
"qunit": "^2.22.0",
"qunit-dom": "^3.2.0",
"release-it": "^17.6.0",
"stylelint": "^16.9.0",
"webpack": "^5.94.0"
},
"directories": {
"doc": "doc",
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/app/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class ApplicationController extends Controller {
dateOfBirth() {
return [
present(),
date({ format: 'dd/MM/yy', message: 'Invalid date expecting dd/mm/yy' })
date({ format: 'P', message: 'Invalid date expecting dd/mm/yy' })
];
},
terms() {
Expand Down
8 changes: 8 additions & 0 deletions tests/dummy/app/helpers/set.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default function set(object, key) {
return (event) => {
object[key] =
event.target.getAttribute('type') === 'checkbox'
? event.target.checked
: event.target.value;
};
}
36 changes: 23 additions & 13 deletions tests/dummy/app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{! template-lint-disable no-action-on-submit-button }}

<h1>
@zestia/ember-validation
</h1>
Expand All @@ -23,41 +25,48 @@
</legend>

<p>
<Input
@type="text"
@value={{this.person.name}}
<input
type="text"
value={{this.person.name}}
placeholder="Name"
aria-label="Name"
{{on "change" (set this.person "name")}}
/>
</p>
<Errors @errors={{this.personErrors.name}} />

<p>
{{this.errors.person.emailAddress}}
<Input
@type="email"
@value={{this.person.emailAddress}}
<input
type="email"
value={{this.person.emailAddress}}
placeholder="Email address"
aria-label="Email address"
{{on "change" (set this.person "emailAddress")}}
/>
</p>
<Errors @errors={{this.personErrors.emailAddress}} />

<p>
{{this.errors.person.dateOfBirth}}
<Input
@type="text"
@value={{this.person.dateOfBirth}}
<input
type="text"
value={{this.person.dateOfBirth}}
placeholder="Date of birth"
aria-label="Date of birth"
{{on "change" (set this.person "dateOfBirth")}}
/>
</p>
<Errors @errors={{this.personErrors.dateOfBirth}} />

<p>
{{this.errors.person.terms}}
<label>
<Input @type="checkbox" @checked={{this.person.terms}} />
<input
type="checkbox"
checked={{this.person.terms}}
{{on "change" (set this.person "terms")}}
/>
Agree to terms
</label>
</p>
Expand Down Expand Up @@ -99,11 +108,12 @@
</legend>

<p>
<Input
@type="text"
@value={{meal.description}}
<input
type="text"
value={{meal.description}}
placeholder="Description"
aria-label="Description"
{{on "change" (set meal "description")}}
/>
</p>
<Errors @errors={{get (get this.mealErrors index) "description"}} />
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/config/ember-cli-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packages": [
{
"name": "ember-cli",
"version": "5.5.0",
"version": "5.11.0",
"blueprints": [
{
"name": "addon",
Expand Down
8 changes: 4 additions & 4 deletions tests/dummy/config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ module.exports = async function () {
return {
scenarios: [
{
name: 'ember-lts-4.8',
name: 'ember-lts-4.12',
npm: {
devDependencies: {
'ember-source': '~4.8.0'
'ember-source': '~4.12.0'
}
}
},
{
name: 'ember-lts-4.12',
name: 'ember-lts-5.4',
npm: {
devDependencies: {
'ember-source': '~4.12.0'
'ember-source': '~5.4.0'
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function setupApplicationTest(hooks, options) {
// This is also a good place to call test setup functions coming
// from other addons:
//
// setupIntl(hooks); // ember-intl
// setupIntl(hooks, 'en-us'); // ember-intl
// setupMirage(hooks); // ember-cli-mirage
}

Expand Down
13 changes: 11 additions & 2 deletions tests/unit/constraints/date-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { setupTest } from 'dummy/tests/helpers';
import { setMessageFn } from '@zestia/ember-validation';
import { testMessageFn, defaultMessageFn } from 'dummy/tests/unit/helper';
import { date } from '@zestia/ember-validation/constraints';
import enGB from 'date-fns/locale/en-GB';
import enUS from 'date-fns/locale/en-US';
import { enGB } from 'date-fns/locale/en-GB';
import { enUS } from 'date-fns/locale/en-US';

module('date', function (hooks) {
setupTest(hooks);
Expand All @@ -19,6 +19,15 @@ module('date', function (hooks) {
assert.strictEqual(date({ format: 'dd/MM/yyyy' })('25/12/2020'), undefined);
});

test('empty values', function (assert) {
assert.expect(1);

assert.strictEqual(
date({ format: 'dd/MM/yyyy' })(),
'Invalid date, expecting dd/MM/yyyy'
);
});

test('it returns default message if invalid', function (assert) {
assert.expect(1);

Expand Down
10 changes: 0 additions & 10 deletions tsconfig.declarations.json

This file was deleted.

0 comments on commit b489e3d

Please sign in to comment.