|
| 1 | +import React from 'react'; |
| 2 | +import { Link } from 'react-router'; |
| 3 | + |
| 4 | +import { shallowRender } from 'tests/client/helpers'; |
| 5 | +import { NavBar, NavBarItem, NavBarLink } from 'core/components/NavBar'; |
| 6 | + |
| 7 | +describe('<NavBarItem />', () => { |
| 8 | + it('wraps its children in a span', () => { |
| 9 | + const root = shallowRender(<NavBarItem>Foo</NavBarItem>); |
| 10 | + assert.equal(root.props.className, 'NavBarItem'); |
| 11 | + assert.equal(root.type, 'span'); |
| 12 | + assert.equal(root.props.children, 'Foo'); |
| 13 | + }); |
| 14 | +}); |
| 15 | + |
| 16 | +describe('<NavBarLink />', () => { |
| 17 | + it('wraps its children in a span', () => { |
| 18 | + const root = shallowRender(<NavBarLink to="/bar">Baileys Taproom</NavBarLink>); |
| 19 | + assert.equal(root.type, NavBarItem); |
| 20 | + assert.equal(root.props.children.type, Link); |
| 21 | + assert.equal(root.props.children.props.to, '/bar'); |
| 22 | + assert.equal(root.props.children.props.children, 'Baileys Taproom'); |
| 23 | + }); |
| 24 | +}); |
| 25 | + |
| 26 | +describe('<NavBar />', () => { |
| 27 | + it('wraps its children in a div', () => { |
| 28 | + const root = shallowRender(<NavBar>Navigate places!</NavBar>); |
| 29 | + assert.equal(root.type, 'div'); |
| 30 | + assert.equal(root.props.className, 'NavBar'); |
| 31 | + assert.equal(root.props.children, 'Navigate places!'); |
| 32 | + }); |
| 33 | +}); |
0 commit comments