Skip to content

Commit 2a2333d

Browse files
committed
feat: add CWrapper template component
1 parent 93be1b4 commit 2a2333d

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

src/components/index.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -671,4 +671,10 @@ export declare class CWidgetSimple extends Vue {
671671
text: string
672672
}
673673

674+
export declare class CWrapper extends Vue {
675+
fluid: boolean
676+
tag: string
677+
}
678+
679+
674680

src/components/template/CWrapper.vue

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<template>
2+
<component :is="tag" :class="classList">
3+
<slot></slot>
4+
</component>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'CWrapper',
10+
props: {
11+
tag: {
12+
type: String,
13+
default: 'div'
14+
},
15+
fluid: {
16+
type: Boolean,
17+
default: false
18+
}
19+
},
20+
computed: {
21+
classList () {
22+
return [
23+
'c-wrapper',
24+
{ 'c-wrapper-fluid' : this.fluid }
25+
]
26+
}
27+
}
28+
}
29+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { mount } from '@vue/test-utils'
2+
import Component from '../CWrapper'
3+
4+
const ComponentName = 'CWrapper'
5+
const wrapper = mount(Component)
6+
7+
8+
describe(`${ComponentName}.vue`, () => {
9+
it('has a name', () => {
10+
expect(Component.name).toBe(ComponentName)
11+
})
12+
it('renders correctly', () => {
13+
expect(wrapper.element).toMatchSnapshot()
14+
})
15+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`CWrapper.vue renders correctly 1`] = `
4+
<div
5+
class="c-wrapper c-fixed-components"
6+
/>
7+
`;

0 commit comments

Comments
 (0)