mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-03 11:47:48 +08:00
feat: add button group
This commit is contained in:
parent
9ee4a188e4
commit
277661d9d1
@ -1,5 +1,6 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import Button from '../src/index.vue'
|
||||
import Button from '../src/button.vue'
|
||||
import ButtonGroup from '../src/button-group.vue'
|
||||
|
||||
const AXIOM = 'Rem is the best girl'
|
||||
const COMMON_CONFIG = {
|
||||
@ -127,3 +128,21 @@ describe('Button.vue', () => {
|
||||
})
|
||||
|
||||
})
|
||||
describe('Button Group', () => {
|
||||
const TestComponent = {
|
||||
template: `<el-button-group>
|
||||
<el-button type="primary">上一页</el-button>
|
||||
<el-button type="primary">下一页</el-button>
|
||||
</el-button-group>`,
|
||||
components: {
|
||||
'el-button-group': ButtonGroup,
|
||||
'el-button': Button,
|
||||
},
|
||||
}
|
||||
|
||||
it('create', () => {
|
||||
const wrapper = mount(TestComponent)
|
||||
expect(wrapper.classes()).toContain('el-button-group')
|
||||
expect(wrapper.findAll('button').length).toBe(2)
|
||||
})
|
||||
})
|
||||
|
@ -4,3 +4,7 @@ export default {
|
||||
|
||||
export const NormalButton = (): string => '<el-button>With Text</el-button>'
|
||||
export const ButtonTwo = (): string => '<el-button>button two</el-button>'
|
||||
export const ButtonGroup = (): string => `<el-button-group>
|
||||
<el-button type="primary" icon="el-icon-arrow-left">上一页</el-button>
|
||||
<el-button type="primary">下一页<i class="el-icon-arrow-right el-icon--right"></i></el-button>
|
||||
</el-button-group>`
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { App } from 'vue'
|
||||
import Button from './src/index.vue'
|
||||
import Button from './src/button.vue'
|
||||
import ButtonGroup from './src/button-group.vue'
|
||||
|
||||
export default (app: App): void => {
|
||||
app.component(Button.name, Button)
|
||||
app.component(ButtonGroup.name, ButtonGroup)
|
||||
}
|
||||
|
10
packages/button/src/button-group.vue
Normal file
10
packages/button/src/button-group.vue
Normal file
@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<div class="el-button-group">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
<script lang='ts'>
|
||||
export default {
|
||||
name: 'ElButtonGroup',
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user