File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -96,3 +96,32 @@ test('isActive return false', () => {
96
96
97
97
expect ( tree ) . toMatchSnapshot ( )
98
98
} )
99
+
100
+ it ( 'supports custom HTML tag name' , ( ) => {
101
+ const { tree, store } = createNavLink ( '/first' , {
102
+ to : '/second' ,
103
+ activeClassName : 'active' ,
104
+ tagName : 'div'
105
+ } ) /*? $.tree */
106
+
107
+ expect ( tree ) . toMatchSnapshot ( )
108
+ } )
109
+
110
+ it ( 'supports custom HTML tag name in active mode' , ( ) => {
111
+ const { tree, store } = createNavLink ( '/first' , {
112
+ to : '/first' ,
113
+ activeClassName : 'active' ,
114
+ tagName : 'div'
115
+ } ) /*? $.tree */
116
+
117
+ expect ( tree ) . toMatchSnapshot ( )
118
+ } )
119
+
120
+ it ( 'supports custom HTML tag name which is still a link' , ( ) => {
121
+ const { tree, store } = createNavLink ( '/first' , {
122
+ to : 'somewhere' ,
123
+ tagName : 'a'
124
+ } ) /*? $.tree */
125
+
126
+ expect ( tree ) . toMatchSnapshot ( )
127
+ } )
Original file line number Diff line number Diff line change @@ -147,3 +147,28 @@ exports[`show activeStyle 1`] = `
147
147
}
148
148
/>
149
149
` ;
150
+
151
+ exports [` supports custom HTML tag name 1` ] = `
152
+ <div
153
+ className = { undefined }
154
+ onClick = { [Function ]}
155
+ style = { undefined }
156
+ />
157
+ ` ;
158
+
159
+ exports [` supports custom HTML tag name in active mode 1` ] = `
160
+ <div
161
+ className = " active"
162
+ onClick = { [Function ]}
163
+ style = { Object {}}
164
+ />
165
+ ` ;
166
+
167
+ exports [` supports custom HTML tag name which is still a link 1` ] = `
168
+ <a
169
+ className = { undefined }
170
+ href = " somewhere"
171
+ onClick = { [Function ]}
172
+ style = { undefined }
173
+ />
174
+ ` ;
You can’t perform that action at this time.
0 commit comments