-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Duncan Graham Walker
committed
Mar 7, 2016
1 parent
3921fdd
commit dcb5322
Showing
3 changed files
with
50 additions
and
73 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
49 changes: 42 additions & 7 deletions
49
tests/unit/mixins/components/conditional-validations-test.js
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 |
---|---|---|
@@ -1,12 +1,47 @@ | ||
import Ember from 'ember'; | ||
import ControllersConditionalValidationsMixin from 'ember-easy-form-extensions/mixins/components/conditional-validations'; | ||
import ComponentsConditionalValidationsMixin from 'ember-easy-form-extensions/mixins/components/conditional-validations'; | ||
import ComponentsFormMixin from 'ember-easy-form-extensions/mixins/components/form'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Unit | Mixin | controllers/conditional validations'); | ||
let subject; | ||
|
||
module('Unit | Mixin | components/conditional validations', { | ||
|
||
beforeEach() { | ||
const ComponentsConditionalValidationsObject = Ember.Object.extend( | ||
ComponentsFormMixin, | ||
ComponentsConditionalValidationsMixin, { | ||
|
||
bananas: null, | ||
revalidateFor: ['bananas'], | ||
}); | ||
|
||
subject = ComponentsConditionalValidationsObject.create(); | ||
}, | ||
|
||
}); | ||
|
||
test('Calls to validate', function(assert) { | ||
const done = assert.async(); | ||
|
||
assert.expect(3); | ||
|
||
subject.validate = function() { | ||
assert.ok(true, 'Validate should be called when bananas changes'); | ||
} | ||
|
||
assert.ok(subject.hasObserverFor('bananas'), 'Should add observers on init'); | ||
|
||
subject.set('bananas', true); | ||
|
||
Ember.run(this, function() { | ||
subject.destroy(); | ||
|
||
|
||
Ember.run.next(this, function() { | ||
assert.notOk(subject.hasObserverFor('bananas'), 'Should remove observers on destroy'); | ||
done(); | ||
}); | ||
}); | ||
|
||
// Replace this with your real tests. | ||
test('it works', function(assert) { | ||
let ControllersConditionalValidationsObject = Ember.Object.extend(ControllersConditionalValidationsMixin); | ||
let subject = ControllersConditionalValidationsObject.create(); | ||
assert.ok(subject); | ||
}); |
62 changes: 0 additions & 62 deletions
62
tests/unit/mixins/old-controllers/conditional-validations-test.js
This file was deleted.
Oops, something went wrong.