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组件实例