Add failing test for partial attribute override
Currently the default attributes are only set correctly when either none or all attributes are handed to the component
This commit is contained in:
@@ -18,7 +18,24 @@ module('Unit | Component | add-contribution', function(hooks) {
|
||||
assert.equal(component.get(a), null, `sets the ${a} property`);
|
||||
});
|
||||
|
||||
assert.ok(moment.isDate(component.attributes.date, 'sets the default date attribute'));
|
||||
assert.ok(moment.isDate(component.attributes.date), 'sets the default date attribute');
|
||||
assert.ok(moment.isDate(component.date), 'sets the default date');
|
||||
});
|
||||
|
||||
test('override default attributes', function(assert) {
|
||||
let component = this.owner.factoryFor('component:add-contribution').create({
|
||||
attributes: { contributorId: '1' }
|
||||
});
|
||||
|
||||
assert.equal(component.contributorId, '1', `overrides the default property`);
|
||||
|
||||
['kind', 'amount', 'description', 'url', 'details'].forEach(a => {
|
||||
assert.equal(component.attributes[a], null, `sets the default ${a} attribute`);
|
||||
assert.equal(component.get(a), null, `sets the ${a} property`);
|
||||
});
|
||||
|
||||
assert.ok(moment.isDate(component.attributes.date), 'sets the default date attribute');
|
||||
assert.ok(moment.isDate(component.date), 'sets the default date');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user