@@ -110,8 +110,14 @@ describe('utils/router', () => {
110
110
111
111
it('parses nothing to default', async () => {
112
112
expect(computeHref()).toEqual('#')
113
-
expect(computeHref(undefined, '/', '')).toEqual('/')
114
-
expect(computeHref(undefined, '', '')).toEqual('')
113
+
expect(computeHref(undefined, undefined, '/', '')).toEqual('/')
114
+
expect(computeHref(undefined, undefined, '', '')).toEqual('')
115
+
})
116
+
117
+
it('returns null when tag is not `a`', async () => {
118
+
expect(computeHref({}, 'div')).toEqual(null)
119
+
expect(computeHref(undefined, 'div', '/', '')).toEqual(null)
120
+
expect(computeHref(undefined, 'span', '', '/')).toEqual(null)
115
121
})
116
122
117
123
it('returns href when both href and to provided', async () => {
@@ -124,8 +130,8 @@ describe('utils/router', () => {
124
130
125
131
it('parses empty `href` to default', async () => {
126
132
expect(computeHref({ href: '' })).toEqual('#')
127
-
expect(computeHref({ href: '' }, '/', '')).toEqual('/')
128
-
expect(computeHref({ href: '' }, '', '')).toEqual('')
133
+
expect(computeHref({ href: '' }, 'a', '/', '')).toEqual('/')
134
+
expect(computeHref({ href: '' }, 'a', '', '')).toEqual('')
129
135
})
130
136
131
137
it('parses `to` when string', async () => {
@@ -173,8 +179,8 @@ describe('utils/router', () => {
173
179
174
180
it('parses empty `to` to fallback default', async () => {
175
181
expect(computeHref({ to: {} })).toEqual('#')
176
-
expect(computeHref({ to: {} }, '#', '')).toEqual('#')
177
-
expect(computeHref({ to: {} }, '/', '#')).toEqual('/')
182
+
expect(computeHref({ to: {} }, 'a', '#', '')).toEqual('#')
183
+
expect(computeHref({ to: {} }, 'a', '/', '#')).toEqual('/')
178
184
})
179
185
180
186
it('parses complete `to`', async () => {
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4