From a8633abb9b64a35153621c8106526aeb0fd506d0 Mon Sep 17 00:00:00 2001 From: songjianet <1778651752@qq.com> Date: Fri, 17 Sep 2021 09:02:58 +0800 Subject: [PATCH] test(backtop): Add backtop component test (#1188) * test(backtop): Add backtop component test * test(backtop): Update backtop component test --- src/back-top/tests/BackTop.spec.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/back-top/tests/BackTop.spec.ts b/src/back-top/tests/BackTop.spec.ts index 6f15d33cf..85d9da417 100644 --- a/src/back-top/tests/BackTop.spec.ts +++ b/src/back-top/tests/BackTop.spec.ts @@ -5,4 +5,21 @@ describe('n-back-top', () => { it('should work with import on demand', () => { mount(NBackTop) }) + + it('should work with `show` prop', async () => { + document.body.innerHTML = ` +
+ ` + + const wrapper = mount(NBackTop, { + attachTo: document.getElementById('test'), + props: { + show: true + } + }) + + wrapper.element.scrollTop = 1000 + await wrapper.trigger('scroll') + expect(wrapper.html()).toContain('teleport start') + }) })