import { mount } from '@vue/test-utils' import { describe, expect, test } from 'vitest' import { getCssVariable } from '@element-plus/test-utils/dom' import Container from '../src/container.vue' import Header from '../src/header.vue' import Main from '../src/main.vue' import Aside from '../src/aside.vue' import Footer from '../src/footer.vue' const AXIOM = 'Rem is the best girl' describe('Container.vue', () => { test('container render test', async () => { const wrapper = mount(() => {AXIOM}) expect(wrapper.text()).toEqual(AXIOM) }) test('vertical', () => { const wrapper = mount(() => (
)) expect(wrapper.classes('is-vertical')).toBe(true) }) test('direction', () => { const wrapper = mount({ data: () => ({ direction: 'horizontal' }), render() { return (
) }, }) expect(wrapper.vm.$el.classList.contains('is-vertical')).toBe(false) wrapper.vm.direction = 'vertical' wrapper.vm.$nextTick(() => { expect(wrapper.vm.$el.classList.contains('is-vertical')).toBe(true) }) }) }) describe('Header', () => { test('create header', () => { const wrapper = mount(() =>
) expect(wrapper.classes()).toContain('el-header') }) test('header height', () => { const wrapper = mount(() =>
) const vm = wrapper.vm expect(getCssVariable(vm.$el, '--el-header-height')).toEqual('100px') }) }) describe('Aside', () => { test('aside create', () => { const wrapper = mount(() =>