I'm trying to use the Ember Validations addon and I can't get it working. In the Chrome console, I see: WARNING: Could not find the "presence" validator.
Here is my model:
import Ember from 'ember';
import DS from 'ember-data';
import EmberValidations from 'ember-validations';
export default DS.Model.extend(EmberValidations.Mixin, {
name: DS.attr('string'),
validations: {
name: {
presence: true
}
}
});
And here is the my test:
test('isValid is false if name is not set', function(assert) {
stop();
var model = this.subject();
Ember.run(function() {
model.validate().then(function() {
assert.equal(model.get('isValid'), false);
start();
});
});
});
The result of this test is "expected false but got true". Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire