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:
basti committed 2019-12-10 13:18:21 +03:00
1 parent 23d86f1502
commit 863b542e3e
1 file changed
+18 -1
+18 -1
View File
@@ -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');
});
});