Skip to content

Commit

Permalink
Add test for vuejs#2236
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo930021 committed Sep 4, 2020
1 parent f22f8c7 commit cc457be
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import * as vscode from 'vscode';
import { testDiagnostics } from '../../../diagnosticHelper';
import { testDiagnostics, testNoDiagnostics } from '../../../diagnosticHelper';
import { getDocUri } from '../../path';
import { sameLineRange } from '../../../util';

describe('Should find common diagnostics for all regions', () => {
const parentUri = getDocUri('diagnostics/propsValidation/parent.vue');
const passParentUri = getDocUri('diagnostics/propsValidation/pass-parent.vue');

it('shows warnings for passing wrong props to child component when using array props', async () => {
const expectedDiagnostics: vscode.Diagnostic[] = [
Expand Down Expand Up @@ -108,4 +109,8 @@ describe('Should find common diagnostics for all regions', () => {

await testDiagnostics(parentUri, expectedDiagnostics);
});

it('shows no diagnostics error for prop validator', async () => {
await testNoDiagnostics(passParentUri);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
<div>
<array-child :foo="foo" :bar="bar" :bAz="bar"></array-child>
<array-child :foo="foo" :bar="bar" :b-az="bar"></array-child>
<class-child v-bind="{}" />
<class-child v-bind:[bar]="{}" />
<class-child :[bar]="{}" />
</div>
</template>


<script>
import ArrayChild from './array-props-child.vue'
import SimpleValidatorChild from './simple-validator-props-child.vue'
import ObjectValidatorChild from './object-validator-props-child.vue'
import ClassChild from './class-child.vue'
export default {
components: {
ArrayChild,
SimpleValidatorChild,
ObjectValidatorChild,
ClassChild
},
props: ['foo', 'bar']
}
</script>

0 comments on commit cc457be

Please sign in to comment.