Skip to content
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

[gh-59] implement unit tests for vue3 component #74

Merged
merged 7 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"dev": "vite --port 8081",
"dev:rebuild": "yarn run dev --force",
"format": "yarn run prettier --ignore-path ../../.gitignore --write",
"test": "yarn vitest run",
"test:watch": "yarn vitest --ui --open false",
"preversion": "npm run build"
},
"dependencies": {
Expand All @@ -44,8 +46,11 @@
"@rollup/plugin-babel": "5.3.1",
"@rollup/plugin-commonjs": "22.0.1",
"@rollup/plugin-node-resolve": "13.3.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/vue": "^6.6.1",
"@types/jest": "26.0.23",
"@vitejs/plugin-vue": "2.3.3",
"@vitest/ui": "^0.18.1",
"@vue/compiler-sfc": "3.2.37",
"autoprefixer": "10.4.7",
"jest": "26.6.3",
Expand All @@ -61,6 +66,7 @@
"ts-jest": "26.5.4",
"typescript": "4.7.4",
"vite": "2.9.13",
"vitest": "^0.18.1",
"vue": "3.2.37"
},
"peerDependencies": {
Expand Down
11 changes: 8 additions & 3 deletions packages/vue3/src/VueVisualFilter/FilterCondition.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default {
<select
v-model="condition.fieldName"
@change="updateField($event.target.value)"
data-testId="field-name-select"
>
<option v-for="field in fieldNames" :key="field" :value="field">
{{ field }}
Expand All @@ -60,7 +61,7 @@ export default {
condition,
}"
>
<select v-model="condition.method">
<select v-model="condition.method" data-testId="method-select">
<option
v-for="method in isNumeric ? numericMethodNames : nominalMethodNames"
:key="method"
Expand All @@ -71,13 +72,17 @@ export default {
</select>
</slot>
<slot name="argumentUpdation" :condition="condition">
<input type="text" v-model="condition.argument" />
<input
type="text"
v-model="condition.argument"
data-testId="argument-input"
/>
</slot>
<slot
name="conditionDeletion"
:deleteCondition="() => $emit('deleteCondition', condition)"
>
<button @click="$emit('deleteCondition', condition)">x</button>
<button @click="$emit('deleteCondition', condition)" data-testId="remove-condition-button">x</button>
</slot>
</div>
</template>
9 changes: 6 additions & 3 deletions packages/vue3/src/VueVisualFilter/FilterGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ export default {
<div class="space-y-4">
<div class="space-x-2">
<slot name="groupTypes" v-bind="{ groupTypes, group }">
<select v-model="group.groupType">
<select v-model="group.groupType" data-testId="group-type-select">
<option v-for="type in groupTypes" :key="type" :value="type">
{{ type }}
</option>
</select>
</slot>
<slot name="filterAddition" v-bind="{ filterTypes, addFilter }">
<select @change="addFilter($event.target.value)">
<select
@change="addFilter($event.target.value)"
data-testId="filter-type-select"
>
<option v-for="type in filterTypes" :key="type" :value="type">
{{ type }}
</option>
Expand All @@ -55,7 +58,7 @@ export default {
name="groupDeletion"
:deleteGroup="() => $emit('deleteGroup', group)"
>
<button @click="$emit('deleteGroup', group)">x</button>
<button @click="$emit('deleteGroup', group)" data-testId="remove-group-button">x</button>
</slot>
</div>
<div v-if="group.filters.length" class="ml-10 space-y-1">
Expand Down
Loading