fix(core): fix decorator defalut values

This commit is contained in:
Victor Berchet
2016-10-11 20:16:39 -07:00
committed by Igor Minar
parent 3993279527
commit bd1dcb5f11
2 changed files with 17 additions and 6 deletions

View File

@ -35,6 +35,18 @@ export function main() {
const p = reflector.propMetadata(TestClass);
expect(p['watch']).toEqual([new Prop('firefox!')]);
});
it('should work with any default plain values', () => {
const Default = makePropDecorator('Default', [['value', 5]]);
expect(new Default(0)['value']).toEqual(0);
});
it('should work with any object values', () => {
// make sure we don't walk up the prototype chain
const Default = makePropDecorator('Default', [{value: 5}]);
const value = Object.create({value: 10});
expect(new Default(value)['value']).toEqual(5);
});
});
describe('decorators', () => {