Skip to content

Commit

Permalink
feat($linktag): Added test case for navigation links with custom tags
Browse files Browse the repository at this point in the history
  • Loading branch information
swernerx committed Aug 16, 2017
1 parent 06c9f3d commit 65b0991
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
29 changes: 29 additions & 0 deletions __tests__/NavLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,32 @@ test('isActive return false', () => {

expect(tree).toMatchSnapshot()
})

it('supports custom HTML tag name', () => {
const { tree, store } = createNavLink('/first', {
to: '/second',
activeClassName: 'active',
tagName: 'div'
}) /*? $.tree */

expect(tree).toMatchSnapshot()
})

it('supports custom HTML tag name in active mode', () => {
const { tree, store } = createNavLink('/first', {
to: '/first',
activeClassName: 'active',
tagName: 'div'
}) /*? $.tree */

expect(tree).toMatchSnapshot()
})

it('supports custom HTML tag name which is still a link', () => {
const { tree, store } = createNavLink('/first', {
to: 'somewhere',
tagName: 'a'
}) /*? $.tree */

expect(tree).toMatchSnapshot()
})
25 changes: 25 additions & 0 deletions __tests__/__snapshots__/NavLink.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,28 @@ exports[`show activeStyle 1`] = `
}
/>
`;

exports[`supports custom HTML tag name 1`] = `
<div
className={undefined}
onClick={[Function]}
style={undefined}
/>
`;

exports[`supports custom HTML tag name in active mode 1`] = `
<div
className="active"
onClick={[Function]}
style={Object {}}
/>
`;

exports[`supports custom HTML tag name which is still a link 1`] = `
<a
className={undefined}
href="somewhere"
onClick={[Function]}
style={undefined}
/>
`;

0 comments on commit 65b0991

Please # to comment.