-
-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update to 3.1 and fix ObjectProxy extends validations bug (#586)
* update to 3.1 and fix ObjectProxy extends validations bug touch up * get/set touch up
- Loading branch information
1 parent
580cced
commit d4e720d
Showing
5 changed files
with
421 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import ObjectProxy from '@ember/object/proxy'; | ||
import { run } from '@ember/runloop'; | ||
import { module, test } from 'qunit'; | ||
import { setupTest } from 'ember-qunit'; | ||
import { Validations } from 'dummy/models/company'; | ||
|
||
module('Unit | Validations | Ember ObjectProxy', function(hooks) { | ||
setupTest(hooks); | ||
|
||
test('extend ObjectProxy with validations', function(assert) { | ||
run(() => { | ||
let company = this.owner.lookup('service:store').createRecord('company'); | ||
|
||
const container = this.owner.ownerInjection(); | ||
const proxy = ObjectProxy.extend(Validations).create(container, { | ||
content: company | ||
}); | ||
|
||
assert.notOk(proxy.get('validations.isValid')); | ||
assert.notOk(company.get('validations.isValid')); | ||
|
||
proxy.set('name', 'whatever'); | ||
|
||
assert.ok(proxy.get('validations.isValid')); | ||
assert.ok(company.get('validations.isValid')); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.