提交 ee8a872c 编写于 作者: Y yurj26

feat(button): test

上级 122546b5
......@@ -35,9 +35,8 @@ describe('Button.uvue', () => {
expect(await textBtn.text()).toEqual('button')
})
it('type', async () => {
// TODO 目前获取组件属性只能通过组件的name,并且拿到的是最后一个
const btn = await page.$('Button')
expect(await btn.property('type')).toBe('warn')
const btn = await page.$('.test-button')
expect(await btn.property('type')).toBe('primary')
await page.setData({
type: 'default'
})
......@@ -50,19 +49,16 @@ describe('Button.uvue', () => {
expect(await btn.property('type')).toBe('warn')
})
it('size', async () => {
const btn = await page.$('Button')
expect(await btn.property('size')).toBe('mini')
await page.setData({
size: 'default'
})
await page.waitFor(500)
const btn = await page.$('.test-button')
expect(await btn.property('size')).toBe('default')
await page.setData({
size: 'mini'
})
await page.waitFor(500)
expect(await btn.property('size')).toBe('mini')
})
it('plain', async () => {
const btn = await page.$('Button')
const btn = await page.$('.test-button')
expect(await btn.property('plain')).toBe(false)
await page.setData({
plain: true
......@@ -71,7 +67,7 @@ describe('Button.uvue', () => {
expect(await btn.property('plain')).toBe(true)
})
it('disabled', async () => {
const btn = await page.$('Button')
const btn = await page.$('.test-button')
expect(await btn.property('disabled')).toBe(false)
await page.setData({
disabled: true
......
......@@ -2,7 +2,8 @@
<view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<button type="primary" class="button test-button">页面主操作 Normal</button>
<button :type="type" :size="size" :plain="plain" :disabled="disabled" class="button test-button">页面主操作
Normal</button>
<!-- <button type="primary" :loading="loading" class="button">页面主操作 Loading</button> -->
<button type="primary" :disabled="true" class="button">页面主操作 Disabled</button>
......@@ -24,8 +25,7 @@
<view class="uni-flex uni-row">
<button class="button mini-btn" type="primary" size="mini">按钮</button>
<button class="button mini-btn" type="default" size="mini">按钮</button>
<button class="button mini-btn" :type="type" :size="size" :plain="plain"
:disabled="disabled">按钮</button>
<button class="button mini-btn" type="warn" size="mini">按钮</button>
</view>
</view>
</view>
......@@ -39,8 +39,8 @@
loading: false,
_timer: 0,
text: '按钮',
type: 'warn',
size: 'mini',
type: 'primary',
size: 'default',
plain: false,
disabled: false,
count: 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册