-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
v_huyilin
committed
Nov 28, 2024
1 parent
9193f9a
commit 0920773
Showing
10 changed files
with
101 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { expect, describe, it } from 'vitest' | ||
import { configTest } from '@vue-form-craft/utils' | ||
import { flushPromises, mount } from '@vue/test-utils' | ||
import formRender from '@vue-form-craft/form-render' | ||
import schema from '../satisfaction' | ||
import { nextTick } from 'vue' | ||
|
||
configTest() | ||
|
||
describe('template satisfaction', async () => { | ||
it('linkage: satisfaction.value > 3 && improvementSuggestions hidden', async () => { | ||
const wrapper = mount(formRender, { | ||
props: { | ||
schema | ||
} | ||
}) | ||
await nextTick() | ||
await flushPromises() | ||
|
||
await new Promise((resolve) => setTimeout(resolve, 100)) | ||
|
||
const satisfactionEl = wrapper.findAll('.Radio-satisfaction .el-radio__original') | ||
|
||
await satisfactionEl[0].setValue(true) | ||
|
||
await new Promise((resolve) => setTimeout(resolve, 100)) | ||
|
||
expect(wrapper.find('.TextArea-improvementSuggestions').exists()).toBe(false) | ||
}) | ||
|
||
it('linkage: satisfaction.value < 3 && improvementSuggestions visible', async () => { | ||
const wrapper = mount(formRender, { | ||
props: { | ||
schema | ||
} | ||
}) | ||
await nextTick() | ||
await flushPromises() | ||
|
||
await new Promise((resolve) => setTimeout(resolve, 100)) | ||
|
||
const satisfactionEl = wrapper.findAll('.Radio-satisfaction .el-radio__original') | ||
|
||
await satisfactionEl[satisfactionEl.length - 1].setValue(true) | ||
|
||
await new Promise((resolve) => setTimeout(resolve, 100)) | ||
|
||
expect(wrapper.find('.TextArea-improvementSuggestions').exists()).toBe(true) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { defineConfig } from 'vitest/config' | ||
import rootConfig from '../../vitest.config' | ||
|
||
export default defineConfig({ | ||
...rootConfig | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { config } from '@vue/test-utils' | ||
import ElementPlus from 'element-plus' | ||
import { $options } from '@vue-form-craft/config' | ||
|
||
export default () => { | ||
config.global.plugins = [ElementPlus] | ||
config.global.provide = { | ||
[$options]: { | ||
lang: 'zh' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters