-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cole
committed
Jun 14, 2024
1 parent
1a53143
commit 35b491a
Showing
7 changed files
with
148 additions
and
51 deletions.
There are no files selected for viewing
48 changes: 0 additions & 48 deletions
48
src/packages/base-field/__tests__/__snapshots__/index.test.js.snap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { mount } from '@vue/test-utils' | ||
import { describe, expect, it } from 'vitest' | ||
import { Form, Text } from '../index' | ||
|
||
describe('Form', () => { | ||
it('render', async () => { | ||
const wrapper = mount(Form, { | ||
slots: { | ||
default: () => { | ||
return [ | ||
<Text name={'text'}/> | ||
] | ||
} | ||
} | ||
}) | ||
expect(wrapper.exists()).toBeTruthy() | ||
}) | ||
}) |
33 changes: 33 additions & 0 deletions
33
src/packages/locale-provider/__tests__/LocaleProvider.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { mount } from '@vue/test-utils' | ||
import { describe, expect, it } from 'vitest' | ||
import LocaleProvider, { useLocaleReceiver } from '../index' | ||
import enUS from '../lang/en-US' | ||
|
||
describe('LocaleProvider', () => { | ||
it('render', async () => { | ||
const wrapper = mount(LocaleProvider, { | ||
slots: { | ||
default: () => { | ||
const { t } = useLocaleReceiver() | ||
return (<div>{t('open')}</div>) | ||
} | ||
} | ||
}) | ||
expect(wrapper.exists()).toBeTruthy() | ||
// 切换语言 | ||
await wrapper.setProps({ locale: enUS }) | ||
expect(wrapper.exists()).toBeTruthy() | ||
}) | ||
|
||
it('translate path', () => { | ||
const wrapper = mount(LocaleProvider, { | ||
slots: { | ||
default: () => { | ||
const { t } = useLocaleReceiver('Table') | ||
return (<div>{t(['toolbar', 'reload'])}</div>) | ||
} | ||
} | ||
}) | ||
expect(wrapper.exists()).toBeTruthy() | ||
}) | ||
}) |
18 changes: 18 additions & 0 deletions
18
src/packages/resize-observer/__tests__/ResizeObserver.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { mount } from '@vue/test-utils' | ||
import { describe, expect, it } from 'vitest' | ||
import ResizeObserver from '../index' | ||
|
||
describe('ResizeObserver', () => { | ||
it('render', async () => { | ||
const wrapper = mount(ResizeObserver, { | ||
slots: { | ||
default: () => { | ||
return ( | ||
<div style={{ height: '200px' }}/> | ||
) | ||
} | ||
} | ||
}) | ||
expect(wrapper.exists()).toBeTruthy() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { mount } from '@vue/test-utils' | ||
import { describe, expect, it } from 'vitest' | ||
import { Table } from '../index' | ||
import ColumnSetting from '../components/column-setting' | ||
import { Tooltip } from 'ant-design-vue' | ||
|
||
describe('Table', () => { | ||
it('render', async () => { | ||
const wrapper = mount(Table, { | ||
props: { | ||
columns: [ | ||
{ | ||
title: 'test1', | ||
dataIndex: 'test1' | ||
}, | ||
{ | ||
title: 'test2', | ||
dataIndex: 'test2' | ||
} | ||
], | ||
dataSource: [ | ||
{ | ||
test1: 'test1', | ||
test2: 'test2' | ||
} | ||
] | ||
} | ||
}) | ||
expect(wrapper.exists()).toBeTruthy() | ||
// column-setting | ||
const columnSetting = wrapper.findComponent(ColumnSetting) | ||
const button = columnSetting.get('button') | ||
button.trigger('click') | ||
}) | ||
|
||
it('render slots', async () => { | ||
const wrapper = mount(Table, { | ||
props: { | ||
columns: [ | ||
{ | ||
title: 'test1', | ||
dataIndex: 'test1' | ||
}, | ||
{ | ||
title: 'test2', | ||
dataIndex: 'test2' | ||
} | ||
], | ||
request: () => { | ||
return Promise.resolve({ | ||
data: [ | ||
{ | ||
test1: 'test1', | ||
test2: 'test2' | ||
} | ||
] | ||
}) | ||
} | ||
}, | ||
slots: { | ||
extra: () => { | ||
return (<Tooltip>Extra</Tooltip>) | ||
} | ||
} | ||
}) | ||
expect(wrapper.exists()).toBeTruthy() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters