-
Notifications
You must be signed in to change notification settings - Fork 433
bugfix: collect decorated class properties #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,48 @@ describe('vue-class-component', () => { | |
expect(c.b).to.equal(2) | ||
}) | ||
|
||
it('data: should collect from decorated class properties', () => { | ||
|
||
const decorator1 = (value: any) => (_: any, __:any ): any => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use more descriptive name like |
||
return { | ||
enumerable: true, | ||
value | ||
} | ||
} | ||
|
||
const decorator2 = (value: any) => (_: any, __:any ): any => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Please fix the position of space. (add a space after second colon and remove the space before closing brace) |
||
return { | ||
enumerable: true, | ||
get() { | ||
return value; | ||
} | ||
} | ||
} | ||
|
||
@Component({ | ||
props: ['foo'] | ||
}) | ||
class MyComp extends Vue { | ||
|
||
@decorator1('field1') | ||
field1!: string | ||
|
||
@decorator2('field2') | ||
field2!: string | ||
|
||
foo!: number | ||
} | ||
|
||
const c = new MyComp({ | ||
propsData: { | ||
foo: 1 | ||
} | ||
}) | ||
expect(c.field1).to.equal('field1') | ||
expect(c.field2).to.equal('field2') | ||
expect(c.foo).to.equal(1) | ||
}) | ||
|
||
it('data: should collect custom property defined on beforeCreate', () => { | ||
@Component | ||
class MyComp extends Vue { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this prop to only focus what we want to test in this block?