Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade ember changeset to v3 #19

Merged
merged 4 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:

# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
- env: EMBER_TRY_SCENARIO=ember-3.13
- env: EMBER_TRY_SCENARIO=ember-lts-3.16
- env: EMBER_TRY_SCENARIO=ember-release
- env: EMBER_TRY_SCENARIO=ember-beta
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Compatibility

* Ember Bootstrap v3
* Ember Changeset and Ember Changeset Validations v2
* Ember.js v3.13 or above
* Ember.js v3.16 or above
* Ember CLI v2.13 or above
* Node.js v10 or above

Expand Down
10 changes: 8 additions & 2 deletions addon/components/bs-form/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ import { A } from '@ember/array';
import BsFormElement from 'ember-bootstrap/components/bs-form/element';

export default BsFormElement.extend({

hasValidator: notEmpty('model.validate'),

setupValidations() {
// `Changeset.error` is a getter based on a tracked property. Since it's a
// derived state it's not working together with computed properties smoothly.
// As a work-a-round we observe the `Changeset._errors` computed property
// directly, which holds the state. This is not optimal cause it's private.
// Should refactor to native getter as soon as `<FormElement>` component
// of Ember Bootstrap supports native getters for `FormElement.errors`
// property.
let key = `model.error.${this.get('property')}.validation`;
defineProperty(this, 'errors', computed(`${key}[]`, function() {
defineProperty(this, 'errors', computed(`model._errors`, function() {
return A(this.get(key));
}));
}
Expand Down
8 changes: 0 additions & 8 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ module.exports = async function() {
return {
useYarn: true,
scenarios: [
{
name: 'ember-3.13',
npm: {
devDependencies: {
'ember-source': '~3.13.0'
}
}
},
{
name: 'ember-lts-3.16',
npm: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"test:all": "ember try:each"
},
"dependencies": {
"ember-changeset-validations": "^2.1.0",
"ember-changeset-validations": "^3.0.0",
"ember-cli-babel": "^7.17.2",
"ember-cli-htmlbars": "^4.2.2"
},
Expand Down
Loading