Skip to content

Commit

Permalink
Test PropSync and Model decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo930021 committed Aug 14, 2020
1 parent 0142a37 commit 4278488
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 20 deletions.
49 changes: 29 additions & 20 deletions test/interpolation/features/completion/property.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,39 @@ describe('Should autocomplete interpolation for <template> in property class com
]);
});

const propsList = [
{
label: ':foo',
kind: CompletionItemKind.Value,
documentation: new MarkdownString('My foo').appendCodeblock(
`@Prop({ type: Boolean, default: false }) foo`,
'js'
)
},
{
label: ':bar',
kind: CompletionItemKind.Value,
documentation: new MarkdownString('My bar').appendCodeblock(
`@PropSync('bar', { type: String }) syncedBar`,
'js'
)
},
{
label: ':checked',
kind: CompletionItemKind.Value,
documentation: new MarkdownString('My checked').appendCodeblock(
`@Model('change', { type: Boolean }) checked`,
'js'
)
}
];

it(`completes child component's props`, async () => {
await testCompletion(parentTemplateDocUri, position(2, 27), [
{
label: ':foo',
kind: CompletionItemKind.Value,
documentation: new MarkdownString('My foo').appendCodeblock(
`@Prop({ type: Boolean, default: false }) foo`,
'js'
)
}
]);
await testCompletion(parentTemplateDocUri, position(2, 27), propsList);
});

it(`completes child component's props when camel case component name`, async () => {
await testCompletion(parentTemplateDocUri, position(4, 24), [
{
label: ':foo',
kind: CompletionItemKind.Value,
documentation: new MarkdownString('My foo').appendCodeblock(
`@Prop({ type: Boolean, default: false }) foo`,
'js'
)
}
]);
await testCompletion(parentTemplateDocUri, position(4, 24), propsList);
});

it('completes inside v-if=""', async () => {
Expand Down
10 changes: 10 additions & 0 deletions test/interpolation/fixture/completion/propertyDecorator/Child.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ export default class BasicPropertyClass extends Vue {
*/
@Prop({ type: Boolean, default: false }) foo
/**
* My bar
*/
@PropSync('bar', { type: String }) syncedBar
/**
* My checked
*/
@Model('change', { type: Boolean }) checked
/**
* My msg
*/
Expand Down

0 comments on commit 4278488

Please sign in to comment.