fix(core): fix decorator defalut values
This commit is contained in:

committed by
Igor Minar

parent
3993279527
commit
bd1dcb5f11
@ -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', () => {
|
||||
|
Reference in New Issue
Block a user