File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,13 @@ import { defineComponent, h } from 'vue'
33const CFooter = defineComponent ( {
44 name : 'CFooter' ,
55 props : {
6+ /**
7+ * Component used for the root node. Either a string to use a HTML element or a component.
8+ */
9+ as : {
10+ type : String ,
11+ default : 'div' ,
12+ } ,
613 /**
714 * Place footer in non-static positions.
815 *
@@ -18,7 +25,7 @@ const CFooter = defineComponent({
1825 setup ( props , { slots } ) {
1926 return ( ) =>
2027 h (
21- 'div' ,
28+ props . as ,
2229 { class : [ 'footer' , { [ `footer-${ props . position } ` ] : props . position } ] } ,
2330 slots . default && slots . default ( ) ,
2431 )
Original file line number Diff line number Diff line change @@ -19,6 +19,15 @@ const customWrapper = mount(Component, {
1919 } ,
2020} )
2121
22+ const customWrapperTwo = mount ( Component , {
23+ propsData : {
24+ as : 'footer' ,
25+ } ,
26+ slots : {
27+ default : 'Default slot' ,
28+ } ,
29+ } )
30+
2231describe ( `Loads and display ${ ComponentName } component` , ( ) => {
2332 it ( 'has a name' , ( ) => {
2433 expect ( Component . name ) . toMatch ( ComponentName )
@@ -42,3 +51,13 @@ describe(`Customize ${ComponentName} component`, () => {
4251 expect ( customWrapper . classes ( 'footer-fixed' ) ) . toBe ( true )
4352 } )
4453} )
54+
55+ describe ( `Customize (number two) ${ ComponentName } component` , ( ) => {
56+ it ( 'renders correctly' , ( ) => {
57+ expect ( customWrapperTwo . html ( ) ) . toMatchSnapshot ( )
58+ } )
59+
60+ it ( 'tag name is custom' , ( ) => {
61+ expect ( customWrapperTwo . element . tagName ) . toBe ( 'FOOTER' )
62+ } )
63+ } )
You can’t perform that action at this time.
0 commit comments