')
+ expect(wrapper.html()).toContain('')
+ expect(wrapper.html()).toContain('')
+ })
+})
From a44d5e7ced019b4d29340f7ef3705d66639b21c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Thu, 3 Jan 2019 22:04:47 +0800
Subject: [PATCH 02/17] unit test: d2-container-card
Former-commit-id: 5abbbe5737fa5631e54487f2865ad24996ec4492 [formerly 5abbbe5737fa5631e54487f2865ad24996ec4492 [formerly 5abbbe5737fa5631e54487f2865ad24996ec4492 [formerly 5abbbe5737fa5631e54487f2865ad24996ec4492 [formerly ee3f9fce323e3c21d783e2d7af9bed417332098b [formerly ff6e8fa5a3e38a322222e98f6cd20a859525eb53]]]]]
Former-commit-id: f774b7359acad14dee74555f5a4d0a146f14e868
Former-commit-id: fcd60c3176f9d5f3031769e8adbb2f4a47b1e599
Former-commit-id: 511135e8df3aedbfafa0d3344cbe051a0336eded [formerly 96c89ae1f8e9559d26995e56935c74463ceba24a]
Former-commit-id: eb14254f528e44609508c890270bb266108419de
Former-commit-id: 2e6583560fe3ce08c8d10e0aed968e38558792c2
Former-commit-id: bc6cb9d353483861ff6f8495d2508d8354fe7c5a
Former-commit-id: 5daa32a7a404d9a07e07ad6f006c0f9fd6e8e3dd
Former-commit-id: c38397ee38475bfefe5c846e6b39ece26c479897
---
tests/unit/d2-container-card.spec.js | 4 ----
1 file changed, 4 deletions(-)
diff --git a/tests/unit/d2-container-card.spec.js b/tests/unit/d2-container-card.spec.js
index dee9d887..8b298425 100644
--- a/tests/unit/d2-container-card.spec.js
+++ b/tests/unit/d2-container-card.spec.js
@@ -1,7 +1,3 @@
-// 暂时 D2 没有单元测试代码 此文件为自动生成
-
-// import { shallowMount } from '@vue/test-utils'
-// import HelloWorld from '@/components/HelloWorld.vue'
import { mount } from '@vue/test-utils'
import D2ContainerCard from '@/components/d2-container/components/d2-container-card.vue'
From 55c2fc3dc20ad25f88601d10a7249f312ad3458c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Fri, 4 Jan 2019 10:05:07 +0800
Subject: [PATCH 03/17] unit test: d2-container-card
Former-commit-id: ec0d88699b516228939350bc91d2a19660e2daa1 [formerly ec0d88699b516228939350bc91d2a19660e2daa1 [formerly ec0d88699b516228939350bc91d2a19660e2daa1 [formerly ec0d88699b516228939350bc91d2a19660e2daa1 [formerly ed5f0a35cfeee08b444029b74ad8755cf2a8e35e [formerly 5235553320b656a9c12222faa18225b2b1ed54d8]]]]]
Former-commit-id: 634539e313a27a71aab2d2e18982ec4e735dc93b
Former-commit-id: f1537450ffea60639b8f11cbbe40058c5aece33a
Former-commit-id: 58b5ae217a39f20c038b2d999f178359e49828d5 [formerly 105e09af8933da9f89591fae6acb2468ba706c96]
Former-commit-id: 96c2b40a5b857599958ce75a75073983788b3fbe
Former-commit-id: cecafe15a08e8f279767a45933c814bf948240cc
Former-commit-id: ed8e45510ec0f518185555c9ebdc9e460d995614
Former-commit-id: 574e00143fbaabfbb4f462ff883b65c5d427c649
Former-commit-id: 5e667452de548c6482700f6c0ad1956af21bb1ed
---
tests/unit/d2-container-card.spec.js | 34 ++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/tests/unit/d2-container-card.spec.js b/tests/unit/d2-container-card.spec.js
index 8b298425..b1eeed2e 100644
--- a/tests/unit/d2-container-card.spec.js
+++ b/tests/unit/d2-container-card.spec.js
@@ -2,7 +2,16 @@ import { mount } from '@vue/test-utils'
import D2ContainerCard from '@/components/d2-container/components/d2-container-card.vue'
describe('d2-container-card.vue', () => {
- it('渲染slot', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2ContainerCard)
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // 包含特定类名
+ it('contains specific classnames', () => {
const wrapper = mount(D2ContainerCard, {
slots: {
default: '
',
@@ -11,8 +20,25 @@ describe('d2-container-card.vue', () => {
}
})
- expect(wrapper.html()).toContain('
')
- expect(wrapper.html()).toContain('')
- expect(wrapper.html()).toContain('')
+ expect(wrapper.is('.d2-container-card')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-card__header')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-card__body')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-card__body-card')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-card__footer')).toBeTruthy()
+ });
+
+ // 渲染slot
+ it('has one or more slots', () => {
+ const wrapper = mount(D2ContainerCard, {
+ slots: {
+ default: '
body
',
+ header: '
header
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.text()).toMatch('header')
+ expect(wrapper.text()).toMatch('body')
+ expect(wrapper.text()).toMatch('footer')
})
})
From a1d5dcf4e3ca7c852c070c53fecdee666b86859c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Fri, 4 Jan 2019 10:37:30 +0800
Subject: [PATCH 04/17] d2-container-card-bs
Former-commit-id: c009373c074fb773647835bb5bb45d708f5eb457 [formerly c009373c074fb773647835bb5bb45d708f5eb457 [formerly c009373c074fb773647835bb5bb45d708f5eb457 [formerly c009373c074fb773647835bb5bb45d708f5eb457 [formerly ee20123fa36557a79909cf3cfca22f8ba21a2000 [formerly 0e4ed247546b3443b397afac63226eed1cebe5ec]]]]]
Former-commit-id: 61abb29ff438bc31f4352343854b50a5100866c7
Former-commit-id: d2546ca72f81e1889257484db2f1af22d456f676
Former-commit-id: c90c0fadc2c1827b992e56c427cefd18d26b09e7 [formerly 6bd4f6596ca8c62f7f38beb21cd7376617414b85]
Former-commit-id: 0d1493f9b87238c5c2650735064707e51656d8c4
Former-commit-id: 0ff4acd130f38bcc7d35f3cdfb682c4498ab74ba
Former-commit-id: b17c30151bd7aada600e54915628d1002d170445
Former-commit-id: 657f8fa764e965419f3c772fc75e4e6c59fba9e3
Former-commit-id: d2ecbcf192d4a142a111aec3f477ede79c2e021a
---
tests/unit/d2-container-card-bs.spec.js | 55 +++++++++++++++++++++++++
tests/unit/d2-container-card.spec.js | 13 +++++-
2 files changed, 67 insertions(+), 1 deletion(-)
create mode 100644 tests/unit/d2-container-card-bs.spec.js
diff --git a/tests/unit/d2-container-card-bs.spec.js b/tests/unit/d2-container-card-bs.spec.js
new file mode 100644
index 00000000..cf7cdd52
--- /dev/null
+++ b/tests/unit/d2-container-card-bs.spec.js
@@ -0,0 +1,55 @@
+import { mount } from '@vue/test-utils'
+import D2ContainerCardBs from '@/components/d2-container/components/d2-container-card-bs.vue'
+
+describe('d2-container-card-bs.vue', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2ContainerCardBs)
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // 包含特定类名
+ it('contains specific classnames', () => {
+ const wrapper = mount(D2ContainerCardBs, {
+ slots: {
+ default: '
body
',
+ header: '
header
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.is('.d2-container-card-bs')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-card-bs__header')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-card-bs__body')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-card-bs__body-card')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-card-bs__footer')).toBeTruthy()
+ })
+
+ // betterScrollOptions prop
+ it('has a property named \'betterScrollOptions\'', () => {
+ const wrapper = mount(D2ContainerCardBs, {
+ propsData: {
+ betterScrollOptions: {}
+ }
+ })
+
+ expect(wrapper.props().betterScrollOptions).toEqual({})
+ })
+
+ // 渲染slot
+ it('has one or more slots', () => {
+ const wrapper = mount(D2ContainerCardBs, {
+ slots: {
+ default: '
body
',
+ header: '
header
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.text()).toMatch('header')
+ expect(wrapper.text()).toMatch('body')
+ expect(wrapper.text()).toMatch('footer')
+ })
+})
diff --git a/tests/unit/d2-container-card.spec.js b/tests/unit/d2-container-card.spec.js
index b1eeed2e..c2548e64 100644
--- a/tests/unit/d2-container-card.spec.js
+++ b/tests/unit/d2-container-card.spec.js
@@ -25,7 +25,18 @@ describe('d2-container-card.vue', () => {
expect(wrapper.contains('.d2-container-card__body')).toBeTruthy()
expect(wrapper.contains('.d2-container-card__body-card')).toBeTruthy()
expect(wrapper.contains('.d2-container-card__footer')).toBeTruthy()
- });
+ })
+
+ // 节流间隔prop
+ it('has a property named \'scrollDelay\'', () => {
+ const wrapper = mount(D2ContainerCard, {
+ propsData: {
+ scrollDelay: 30
+ }
+ })
+
+ expect(wrapper.props().scrollDelay).toEqual(30)
+ })
// 渲染slot
it('has one or more slots', () => {
From 63f557bd69b39733338521462697755af1049be5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Fri, 4 Jan 2019 13:04:43 +0800
Subject: [PATCH 05/17] unit test: d2-container-full
Former-commit-id: 4bc2b877ea4c3d8cfaa05554e9f9f7e5350b6e25 [formerly 4bc2b877ea4c3d8cfaa05554e9f9f7e5350b6e25 [formerly 4bc2b877ea4c3d8cfaa05554e9f9f7e5350b6e25 [formerly 4bc2b877ea4c3d8cfaa05554e9f9f7e5350b6e25 [formerly 70126561aeab08652824a7f17b6a570cb1e9dd87 [formerly fe236bdaadef752c31ba9c21b43ffcc4c98fbcbf]]]]]
Former-commit-id: 95f590e4a7ae9f8c27ff386887f6eb53309e5e25
Former-commit-id: 6db59439578a4af63444b378eee9566211e25457
Former-commit-id: 0203ff26b3d18211749bf747b5bbe337d65c8917 [formerly cdc91f18bb39d2bbeb6c7f4553d31acc3ab89a7e]
Former-commit-id: a4b0181e8181265c6763c22d6accd0796d186e8f
Former-commit-id: 240d166967d9a894e38b8ba39cbb222714533ae3
Former-commit-id: 64a23cf1415c54a325976b4d35768b708c16d541
Former-commit-id: 3cc60fa0e2527105042fbcbae219acc65da95eb1
Former-commit-id: de843fe7336dd261875465bcd8e1b3be0b00d101
---
tests/unit/d2-container-full.spec.js | 54 ++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 tests/unit/d2-container-full.spec.js
diff --git a/tests/unit/d2-container-full.spec.js b/tests/unit/d2-container-full.spec.js
new file mode 100644
index 00000000..39e8a744
--- /dev/null
+++ b/tests/unit/d2-container-full.spec.js
@@ -0,0 +1,54 @@
+import { mount } from '@vue/test-utils'
+import D2ContainerFull from '@/components/d2-container/components/d2-container-full.vue'
+
+describe('d2-container-full.vue', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2ContainerFull)
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // 包含特定类名
+ it('contains specific classnames', () => {
+ const wrapper = mount(D2ContainerFull, {
+ slots: {
+ default: '
body
',
+ header: '
header
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.is('.d2-container-full')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-full__header')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-full__body')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-full__footer')).toBeTruthy()
+ })
+
+ // 节流间隔prop
+ it('has a property named \'scrollDelay\'', () => {
+ const wrapper = mount(D2ContainerFull, {
+ propsData: {
+ scrollDelay: 30
+ }
+ })
+
+ expect(wrapper.props().scrollDelay).toEqual(30)
+ })
+
+ // 渲染slot
+ it('has one or more slots', () => {
+ const wrapper = mount(D2ContainerFull, {
+ slots: {
+ default: '
body
',
+ header: '
header
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.text()).toMatch('header')
+ expect(wrapper.text()).toMatch('body')
+ expect(wrapper.text()).toMatch('footer')
+ })
+})
From ccc5c5f631810d5f316efeec555b1b0995dee431 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Fri, 4 Jan 2019 13:07:39 +0800
Subject: [PATCH 06/17] unit test: d2-container-full-bs
Former-commit-id: 283e7db715965f9a3bef2755bd885ea7edd8629b [formerly 283e7db715965f9a3bef2755bd885ea7edd8629b [formerly 283e7db715965f9a3bef2755bd885ea7edd8629b [formerly 283e7db715965f9a3bef2755bd885ea7edd8629b [formerly 4c20b5b7a5a86fb78bacb1ee3106032db07dd50b [formerly 63b3feba8b2ef8982c25697b53bbf4341925e290]]]]]
Former-commit-id: 93ae445a627e3c17dcb2a8d5afebf19e58025fd4
Former-commit-id: 8880b3e9a48f09f6c0351b625224d4d31881fc3e
Former-commit-id: 146e5ee8dbfeb2f6b0774d0b94482d3963bf2685 [formerly 5783bd169e1cc31b5ebc5e87dc2bf889cb428a80]
Former-commit-id: 5bacf88c3d52084893f319c83db2f3bc1866e1bf
Former-commit-id: 413ba702b7376ba92f233387f6a1146dc4f9402d
Former-commit-id: f286c8987e4799a161b59209251400a2aa4037e1
Former-commit-id: bba6285faddc0a2f89e6f350fb0822271f8760ad
Former-commit-id: a5e70c2b975db855bce46ad0dc1f2f25507d1981
---
tests/unit/d2-container-full-bs.spec.js | 55 +++++++++++++++++++++++++
1 file changed, 55 insertions(+)
create mode 100644 tests/unit/d2-container-full-bs.spec.js
diff --git a/tests/unit/d2-container-full-bs.spec.js b/tests/unit/d2-container-full-bs.spec.js
new file mode 100644
index 00000000..67464602
--- /dev/null
+++ b/tests/unit/d2-container-full-bs.spec.js
@@ -0,0 +1,55 @@
+import { mount } from '@vue/test-utils'
+import D2ContainerFullBs from '@/components/d2-container/components/d2-container-full-bs.vue'
+
+describe('d2-container-full-bs.vue', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2ContainerFullBs)
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // 包含特定类名
+ it('contains specific classnames', () => {
+ const wrapper = mount(D2ContainerFullBs, {
+ slots: {
+ default: '
body
',
+ header: '
header
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.is('.d2-container-full-bs')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-full-bs__header')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-full-bs__body')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-full-bs__body-wrapper-inner')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-full-bs__footer')).toBeTruthy()
+ })
+
+ // betterScrollOptions prop
+ it('has a property named \'betterScrollOptions\'', () => {
+ const wrapper = mount(D2ContainerFullBs, {
+ propsData: {
+ betterScrollOptions: {}
+ }
+ })
+
+ expect(wrapper.props().betterScrollOptions).toEqual({})
+ })
+
+ // 渲染slot
+ it('has one or more slots', () => {
+ const wrapper = mount(D2ContainerFullBs, {
+ slots: {
+ default: '
body
',
+ header: '
header
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.text()).toMatch('header')
+ expect(wrapper.text()).toMatch('body')
+ expect(wrapper.text()).toMatch('footer')
+ })
+})
From 0caf2fde7971478158fcd44e84d37ade9b2fcfe6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Fri, 4 Jan 2019 13:41:56 +0800
Subject: [PATCH 07/17] unit test: d2-container-ghost d2-container-ghost-bs
Former-commit-id: a3bd22f5d907c9b001c21d8e0e5e1a448e4a479d [formerly a3bd22f5d907c9b001c21d8e0e5e1a448e4a479d [formerly a3bd22f5d907c9b001c21d8e0e5e1a448e4a479d [formerly a3bd22f5d907c9b001c21d8e0e5e1a448e4a479d [formerly 93ea6d53bd1ba2ba7670725357950bb0cb8f252f [formerly d753e72f3acc433edf54816392664e4879def36e]]]]]
Former-commit-id: 3b70ea51df338250db8381c176d72a1e5bf2f14d
Former-commit-id: b5963a8de1dbb6a72a96d9e742ce252f096095be
Former-commit-id: e9e410815bd4ed055a2902a584ec85ef6135871c [formerly 0a0fe15a5cc62fb43daf67ffb9cdc0bfbff768e4]
Former-commit-id: 67fe141b4c8f69884d5e01e48ea92dad742fc7ab
Former-commit-id: 0481b77c2ff5dfdb542414db7b228a0f5110f7e8
Former-commit-id: 816185b58edb34b955b176a97e7801f3e8e74b2f
Former-commit-id: c28a3c03c9c48b9e5a2c40f87e101957ce745733
Former-commit-id: 502aaf18d8b17acb8b16421998ce47277bf56818
---
tests/unit/d2-container-ghost-bs.spec.js | 65 ++++++++++++++++++++++++
tests/unit/d2-container-ghost.spec.js | 54 ++++++++++++++++++++
2 files changed, 119 insertions(+)
create mode 100644 tests/unit/d2-container-ghost-bs.spec.js
create mode 100644 tests/unit/d2-container-ghost.spec.js
diff --git a/tests/unit/d2-container-ghost-bs.spec.js b/tests/unit/d2-container-ghost-bs.spec.js
new file mode 100644
index 00000000..e8af6dc0
--- /dev/null
+++ b/tests/unit/d2-container-ghost-bs.spec.js
@@ -0,0 +1,65 @@
+import { mount } from '@vue/test-utils'
+import D2ContainerGhostBs from '@/components/d2-container/components/d2-container-ghost-bs.vue'
+
+describe('d2-container-ghost-bs.vue', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2ContainerGhostBs, {
+ slots: {
+ default: '
body
',
+ header: '
header
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // 包含特定类名
+ it('contains specific classnames', () => {
+ const wrapper = mount(D2ContainerGhostBs, {
+ slots: {
+ default: '
body
',
+ header: '
header
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.is('.d2-container-ghost-bs')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-ghost-bs__header')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-ghost-bs__body')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-ghost-bs__footer')).toBeTruthy()
+ })
+
+ // betterScrollOptions prop
+ it('has a property named \'betterScrollOptions\'', () => {
+ const wrapper = mount(D2ContainerGhostBs, {
+ slots: {
+ default: '
body
',
+ header: '
header
',
+ footer: '
footer
'
+ },
+ propsData: {
+ betterScrollOptions: {}
+ }
+ })
+
+ expect(wrapper.props().betterScrollOptions).toEqual({})
+ })
+
+ // 渲染slot
+ it('has one or more slots', () => {
+ const wrapper = mount(D2ContainerGhostBs, {
+ slots: {
+ default: '
body
',
+ header: '
header
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.text()).toMatch('header')
+ expect(wrapper.text()).toMatch('body')
+ expect(wrapper.text()).toMatch('footer')
+ })
+})
\ No newline at end of file
diff --git a/tests/unit/d2-container-ghost.spec.js b/tests/unit/d2-container-ghost.spec.js
new file mode 100644
index 00000000..247e1e57
--- /dev/null
+++ b/tests/unit/d2-container-ghost.spec.js
@@ -0,0 +1,54 @@
+import { mount } from '@vue/test-utils'
+import D2ContainerGhost from '@/components/d2-container/components/d2-container-ghost.vue'
+
+describe('d2-container-ghost.vue', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2ContainerGhost)
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // 包含特定类名
+ it('contains specific classnames', () => {
+ const wrapper = mount(D2ContainerGhost, {
+ slots: {
+ default: '
body
',
+ header: '
header
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.is('.d2-container-ghost')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-ghost__header')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-ghost__body')).toBeTruthy()
+ expect(wrapper.contains('.d2-container-ghost__footer')).toBeTruthy()
+ })
+
+ // 节流间隔prop
+ it('has a property named \'scrollDelay\'', () => {
+ const wrapper = mount(D2ContainerGhost, {
+ propsData: {
+ scrollDelay: 30
+ }
+ })
+
+ expect(wrapper.props().scrollDelay).toEqual(30)
+ })
+
+ // 渲染slot
+ it('has one or more slots', () => {
+ const wrapper = mount(D2ContainerGhost, {
+ slots: {
+ default: '
body
',
+ header: '
header
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.text()).toMatch('header')
+ expect(wrapper.text()).toMatch('body')
+ expect(wrapper.text()).toMatch('footer')
+ })
+})
From 100f8a51b0b8e1f7942ddf33093987b6b8128846 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Fri, 4 Jan 2019 14:41:36 +0800
Subject: [PATCH 08/17] unit test: d2-source
Former-commit-id: 262746d1065b9d7732492498cbaa976506d6e0bb [formerly 262746d1065b9d7732492498cbaa976506d6e0bb [formerly 262746d1065b9d7732492498cbaa976506d6e0bb [formerly 262746d1065b9d7732492498cbaa976506d6e0bb [formerly c5f1b718ada6351ba635fe3c86a30b41306e27cd [formerly 1bca35e5870d04510f1bf61312f2aa15f2415dce]]]]]
Former-commit-id: 555297611afc03ee0c6735c391194254ccd14b08
Former-commit-id: 451d89d5a4805638f948b12b6ab3c5024c5cb6e2
Former-commit-id: 062d757d5cf53079bf2c83779e418d82b02ac9ed [formerly 1eabb82bb10944e675b4aedd8349ce4d63fc1438]
Former-commit-id: eb7d104d3b16e1ac982c8fc5aee89c3349838579
Former-commit-id: 3bada4298c976a4de8259fbcda5eb37a40aa2ce9
Former-commit-id: 50f36cd0121628bb1a3be4840950db18894cd06c
Former-commit-id: 1f4a3f28093592fc74ae971ffb5b3d5c7657ae53
Former-commit-id: dfc27342fc8c7e9a46a11160cc37ccb3d345f75f
---
tests/unit/d2-source.spec.js | 39 ++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 tests/unit/d2-source.spec.js
diff --git a/tests/unit/d2-source.spec.js b/tests/unit/d2-source.spec.js
new file mode 100644
index 00000000..31da50bf
--- /dev/null
+++ b/tests/unit/d2-source.spec.js
@@ -0,0 +1,39 @@
+import { mount, createLocalVue } from '@vue/test-utils'
+import D2Source from '@/components/d2-container/components/d2-source.vue'
+import util from '@/libs/util'
+
+describe('d2-source.vue', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2Source, {
+ stubs: ['d2-icon']
+ })
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // 包含特定类名
+ it('contains specific classnames', () => {
+ const wrapper = mount(D2Source, {
+ stubs: ['d2-icon']
+ })
+
+ expect(wrapper.is('.d2-source')).toBeTruthy()
+ setTimeout(() => {
+ expect(wrapper.contains('.d2-source--active')).toBeTruthy()
+ }, 500)
+ })
+
+ // filename prop
+ it('has a property named \'filename\'', () => {
+ const wrapper = mount(D2Source, {
+ stubs: ['d2-icon'],
+ propsData: {
+ filename: ''
+ }
+ })
+
+ expect(wrapper.props().filename).toEqual('')
+ })
+})
\ No newline at end of file
From 521b08b6b5e6693ccdf487c20f549ad6600ad11a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Fri, 4 Jan 2019 14:52:49 +0800
Subject: [PATCH 09/17] unit test: d2-container-frame
Former-commit-id: c032c3e36f928fe7daf009eb09e232e1f584bd87 [formerly c032c3e36f928fe7daf009eb09e232e1f584bd87 [formerly c032c3e36f928fe7daf009eb09e232e1f584bd87 [formerly c032c3e36f928fe7daf009eb09e232e1f584bd87 [formerly b43dff25908611ddd33578f7e1c88f04c83a9fbe [formerly 333f9d73a531287cb3df345ce536fd5a686db1f4]]]]]
Former-commit-id: ce91bf166da5e6398fed2b6fe9365a5cc6da8084
Former-commit-id: e98d32ee8e69ab123577ee69485878e55f8af1cb
Former-commit-id: db26dedc0cc4903581ce6317aebd24e9dd51ec26 [formerly 156e4f86387dc1c177df774beef8ca35adcf654a]
Former-commit-id: b86ce1d37d3f86fa24b91be58852922e1f1df3e5
Former-commit-id: 28f40604fd11f9939fe5780652b571d85e1573be
Former-commit-id: 60e02a7facc69965b2c10ba29ae493cfc279d062
Former-commit-id: fc66ed7299d7136a69ec7d3c5c98acebeaa99968
Former-commit-id: 7491a4d6e71073af442fb0dfcd5d81df9b5dfe8f
---
tests/unit/d2-container-frame.spec.js | 35 +++++++++++++++++++++++++++
tests/unit/d2-source.spec.js | 1 -
2 files changed, 35 insertions(+), 1 deletion(-)
create mode 100644 tests/unit/d2-container-frame.spec.js
diff --git a/tests/unit/d2-container-frame.spec.js b/tests/unit/d2-container-frame.spec.js
new file mode 100644
index 00000000..ad13b87d
--- /dev/null
+++ b/tests/unit/d2-container-frame.spec.js
@@ -0,0 +1,35 @@
+import { mount } from '@vue/test-utils'
+import D2ContainerFrame from '@/components/d2-container-frame/index.vue'
+
+describe('d2-container-frame.vue', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2ContainerFrame, {
+ stubs: ['d2-container']
+ })
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // 包含特定类名
+ it('contains specific classnames', () => {
+ const wrapper = mount(D2ContainerFrame, {
+ stubs: ['d2-container']
+ })
+
+ expect(wrapper.contains('.d2-container-frame')).toBeTruthy()
+ })
+
+ // src prop
+ it('has a property named \'src\'', () => {
+ const wrapper = mount(D2ContainerFrame, {
+ stubs: ['d2-container'],
+ propsData: {
+ src: 'https://doc.d2admin.fairyever.com/zh/'
+ }
+ })
+
+ expect(wrapper.props().src).toEqual('https://doc.d2admin.fairyever.com/zh/')
+ })
+})
diff --git a/tests/unit/d2-source.spec.js b/tests/unit/d2-source.spec.js
index 31da50bf..58d9ac34 100644
--- a/tests/unit/d2-source.spec.js
+++ b/tests/unit/d2-source.spec.js
@@ -1,6 +1,5 @@
import { mount, createLocalVue } from '@vue/test-utils'
import D2Source from '@/components/d2-container/components/d2-source.vue'
-import util from '@/libs/util'
describe('d2-source.vue', () => {
// 存在且是Vue组件实例
From 4ef91111e30e93a353e96e585ad1bf01aed23d17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Fri, 4 Jan 2019 15:26:25 +0800
Subject: [PATCH 10/17] unit test: d2-count-up d2-icon
Former-commit-id: 7fad78a4b7f62ebe674342e8154f4497b79c5b06 [formerly 7fad78a4b7f62ebe674342e8154f4497b79c5b06 [formerly 7fad78a4b7f62ebe674342e8154f4497b79c5b06 [formerly 7fad78a4b7f62ebe674342e8154f4497b79c5b06 [formerly e6036f61ab8105232d3e57f6c84182c092a74fd1 [formerly 17cf5e498be64a1c9b05456ff022241537957376]]]]]
Former-commit-id: c7f917c0128ec8867cd96710c7bcceba63c62dfd
Former-commit-id: 9dff6eabb4254aa4e4807a58c961532dc5d8b47e
Former-commit-id: 68bd970afdebd5c56bd0e72ffe871d687eccee69 [formerly 534cc268a850f9743ea398eae910dd1419b3b497]
Former-commit-id: eace96ad1ee3407d93f3a87385fc13d6ee1936c3
Former-commit-id: c448d93d9f03dee110afba702f83e77cb36002dc
Former-commit-id: bfefc7d1f57c67106a4da79e77682e33804630ed
Former-commit-id: 65193bd67cb7775646fead1ecc77250cd5427d50
Former-commit-id: 20df260fbe97beba5badc5e31af3131ad510a7b2
---
tests/unit/d2-count-up.spec.js | 16 ++++++++++++++++
tests/unit/d2-icon.spec.js | 31 +++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
create mode 100644 tests/unit/d2-count-up.spec.js
create mode 100644 tests/unit/d2-icon.spec.js
diff --git a/tests/unit/d2-count-up.spec.js b/tests/unit/d2-count-up.spec.js
new file mode 100644
index 00000000..ce5e292a
--- /dev/null
+++ b/tests/unit/d2-count-up.spec.js
@@ -0,0 +1,16 @@
+import { mount } from '@vue/test-utils'
+import D2CountUp from '@/components/d2-count-up/index.vue'
+
+describe('d2-count-up.vue', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2CountUp, {
+ propsData: {
+ end: 100
+ }
+ })
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+})
diff --git a/tests/unit/d2-icon.spec.js b/tests/unit/d2-icon.spec.js
new file mode 100644
index 00000000..e07e86b8
--- /dev/null
+++ b/tests/unit/d2-icon.spec.js
@@ -0,0 +1,31 @@
+import { mount } from '@vue/test-utils'
+import D2Icon from '@/components/d2-icon/index.vue'
+
+describe('d2-icon.vue', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2Icon)
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // 包含特定类名
+ it('contains specific classnames', () => {
+ const wrapper = mount(D2Icon)
+
+ expect(wrapper.is('.fa')).toBeTruthy()
+ expect(wrapper.contains('.fa-font-awesome')).toBeTruthy()
+ })
+
+ // name prop
+ it('has a property named \'name\'', () => {
+ const wrapper = mount(D2Icon, {
+ propsData: {
+ name: 'font-awesome'
+ }
+ })
+
+ expect(wrapper.props().name).toEqual('font-awesome')
+ })
+})
From cc8795077298001b837eaf4621a8dd72b2aa9c6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Sat, 5 Jan 2019 09:53:39 +0800
Subject: [PATCH 11/17] unit test: d2-count-up
Former-commit-id: a4acc0021635513dbaa33d55a4e9ed4b0022dc9d [formerly a4acc0021635513dbaa33d55a4e9ed4b0022dc9d [formerly a4acc0021635513dbaa33d55a4e9ed4b0022dc9d [formerly a4acc0021635513dbaa33d55a4e9ed4b0022dc9d [formerly 108b6440007edfaa758005622c935b53d1608015 [formerly 623ddae983522b2475b7fd6d3bcce69c981079ec]]]]]
Former-commit-id: 057065402397ae93d4a60415b8c056161608461b
Former-commit-id: e9938c5514818c1b0e6e224a000cb888f5b704f2
Former-commit-id: af905c62535a6a00e6a4325bdcda06ab07f5d793 [formerly 598b5cc95bc01db05a3ffdb184c312670ca6bdc1]
Former-commit-id: bb1cdabc4436ea871f0bee153304ea039b4cb711
Former-commit-id: e7fbf5cb746ed3329d3b044e3ddbe1b074c06b68
Former-commit-id: 21c5ec79779a24df010d33e0058706596a3d622b
Former-commit-id: 2a0211c9e99d4bbb0abf897867dfa3cd53ae60d2
Former-commit-id: abb484aa78b08668d297bd6bef1a7e2dadceb37f
---
tests/unit/d2-count-up.spec.js | 56 +++++++++++++++++++++++++++++++
tests/unit/d2-icon-select.spec.js | 39 +++++++++++++++++++++
tests/unit/d2-source.spec.js | 5 +--
3 files changed, 98 insertions(+), 2 deletions(-)
create mode 100644 tests/unit/d2-icon-select.spec.js
diff --git a/tests/unit/d2-count-up.spec.js b/tests/unit/d2-count-up.spec.js
index ce5e292a..b8b0e6b8 100644
--- a/tests/unit/d2-count-up.spec.js
+++ b/tests/unit/d2-count-up.spec.js
@@ -13,4 +13,60 @@ describe('d2-count-up.vue', () => {
expect(wrapper.exists()).toBeTruthy()
expect(wrapper.isVueInstance()).toBeTruthy()
})
+
+ // props
+ it('has props', () => {
+ const wrapper = mount(D2CountUp, {
+ propsData: {
+ start: 0,
+ end: 100,
+ decimals: 0,
+ duration: 2,
+ options: {}
+ }
+ })
+
+ expect(wrapper.props().start).toEqual(0)
+ expect(wrapper.props().end).toEqual(100)
+ expect(wrapper.props().decimals).toEqual(0)
+ expect(wrapper.props().duration).toEqual(2)
+ expect(wrapper.props().options).toEqual({})
+ })
+
+ // 开始数字,1秒后结束数字
+ it('start number is 1, 1s later, end number is 99', (done) => {
+ const wrapper = mount(D2CountUp, {
+ propsData: {
+ start: 1,
+ end: 99,
+ duration: 1
+ }
+ })
+
+ expect(wrapper.text()).toBe('1')
+
+ setTimeout(() => {
+ expect(wrapper.text()).toBe('99')
+ done()
+ }, 1100)
+ })
+
+ // 小数位数
+ it('start number is 1.00, 1s later, end number is 99.00', (done) => {
+ const wrapper = mount(D2CountUp, {
+ propsData: {
+ start: 1,
+ end: 99,
+ decimals: 2,
+ duration: 1
+ }
+ })
+
+ expect(wrapper.text()).toBe('1.00')
+
+ setTimeout(() => {
+ expect(wrapper.text()).toBe('99.00')
+ done()
+ }, 1100)
+ })
})
diff --git a/tests/unit/d2-icon-select.spec.js b/tests/unit/d2-icon-select.spec.js
new file mode 100644
index 00000000..64c5a352
--- /dev/null
+++ b/tests/unit/d2-icon-select.spec.js
@@ -0,0 +1,39 @@
+import { mount, createLocalVue } from '@vue/test-utils'
+import D2IconSelect from '@/components/d2-icon-select/index.vue'
+import ElementUI from 'element-ui'
+
+describe('d2-icon-select.vue', () => {
+ const localVue = createLocalVue()
+ localVue.use(ElementUI)
+
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2IconSelect, {
+ stubs: ['el-popover', 'el-button', 'el-input', 'el-collapse', 'el-collapse-item', 'el-col', 'el-row']
+ })
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // // props
+ // it('has props', () => {
+ // const wrapper = mount(D2IconSelect, {
+ // propsData: {
+ // value: 'value',
+ // placeholder: '请选择',
+ // placement: 'right',
+ // clearable: true,
+ // userInput: false,
+ // autoClose: false
+ // }
+ // })
+
+ // expect(wrapper.props().value).toEqual('value')
+ // expect(wrapper.props().placeholder).toEqual('请选择')
+ // expect(wrapper.props().placement).toEqual('right')
+ // expect(wrapper.props().clearable).toEqual(true)
+ // expect(wrapper.props().userInput).toEqual(false)
+ // expect(wrapper.props().autoClose).toEqual(false)
+ // })
+})
diff --git a/tests/unit/d2-source.spec.js b/tests/unit/d2-source.spec.js
index 58d9ac34..333b12a7 100644
--- a/tests/unit/d2-source.spec.js
+++ b/tests/unit/d2-source.spec.js
@@ -13,7 +13,7 @@ describe('d2-source.vue', () => {
})
// 包含特定类名
- it('contains specific classnames', () => {
+ it('contains specific classnames', (done) => {
const wrapper = mount(D2Source, {
stubs: ['d2-icon']
})
@@ -21,7 +21,8 @@ describe('d2-source.vue', () => {
expect(wrapper.is('.d2-source')).toBeTruthy()
setTimeout(() => {
expect(wrapper.contains('.d2-source--active')).toBeTruthy()
- }, 500)
+ done()
+ }, 600)
})
// filename prop
From e73d7be4c5f658709c906e5f7fe019ee6e7a8421 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Sat, 5 Jan 2019 09:58:05 +0800
Subject: [PATCH 12/17] no message
Former-commit-id: 0043b5f5d5d3929d432e04a1c29f38ad039ad57c [formerly 0043b5f5d5d3929d432e04a1c29f38ad039ad57c [formerly 0043b5f5d5d3929d432e04a1c29f38ad039ad57c [formerly 0043b5f5d5d3929d432e04a1c29f38ad039ad57c [formerly 62c1c67cf4204ce64685812f1ce66ee7607c08d4 [formerly 9dd74154fcc5f0616ae15f9953c523fc0778a430]]]]]
Former-commit-id: 8705942098de72b8d037068623b0cd85134f9aa6
Former-commit-id: a3c6c9fa65dee6fcb4b020bd31d48d51d581c42f
Former-commit-id: 356b33963109fe654be6f07aceaaf8ba600fc429 [formerly 245b9a094d3ac4631ccece0b8161bd8ef88337d8]
Former-commit-id: 009ad7730d68e708e3354ea32e809b704a36b538
Former-commit-id: d6d00e641c4d14af7a27d61648b44f54a412ce9d
Former-commit-id: 148440c65e18ee7d577f8b4fded3eb6b6a4a0211
Former-commit-id: e79c7dd2c985c10ab3c5f2ecb5c24b3e28f71737
Former-commit-id: 0eeb1b06586af98c04877a7ce4e8cad98e3fc9ff
---
tests/unit/d2-container-card-bs.spec.js | 4 ++--
tests/unit/d2-container-card.spec.js | 4 ++--
tests/unit/d2-container-frame.spec.js | 4 ++--
tests/unit/d2-container-full-bs.spec.js | 4 ++--
tests/unit/d2-container-full.spec.js | 4 ++--
tests/unit/d2-container-ghost-bs.spec.js | 4 ++--
tests/unit/d2-container-ghost.spec.js | 4 ++--
tests/unit/d2-icon.spec.js | 4 ++--
tests/unit/d2-source.spec.js | 4 ++--
9 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/tests/unit/d2-container-card-bs.spec.js b/tests/unit/d2-container-card-bs.spec.js
index cf7cdd52..213067f7 100644
--- a/tests/unit/d2-container-card-bs.spec.js
+++ b/tests/unit/d2-container-card-bs.spec.js
@@ -27,8 +27,8 @@ describe('d2-container-card-bs.vue', () => {
expect(wrapper.contains('.d2-container-card-bs__footer')).toBeTruthy()
})
- // betterScrollOptions prop
- it('has a property named \'betterScrollOptions\'', () => {
+ // props
+ it('has props', () => {
const wrapper = mount(D2ContainerCardBs, {
propsData: {
betterScrollOptions: {}
diff --git a/tests/unit/d2-container-card.spec.js b/tests/unit/d2-container-card.spec.js
index c2548e64..50c2b15c 100644
--- a/tests/unit/d2-container-card.spec.js
+++ b/tests/unit/d2-container-card.spec.js
@@ -27,8 +27,8 @@ describe('d2-container-card.vue', () => {
expect(wrapper.contains('.d2-container-card__footer')).toBeTruthy()
})
- // 节流间隔prop
- it('has a property named \'scrollDelay\'', () => {
+ // props
+ it('has props', () => {
const wrapper = mount(D2ContainerCard, {
propsData: {
scrollDelay: 30
diff --git a/tests/unit/d2-container-frame.spec.js b/tests/unit/d2-container-frame.spec.js
index ad13b87d..42a8e540 100644
--- a/tests/unit/d2-container-frame.spec.js
+++ b/tests/unit/d2-container-frame.spec.js
@@ -21,8 +21,8 @@ describe('d2-container-frame.vue', () => {
expect(wrapper.contains('.d2-container-frame')).toBeTruthy()
})
- // src prop
- it('has a property named \'src\'', () => {
+ // props
+ it('has props', () => {
const wrapper = mount(D2ContainerFrame, {
stubs: ['d2-container'],
propsData: {
diff --git a/tests/unit/d2-container-full-bs.spec.js b/tests/unit/d2-container-full-bs.spec.js
index 67464602..fd4d3ae4 100644
--- a/tests/unit/d2-container-full-bs.spec.js
+++ b/tests/unit/d2-container-full-bs.spec.js
@@ -27,8 +27,8 @@ describe('d2-container-full-bs.vue', () => {
expect(wrapper.contains('.d2-container-full-bs__footer')).toBeTruthy()
})
- // betterScrollOptions prop
- it('has a property named \'betterScrollOptions\'', () => {
+ // props
+ it('has props', () => {
const wrapper = mount(D2ContainerFullBs, {
propsData: {
betterScrollOptions: {}
diff --git a/tests/unit/d2-container-full.spec.js b/tests/unit/d2-container-full.spec.js
index 39e8a744..ec33b8cb 100644
--- a/tests/unit/d2-container-full.spec.js
+++ b/tests/unit/d2-container-full.spec.js
@@ -26,8 +26,8 @@ describe('d2-container-full.vue', () => {
expect(wrapper.contains('.d2-container-full__footer')).toBeTruthy()
})
- // 节流间隔prop
- it('has a property named \'scrollDelay\'', () => {
+ // props
+ it('has props', () => {
const wrapper = mount(D2ContainerFull, {
propsData: {
scrollDelay: 30
diff --git a/tests/unit/d2-container-ghost-bs.spec.js b/tests/unit/d2-container-ghost-bs.spec.js
index e8af6dc0..7f6b09ad 100644
--- a/tests/unit/d2-container-ghost-bs.spec.js
+++ b/tests/unit/d2-container-ghost-bs.spec.js
@@ -32,8 +32,8 @@ describe('d2-container-ghost-bs.vue', () => {
expect(wrapper.contains('.d2-container-ghost-bs__footer')).toBeTruthy()
})
- // betterScrollOptions prop
- it('has a property named \'betterScrollOptions\'', () => {
+ // props
+ it('has props', () => {
const wrapper = mount(D2ContainerGhostBs, {
slots: {
default: '
body
',
diff --git a/tests/unit/d2-container-ghost.spec.js b/tests/unit/d2-container-ghost.spec.js
index 247e1e57..3758463f 100644
--- a/tests/unit/d2-container-ghost.spec.js
+++ b/tests/unit/d2-container-ghost.spec.js
@@ -26,8 +26,8 @@ describe('d2-container-ghost.vue', () => {
expect(wrapper.contains('.d2-container-ghost__footer')).toBeTruthy()
})
- // 节流间隔prop
- it('has a property named \'scrollDelay\'', () => {
+ // props
+ it('has props', () => {
const wrapper = mount(D2ContainerGhost, {
propsData: {
scrollDelay: 30
diff --git a/tests/unit/d2-icon.spec.js b/tests/unit/d2-icon.spec.js
index e07e86b8..7c683cfe 100644
--- a/tests/unit/d2-icon.spec.js
+++ b/tests/unit/d2-icon.spec.js
@@ -18,8 +18,8 @@ describe('d2-icon.vue', () => {
expect(wrapper.contains('.fa-font-awesome')).toBeTruthy()
})
- // name prop
- it('has a property named \'name\'', () => {
+ // props
+ it('has props', () => {
const wrapper = mount(D2Icon, {
propsData: {
name: 'font-awesome'
diff --git a/tests/unit/d2-source.spec.js b/tests/unit/d2-source.spec.js
index 333b12a7..fc349111 100644
--- a/tests/unit/d2-source.spec.js
+++ b/tests/unit/d2-source.spec.js
@@ -25,8 +25,8 @@ describe('d2-source.vue', () => {
}, 600)
})
- // filename prop
- it('has a property named \'filename\'', () => {
+ // props
+ it('has props', () => {
const wrapper = mount(D2Source, {
stubs: ['d2-icon'],
propsData: {
From 6fa832755610b2c190321c0cb32211679e25dcff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Sat, 5 Jan 2019 10:16:55 +0800
Subject: [PATCH 13/17] unit test: d2-icon-svg d2-link-btn
Former-commit-id: dac4516bf2f7c18c06310115e800c891f6f2ad6e [formerly dac4516bf2f7c18c06310115e800c891f6f2ad6e [formerly dac4516bf2f7c18c06310115e800c891f6f2ad6e [formerly dac4516bf2f7c18c06310115e800c891f6f2ad6e [formerly 69f4a652a91a6406e85af9f56d75e0deff6049bf [formerly e8da4ed40da1a6a5f57938914fc114cbae50ef56]]]]]
Former-commit-id: c84524e9212d0b3b11a01d0baa529af73bb2874f
Former-commit-id: 64e446eac758226d57ce5b02700596f8b1be9c3e
Former-commit-id: 9568c8329ed51f5c1367f61fc3ae59c8a2bcc67b [formerly 7d97100ddbd1c3bfbb88d560f83cec595d313b87]
Former-commit-id: 4ef6a34396e0a80837a462b6bc199eb49e66db2e
Former-commit-id: 8913eff75dff0dbf1c035733a5411cb79b07dffa
Former-commit-id: eef91026b0942b2267315cf1a8eb73c8b5622525
Former-commit-id: 12280ec0c000ccc4d39c7e99dacec12ddce920d0
Former-commit-id: d8031829cdf409c4524ce107480937ea8ba71bac
---
tests/unit/d2-icon-svg.spec.js | 27 +++++++++++++++++++++++++++
tests/unit/d2-link-btn.spec.js | 30 ++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+)
create mode 100644 tests/unit/d2-icon-svg.spec.js
create mode 100644 tests/unit/d2-link-btn.spec.js
diff --git a/tests/unit/d2-icon-svg.spec.js b/tests/unit/d2-icon-svg.spec.js
new file mode 100644
index 00000000..69f32043
--- /dev/null
+++ b/tests/unit/d2-icon-svg.spec.js
@@ -0,0 +1,27 @@
+import { mount } from '@vue/test-utils'
+import D2IconSvg from '@/components/d2-icon-svg/index.vue'
+
+describe('d2-icon-svg.vue', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2IconSvg, {
+ propsData: {
+ name: 'add'
+ }
+ })
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // props
+ it('has props', () => {
+ const wrapper = mount(D2IconSvg, {
+ propsData: {
+ name: 'add'
+ }
+ })
+
+ expect(wrapper.props().name).toEqual('add')
+ })
+})
diff --git a/tests/unit/d2-link-btn.spec.js b/tests/unit/d2-link-btn.spec.js
new file mode 100644
index 00000000..1539cd87
--- /dev/null
+++ b/tests/unit/d2-link-btn.spec.js
@@ -0,0 +1,30 @@
+import { mount } from '@vue/test-utils'
+import D2LinkBtn from '@/components/d2-link-btn/index.vue'
+
+describe('d2-link-btn', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2LinkBtn, {
+ stubs: ['el-button-group', 'el-button', 'd2-icon']
+ })
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // props
+ it('has props', () => {
+ const wrapper = mount(D2LinkBtn, {
+ stubs: ['el-button-group', 'el-button', 'd2-icon'],
+ propsData: {
+ title: 'title',
+ icon: 'icon',
+ link: 'link'
+ }
+ })
+
+ expect(wrapper.props().title).toEqual('title')
+ expect(wrapper.props().icon).toEqual('icon')
+ expect(wrapper.props().link).toEqual('link')
+ })
+})
From 59c5ffd751a5be73c4e85b495dafa33974d0e9e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Sat, 5 Jan 2019 10:18:44 +0800
Subject: [PATCH 14/17] no message
Former-commit-id: faefc4c6e727523a2e3cfee920c7f6b2f0b059aa [formerly faefc4c6e727523a2e3cfee920c7f6b2f0b059aa [formerly faefc4c6e727523a2e3cfee920c7f6b2f0b059aa [formerly faefc4c6e727523a2e3cfee920c7f6b2f0b059aa [formerly bdde2f0b3e39efac98f19601130b7ad9277284ab [formerly bc029c9b4beffa1cbfb2cf770a095fd02ae76b62]]]]]
Former-commit-id: b8e2d229a71661a8450363150629f205ad8a1fee
Former-commit-id: 3c4084ff94884082ad4e7f9b620b0270285ac56b
Former-commit-id: 2631c293b256421423f26b01acfe6fc7e7f81153 [formerly 04739fef9aea219063b7683b0f7396fb969c2275]
Former-commit-id: 5306047eae9b783386d3090cdf9f9431d4b57deb
Former-commit-id: 1d04632c22798a967256c7a5e6b5392f62c07e54
Former-commit-id: 437f55ac3308b54cf5e0c3ed0e8bf258fc4acb09
Former-commit-id: 340153cd8d7760323a6df93c9513f935b13d9440
Former-commit-id: c472df368e6f81c21531fd40f1fd09c440b337ac
---
tests/unit/d2-container-card-bs.spec.js | 2 +-
tests/unit/d2-container-card.spec.js | 2 +-
tests/unit/d2-container-frame.spec.js | 2 +-
tests/unit/d2-container-full-bs.spec.js | 2 +-
tests/unit/d2-container-full.spec.js | 2 +-
tests/unit/d2-container-ghost-bs.spec.js | 2 +-
tests/unit/d2-container-ghost.spec.js | 2 +-
tests/unit/d2-count-up.spec.js | 2 +-
tests/unit/d2-icon-select.spec.js | 2 +-
tests/unit/d2-icon-svg.spec.js | 2 +-
tests/unit/d2-icon.spec.js | 2 +-
tests/unit/d2-source.spec.js | 2 +-
12 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/tests/unit/d2-container-card-bs.spec.js b/tests/unit/d2-container-card-bs.spec.js
index 213067f7..cb3add27 100644
--- a/tests/unit/d2-container-card-bs.spec.js
+++ b/tests/unit/d2-container-card-bs.spec.js
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils'
import D2ContainerCardBs from '@/components/d2-container/components/d2-container-card-bs.vue'
-describe('d2-container-card-bs.vue', () => {
+describe('d2-container-card-bs', () => {
// 存在且是Vue组件实例
it('is a vue instance', () => {
const wrapper = mount(D2ContainerCardBs)
diff --git a/tests/unit/d2-container-card.spec.js b/tests/unit/d2-container-card.spec.js
index 50c2b15c..9989841d 100644
--- a/tests/unit/d2-container-card.spec.js
+++ b/tests/unit/d2-container-card.spec.js
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils'
import D2ContainerCard from '@/components/d2-container/components/d2-container-card.vue'
-describe('d2-container-card.vue', () => {
+describe('d2-container-card', () => {
// 存在且是Vue组件实例
it('is a vue instance', () => {
const wrapper = mount(D2ContainerCard)
diff --git a/tests/unit/d2-container-frame.spec.js b/tests/unit/d2-container-frame.spec.js
index 42a8e540..ccb5555f 100644
--- a/tests/unit/d2-container-frame.spec.js
+++ b/tests/unit/d2-container-frame.spec.js
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils'
import D2ContainerFrame from '@/components/d2-container-frame/index.vue'
-describe('d2-container-frame.vue', () => {
+describe('d2-container-frame', () => {
// 存在且是Vue组件实例
it('is a vue instance', () => {
const wrapper = mount(D2ContainerFrame, {
diff --git a/tests/unit/d2-container-full-bs.spec.js b/tests/unit/d2-container-full-bs.spec.js
index fd4d3ae4..2ed8c72f 100644
--- a/tests/unit/d2-container-full-bs.spec.js
+++ b/tests/unit/d2-container-full-bs.spec.js
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils'
import D2ContainerFullBs from '@/components/d2-container/components/d2-container-full-bs.vue'
-describe('d2-container-full-bs.vue', () => {
+describe('d2-container-full-bs', () => {
// 存在且是Vue组件实例
it('is a vue instance', () => {
const wrapper = mount(D2ContainerFullBs)
diff --git a/tests/unit/d2-container-full.spec.js b/tests/unit/d2-container-full.spec.js
index ec33b8cb..e187caf5 100644
--- a/tests/unit/d2-container-full.spec.js
+++ b/tests/unit/d2-container-full.spec.js
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils'
import D2ContainerFull from '@/components/d2-container/components/d2-container-full.vue'
-describe('d2-container-full.vue', () => {
+describe('d2-container-full', () => {
// 存在且是Vue组件实例
it('is a vue instance', () => {
const wrapper = mount(D2ContainerFull)
diff --git a/tests/unit/d2-container-ghost-bs.spec.js b/tests/unit/d2-container-ghost-bs.spec.js
index 7f6b09ad..7ff2d6ac 100644
--- a/tests/unit/d2-container-ghost-bs.spec.js
+++ b/tests/unit/d2-container-ghost-bs.spec.js
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils'
import D2ContainerGhostBs from '@/components/d2-container/components/d2-container-ghost-bs.vue'
-describe('d2-container-ghost-bs.vue', () => {
+describe('d2-container-ghost-bs', () => {
// 存在且是Vue组件实例
it('is a vue instance', () => {
const wrapper = mount(D2ContainerGhostBs, {
diff --git a/tests/unit/d2-container-ghost.spec.js b/tests/unit/d2-container-ghost.spec.js
index 3758463f..2b6f0bb1 100644
--- a/tests/unit/d2-container-ghost.spec.js
+++ b/tests/unit/d2-container-ghost.spec.js
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils'
import D2ContainerGhost from '@/components/d2-container/components/d2-container-ghost.vue'
-describe('d2-container-ghost.vue', () => {
+describe('d2-container-ghost', () => {
// 存在且是Vue组件实例
it('is a vue instance', () => {
const wrapper = mount(D2ContainerGhost)
diff --git a/tests/unit/d2-count-up.spec.js b/tests/unit/d2-count-up.spec.js
index b8b0e6b8..6f8b2213 100644
--- a/tests/unit/d2-count-up.spec.js
+++ b/tests/unit/d2-count-up.spec.js
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils'
import D2CountUp from '@/components/d2-count-up/index.vue'
-describe('d2-count-up.vue', () => {
+describe('d2-count-up', () => {
// 存在且是Vue组件实例
it('is a vue instance', () => {
const wrapper = mount(D2CountUp, {
diff --git a/tests/unit/d2-icon-select.spec.js b/tests/unit/d2-icon-select.spec.js
index 64c5a352..2c67fe78 100644
--- a/tests/unit/d2-icon-select.spec.js
+++ b/tests/unit/d2-icon-select.spec.js
@@ -2,7 +2,7 @@ import { mount, createLocalVue } from '@vue/test-utils'
import D2IconSelect from '@/components/d2-icon-select/index.vue'
import ElementUI from 'element-ui'
-describe('d2-icon-select.vue', () => {
+describe('d2-icon-select', () => {
const localVue = createLocalVue()
localVue.use(ElementUI)
diff --git a/tests/unit/d2-icon-svg.spec.js b/tests/unit/d2-icon-svg.spec.js
index 69f32043..afcb2071 100644
--- a/tests/unit/d2-icon-svg.spec.js
+++ b/tests/unit/d2-icon-svg.spec.js
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils'
import D2IconSvg from '@/components/d2-icon-svg/index.vue'
-describe('d2-icon-svg.vue', () => {
+describe('d2-icon-svg', () => {
// 存在且是Vue组件实例
it('is a vue instance', () => {
const wrapper = mount(D2IconSvg, {
diff --git a/tests/unit/d2-icon.spec.js b/tests/unit/d2-icon.spec.js
index 7c683cfe..7ebc651a 100644
--- a/tests/unit/d2-icon.spec.js
+++ b/tests/unit/d2-icon.spec.js
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils'
import D2Icon from '@/components/d2-icon/index.vue'
-describe('d2-icon.vue', () => {
+describe('d2-icon', () => {
// 存在且是Vue组件实例
it('is a vue instance', () => {
const wrapper = mount(D2Icon)
diff --git a/tests/unit/d2-source.spec.js b/tests/unit/d2-source.spec.js
index fc349111..d00cfb98 100644
--- a/tests/unit/d2-source.spec.js
+++ b/tests/unit/d2-source.spec.js
@@ -1,7 +1,7 @@
import { mount, createLocalVue } from '@vue/test-utils'
import D2Source from '@/components/d2-container/components/d2-source.vue'
-describe('d2-source.vue', () => {
+describe('d2-source', () => {
// 存在且是Vue组件实例
it('is a vue instance', () => {
const wrapper = mount(D2Source, {
From 038ce98e5f74188adb7c708050421dcb72d7def2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Sat, 5 Jan 2019 11:13:49 +0800
Subject: [PATCH 15/17] unit test: d2-module-index-banner
Former-commit-id: fc487302ba97576964432ff24b99c6e687d06672 [formerly fc487302ba97576964432ff24b99c6e687d06672 [formerly fc487302ba97576964432ff24b99c6e687d06672 [formerly fc487302ba97576964432ff24b99c6e687d06672 [formerly 3ce644c6fe3fc0e6617686b41fcd10da604c0434 [formerly 8afb73852c720f85b70b7e3f7e0f5fde2b160d68]]]]]
Former-commit-id: 86578fe55d249067355cb53631c14955273c87a3
Former-commit-id: 758553a45c4009274ca9796b88fe6593c42854fe
Former-commit-id: 4cf284ab8301b196d40c4528263ff9a87b63a753 [formerly 8ac7ed5acfcb1ea2ee8b8d5e7839bc29a37fd9f7]
Former-commit-id: d104856f24c0edbb908750468a314362526e83ed
Former-commit-id: 6699d330fd44a39340cabb39067d39f7abe52cbe
Former-commit-id: 67d9c3ddbe293b229b950c1f15e19d0293717411
Former-commit-id: 828fdd495ce25236fc162137b9472515790f37cf
Former-commit-id: 5c046db642e86c04fe8e8ae553ffe686c8083afc
---
package.json | 4 +--
tests/unit/d2-module-index-banner.spec.js | 30 +++++++++++++++++++++++
yarn.lock.REMOVED.git-id | 2 +-
3 files changed, 33 insertions(+), 3 deletions(-)
create mode 100644 tests/unit/d2-module-index-banner.spec.js
diff --git a/package.json b/package.json
index 4fa1aa50..17d7be40 100644
--- a/package.json
+++ b/package.json
@@ -56,10 +56,10 @@
"@kazupon/vue-i18n-loader": "^0.3.0",
"@vue/cli-plugin-babel": "^3.0.0",
"@vue/cli-plugin-eslint": "^3.0.0",
- "@vue/cli-plugin-unit-jest": "^3.0.0",
+ "@vue/cli-plugin-unit-jest": "^3.2.3",
"@vue/cli-service": "^3.0.0",
"@vue/eslint-config-standard": "^3.0.0",
- "@vue/test-utils": "^1.0.0-beta.20",
+ "@vue/test-utils": "^1.0.0-beta.28",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^23.0.1",
"lint-staged": "^7.2.0",
diff --git a/tests/unit/d2-module-index-banner.spec.js b/tests/unit/d2-module-index-banner.spec.js
new file mode 100644
index 00000000..8335bdcd
--- /dev/null
+++ b/tests/unit/d2-module-index-banner.spec.js
@@ -0,0 +1,30 @@
+import { mount } from '@vue/test-utils'
+import D2ModuleIndexBanner from '@/components/d2-module-index-banner/index.vue'
+
+describe('d2-module-index-banner', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2ModuleIndexBanner, {
+ stubs: ['d2-icon']
+ })
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // props
+ it('has props', () => {
+ const wrapper = mount(D2ModuleIndexBanner, {
+ stubs: ['d2-icon'],
+ propsData: {
+ title: 'title',
+ subTitle: 'subTitle',
+ link: 'link'
+ }
+ })
+
+ expect(wrapper.props().title).toEqual('title')
+ expect(wrapper.props().subTitle).toEqual('subTitle')
+ expect(wrapper.props().link).toEqual('link')
+ })
+})
diff --git a/yarn.lock.REMOVED.git-id b/yarn.lock.REMOVED.git-id
index 7c7b5986..58f48f61 100644
--- a/yarn.lock.REMOVED.git-id
+++ b/yarn.lock.REMOVED.git-id
@@ -1 +1 @@
-f087314ad07f2b4d7658559be7838c8dd75bf499
\ No newline at end of file
+13dd0eb82ec0a73b25d0a39fe23a367f31a2aaf8
\ No newline at end of file
From 69551c5afa2628766d8a1ca005ca04ff2a5e80fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Sat, 5 Jan 2019 13:43:48 +0800
Subject: [PATCH 16/17] test unit: d2-module-index-menu
Former-commit-id: 8eeb1f1c897e306b0f76d8e7faf2b785a28ee80f [formerly 8eeb1f1c897e306b0f76d8e7faf2b785a28ee80f [formerly 8eeb1f1c897e306b0f76d8e7faf2b785a28ee80f [formerly 8eeb1f1c897e306b0f76d8e7faf2b785a28ee80f [formerly e6938e58db88e2e5857c3dddef8ae4d978a0a98c [formerly 3c43aecc4eeaef75aeebb74b21a357574830a5d2]]]]]
Former-commit-id: 72e71967a8ae4e5865837c6b7adcf56c610a096d
Former-commit-id: 5617cf5c00326a09148f33f20865db85cbee4aab
Former-commit-id: 745207dbc2ffa248c38bdd2593de37c622719cbe [formerly 76533a188618268d796eadd0f740fe4b1bb2c712]
Former-commit-id: 5a318187d62a33df65d321c755c5945e0a574936
Former-commit-id: 46496e8c6ea56714594df7c26a7efe7eba1b601a
Former-commit-id: 95fdbf702145f90678b51e44c943671cc895419b
Former-commit-id: b2b95ddb9cd27f8b12fdcff9a67a9e3536165a41
Former-commit-id: 142b535174ef9657ff743c3b0f2c0866d009a26a
---
tests/unit/d2-module-index-menu.spec.js | 36 +++++++++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 tests/unit/d2-module-index-menu.spec.js
diff --git a/tests/unit/d2-module-index-menu.spec.js b/tests/unit/d2-module-index-menu.spec.js
new file mode 100644
index 00000000..75298d71
--- /dev/null
+++ b/tests/unit/d2-module-index-menu.spec.js
@@ -0,0 +1,36 @@
+import { mount } from '@vue/test-utils'
+import D2ModuleIndexMenu from '@/components/d2-module-index-menu/index.vue'
+import menu from '@/menu/modules/demo-business'
+
+describe('d2-module-index-menu', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2ModuleIndexMenu, {
+ stubs: ['el-button'],
+ propsData: {
+ menu
+ }
+ })
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // 300m后正确渲染,包含特定类名
+ it('contains specific classnames', (done) => {
+ const wrapper = mount(D2ModuleIndexMenu, {
+ stubs: ['el-button'],
+ propsData: {
+ menu: menu
+ }
+ })
+
+ setTimeout(() => {
+ expect(wrapper.is('.d2-module-index-menu')).toBeTruthy()
+ expect(wrapper.contains('.d2-module-index-menu-group')).toBeTruthy()
+ expect(wrapper.contains('.d2-module-index-menu-group--title')).toBeTruthy()
+ expect(wrapper.contains('.d2-module-index-menu-item')).toBeTruthy()
+ done()
+ }, 400)
+ })
+})
From a5a5214768d1e7030c695914bc35e840f00ba737 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=98=8A=E7=BF=94?= <673686754@qq.com>
Date: Sat, 5 Jan 2019 13:56:01 +0800
Subject: [PATCH 17/17] unit test: d2-page-cover
Former-commit-id: b8af4e80b700b9dd89a83979e76c386c9673100f [formerly b8af4e80b700b9dd89a83979e76c386c9673100f [formerly b8af4e80b700b9dd89a83979e76c386c9673100f [formerly b8af4e80b700b9dd89a83979e76c386c9673100f [formerly d5214134e68bdedeb74b120641a5840a2af10b84 [formerly 76488a335bc0512b0bc637a6790cff8a0189abe1]]]]]
Former-commit-id: e6b5fcd65ace783df85f8069a499f4f3f0f0dc59
Former-commit-id: 688e557e62c24ffdccbcd47ca72eab77dd41b5b8
Former-commit-id: 3bd0f57f281affe5fe3961a560fedc4d34e15033 [formerly 477e3ca31e3c90105f27e667f1c810e06a270264]
Former-commit-id: 4734aee87fe4ebfc6b53f4807b74827479c34052
Former-commit-id: 76238a54f93938981d6a44ab6f5d2b1e900c05df
Former-commit-id: 5cfbe6b537d02530f9455400b725b881a28ffabd
Former-commit-id: 97fdf0aedf6afc759d707c56f0414b2888043c53
Former-commit-id: 807db838e760e4c85691899e2cf3ab7f88c909be
---
tests/unit/d2-page-cover.spec.js | 41 ++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
create mode 100644 tests/unit/d2-page-cover.spec.js
diff --git a/tests/unit/d2-page-cover.spec.js b/tests/unit/d2-page-cover.spec.js
new file mode 100644
index 00000000..b6b6ca22
--- /dev/null
+++ b/tests/unit/d2-page-cover.spec.js
@@ -0,0 +1,41 @@
+import { mount } from '@vue/test-utils'
+import D2PageCover from '@/components/d2-page-cover/index.vue'
+
+describe('d2-page-cover', () => {
+ // 存在且是Vue组件实例
+ it('is a vue instance', () => {
+ const wrapper = mount(D2PageCover)
+
+ expect(wrapper.exists()).toBeTruthy()
+ expect(wrapper.isVueInstance()).toBeTruthy()
+ })
+
+ // 包含特定类名
+ it('contains specific classnames', () => {
+ const wrapper = mount(D2PageCover, {
+ slots: {
+ default: '
default
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.is('.d2-page-cover')).toBeTruthy()
+ expect(wrapper.contains('.d2-page-cover__logo')).toBeTruthy()
+ expect(wrapper.contains('.d2-page-cover__title')).toBeTruthy()
+ expect(wrapper.contains('.d2-page-cover__sub-title')).toBeTruthy()
+ expect(wrapper.contains('.d2-page-cover__build-time')).toBeTruthy()
+ })
+
+ // 渲染slot
+ it('has one or more slots', () => {
+ const wrapper = mount(D2PageCover, {
+ slots: {
+ default: '
default
',
+ footer: '
footer
'
+ }
+ })
+
+ expect(wrapper.text()).toMatch('default')
+ expect(wrapper.text()).toMatch('footer')
+ })
+})