From 14bd5f03f202d7ea32aeea6aeed5fffcc647ed65 Mon Sep 17 00:00:00 2001 From: Liberty Date: Fri, 18 Aug 2023 19:31:39 +0800 Subject: [PATCH] test(erFormConfig): root:pc|Root:mobile --- .../Config/components/GlobalConfigPanel.vue | 21 ++++++++++++------- test/erFormConfig.test.js | 20 ++++++++++++++---- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/packages/formEditor/components/Panels/Config/components/GlobalConfigPanel.vue b/packages/formEditor/components/Panels/Config/components/GlobalConfigPanel.vue index 57e5be9..2e08b8d 100644 --- a/packages/formEditor/components/Panels/Config/components/GlobalConfigPanel.vue +++ b/packages/formEditor/components/Panels/Config/components/GlobalConfigPanel.vue @@ -8,6 +8,7 @@ import { ClickOutside as vClickOutside } from 'element-plus' import CompleteButton from '@ER/formEditor/components/CompleteButton.vue' import PanelsConfigComponentsTypeComponent from './TypeComponent.vue' import PanelsConfigComponentsLogicComponent from './LogicComponent.vue' +import utils from '@ER/utils' export default { name: 'GlobalConfigPanel', inheritAttrs: false, @@ -41,7 +42,6 @@ const popperPaneRef = computed(() => { }) let handleConfirm = '' const handleBeforeChange = () => { - // visible.value = true return new Promise((resolve, reject) => { const pcObj = _.pick(unref(target).pc, compareKeys) const mobileObj = _.pick(unref(target).mobile, compareKeys) @@ -86,10 +86,6 @@ const options0 = computed(() => { } ] }) - -// {{t('er.config.globalConfig.componentSize.large')}} -// {{t('er.config.globalConfig.componentSize.default')}} -// {{t('er.config.globalConfig.componentSize.small')}} const options1 = computed(() => { return [ { @@ -152,8 +148,11 @@ const handleTypeListener = ({ property, data }) => { - - + { :label="t('er.config.globalConfig.componentSize.label')" :val="target[state.platform].size" :nodes="options1" + v-bind="utils.addTestId('configPanel:size')" /> { :fontSize="80" :val="target[state.platform].labelPosition" :nodes="options0" + v-bind="utils.addTestId('configPanel:labelPosition')" /> - +
diff --git a/test/erFormConfig.test.js b/test/erFormConfig.test.js index 53fa493..b5f3ce3 100644 --- a/test/erFormConfig.test.js +++ b/test/erFormConfig.test.js @@ -95,10 +95,22 @@ describe('Configuration options owned by the config panel', () => { afterEach(() => { wrapper.findComponent({ ref: 'EReditorRef' }).vm.switchPlatform('pc') }) - test('Root', () => { - // console.log(wrapper.html()) - // console.log(erGeneratorData(erComponentsConfig.fieldsConfig[0].list[0], true, 'en')) - // expect(erGeneratorData(erComponentsConfig.fieldsConfig[0].list[0], true, 'en')).toMatchSnapshot() + test('Root:pc', async () => { + value0.value = 'root' + await nextTick() + expect(wrapper.find(utils.getTestId('configPanel:isSync')).exists()).toBe(true) + expect(wrapper.find(utils.getTestId('configPanel:size')).exists()).toBe(true) + expect(wrapper.find(utils.getTestId('configPanel:labelPosition')).exists()).toBe(true) + expect(wrapper.find(utils.getTestId('configPanel:completeButton')).exists()).toBe(true) + }) + test('Root:mobile', async () => { + value0.value = 'root' + wrapper.findComponent({ ref: 'EReditorRef' }).vm.switchPlatform('mobile') + await nextTick() + expect(wrapper.find(utils.getTestId('configPanel:isSync')).exists()).toBe(true) + expect(wrapper.find(utils.getTestId('configPanel:size')).exists()).toBe(false) + expect(wrapper.find(utils.getTestId('configPanel:labelPosition')).exists()).toBe(true) + expect(wrapper.find(utils.getTestId('configPanel:completeButton')).exists()).toBe(true) }) test('Email:pc', async () => { value0.value = store.fields[0].id