diff --git a/build/rollup.config.bundle.js b/build/rollup.config.bundle.js index 6bb01ca86d..7e1b038541 100644 --- a/build/rollup.config.bundle.js +++ b/build/rollup.config.bundle.js @@ -6,7 +6,7 @@ import css from 'rollup-plugin-css-only' import { terser } from 'rollup-plugin-terser' import typescript from 'rollup-plugin-typescript2' import pkg from '../package.json' - +const deps = Object.keys(pkg.dependencies) // eslint-disable-next-line @typescript-eslint/no-var-requires const vue = require('./plugin.js') @@ -43,7 +43,7 @@ export default [ ], external(id) { return /^vue/.test(id) - || Object.keys(pkg.dependencies).some(k => new RegExp('^' + k).test(id)) + || deps.some(k => new RegExp('^' + k).test(id)) }, }, ] diff --git a/build/rollup.config.js b/build/rollup.config.js index 97c39db5e9..c82c4820b3 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -10,7 +10,7 @@ import { nodeResolve } from '@rollup/plugin-node-resolve' import path from 'path' import { getPackagesSync } from '@lerna/project' import pkg from '../package.json' - +const deps = Object.keys(pkg.dependencies) // eslint-disable-next-line @typescript-eslint/no-var-requires const vue = require('./plugin.js') const inputs = getPackagesSync() @@ -64,6 +64,6 @@ export default inputs.map(name => ({ external(id) { return /^vue/.test(id) || /^@element-plus/.test(id) - || Object.keys(pkg.dependencies).some(k => new RegExp('^' + k).test(id)) + || deps.some(k => new RegExp('^' + k).test(id)) }, })) diff --git a/packages/dropdown/__tests__/dropdown.spec.tsx b/packages/dropdown/__tests__/dropdown.spec.tsx index b6ef413657..1ea508e5d8 100644 --- a/packages/dropdown/__tests__/dropdown.spec.tsx +++ b/packages/dropdown/__tests__/dropdown.spec.tsx @@ -50,9 +50,11 @@ describe('Dropdown', () => { ) } }) - const content = wrapper.findComponent({ ref: 'b' }).vm.$refs.popper as any + const content = wrapper.findComponent({ ref: 'b' }).vm as any const triggerElm = wrapper.find('.el-dropdown-link') expect(content.visible).toBe(false) + await triggerElm.trigger('keydown') + await triggerElm.trigger('focus') await triggerElm.trigger(MOUSE_ENTER_EVENT) await sleep(TIMEOUT) expect(content.visible).toBe(true) @@ -91,7 +93,7 @@ describe('Dropdown', () => { }, }, ) - // const content = wrapper.findComponent({ ref: 'b' }).vm.$refs.popper as any + // const content = wrapper.findComponent({ ref: 'b' }).vm as any const triggerElm = wrapper.find('.el-dropdown-link') await triggerElm.trigger(MOUSE_ENTER_EVENT) await sleep(TIMEOUT) @@ -123,7 +125,7 @@ describe('Dropdown', () => { name: '', }), ) - const content = wrapper.findComponent({ ref: 'b' }).vm.$refs.popper as any + const content = wrapper.findComponent({ ref: 'b' }).vm as any const triggerElm = wrapper.find('.el-dropdown-link') expect(content.visible).toBe(false) await triggerElm.trigger(MOUSE_ENTER_EVENT) @@ -162,12 +164,14 @@ describe('Dropdown', () => { }, }, ) - const content = wrapper.findComponent({ ref: 'b' }).vm.$refs.popper as any + const content = wrapper.findComponent({ ref: 'b' }).vm as any const triggerElm = wrapper.find('.el-dropdown__caret-button') const button = wrapper.find('.el-button') expect(content.visible).toBe(false) await button.trigger('click') expect((wrapper.vm as any).name).toBe('click') + await triggerElm.trigger('keydown') + await triggerElm.trigger('focus') await triggerElm.trigger(MOUSE_ENTER_EVENT) await sleep(TIMEOUT) expect(content.visible).toBe(true) @@ -194,8 +198,10 @@ describe('Dropdown', () => { () => ({}), ) - const content = wrapper.findComponent({ ref: 'b' }).vm.$refs.popper as any + const content = wrapper.findComponent({ ref: 'b' }).vm as any const triggerElm = wrapper.find('.el-dropdown-link') + await triggerElm.trigger('keydown') + await triggerElm.trigger('focus') await triggerElm.trigger(MOUSE_ENTER_EVENT) await sleep(TIMEOUT) await wrapper.findComponent({ ref: 'c' }).trigger('click') @@ -224,8 +230,10 @@ describe('Dropdown', () => { () => ({}), ) - const content = wrapper.findComponent({ ref: 'b' }).vm.$refs.popper as any + const content = wrapper.findComponent({ ref: 'b' }).vm as any const triggerElm = wrapper.find('.el-dropdown-link') + await triggerElm.trigger('keydown') + await triggerElm.trigger('focus') await triggerElm.trigger(MOUSE_ENTER_EVENT) await sleep(TIMEOUT) await triggerElm.trigger('keydown', { diff --git a/packages/dropdown/src/dropdown-menu.vue b/packages/dropdown/src/dropdown-menu.vue index a91ed78863..90391d79af 100644 --- a/packages/dropdown/src/dropdown-menu.vue +++ b/packages/dropdown/src/dropdown-menu.vue @@ -1,5 +1,6 @@