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', () => {