From c366a5ee3aedfce6049fc1acd3638ce437a8cfca Mon Sep 17 00:00:00 2001 From: UOrb <798008773@qq.com> Date: Sun, 31 Jan 2021 11:38:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=20table=20=E7=9A=84?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/unit/menus/table/tooltip-event.test.ts | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/test/unit/menus/table/tooltip-event.test.ts b/test/unit/menus/table/tooltip-event.test.ts index 38352af..778feb7 100644 --- a/test/unit/menus/table/tooltip-event.test.ts +++ b/test/unit/menus/table/tooltip-event.test.ts @@ -32,17 +32,14 @@ const showTooltip = (editorId: string) => { fn(fakeDom) }) } +const editor = createEditor(document, 'div1') describe('Table Tooltip Event', () => { test('创建编辑器表格菜单会绑定 tooltip event', () => { - const editor = createEditor(document, 'div1') - expect(editor.txt.eventHooks.tableClickEvents.length).toBeGreaterThanOrEqual(1) }) test('执行 tooltip event 函数会展示 table tooltip', () => { - const editor = createEditor(document, 'div2') - const fns = editor.txt.eventHooks.tableClickEvents const fakeDom = $('

') document.body.appendChild(fakeDom.elems[0]) @@ -56,17 +53,7 @@ describe('Table Tooltip Event', () => { }) test('展示 table tooltip 后,点击其它地方会隐藏 tooltip', () => { - const editor = createEditor(document, 'div3') - - const fns = editor.txt.eventHooks.tableClickEvents - const fakeDom = $('

') - document.body.appendChild(fakeDom.elems[0]) - - fns.forEach(fn => { - fn(fakeDom) - }) - - $('#div3').elems[0].click() + editor.$textElem.elems[0].click() const tooltip = $('.w-e-tooltip') expect(tooltip.elems.length).toEqual(0)