@financial-times/dotcom-ui-header 8.2.2 → 8.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/components/drawer/additionalPartials.d.ts +0 -1
- package/dist/node/components/drawer/additionalPartials.js +10 -5
- package/dist/node/components/drawer/topLevelPartials.d.ts +0 -1
- package/dist/node/components/navigation/partials.d.ts +0 -1
- package/dist/node/components/search/partials.d.ts +0 -1
- package/dist/node/components/sub-navigation/partials.d.ts +0 -1
- package/dist/node/components/svg-components/BrandFtMasthead.d.ts +0 -1
- package/dist/node/components/top/partials.d.ts +0 -1
- package/dist/node/index.d.ts +0 -1
- package/dist/node/utils.js +2 -1
- package/dist/tsconfig.tsbuildinfo +788 -82
- package/package.json +2 -2
- package/src/__test__/output/component.spec.tsx +113 -0
- package/src/__test__/output/drawer.spec.tsx +124 -0
- package/src/__test__/enzyme/component.spec.tsx +0 -107
- package/src/__test__/enzyme/drawer.spec.tsx +0 -114
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/dotcom-ui-header",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "browser.js",
|
|
6
6
|
"main": "component.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"author": "",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@financial-times/dotcom-types-navigation": "^8.2.
|
|
25
|
+
"@financial-times/dotcom-types-navigation": "^8.2.3",
|
|
26
26
|
"n-topic-search": "^4.0.0",
|
|
27
27
|
"n-ui-foundations": "^9.0.0"
|
|
28
28
|
},
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react'
|
|
5
|
+
import { render } from '@testing-library/react'
|
|
6
|
+
|
|
7
|
+
import dataFixture from '../../__stories__/story-data/index'
|
|
8
|
+
import { Header } from '../../index'
|
|
9
|
+
|
|
10
|
+
// data.currentPath to enable the mobile header
|
|
11
|
+
const headerFixture = {
|
|
12
|
+
...dataFixture,
|
|
13
|
+
data: { ...dataFixture.data, currentPath: '/' }
|
|
14
|
+
}
|
|
15
|
+
const subscribedUserFixture = { ...dataFixture, showUserNavigation: true, userIsSubscribed: true }
|
|
16
|
+
const loggedInUserFixture = { ...dataFixture, showUserNavigation: true }
|
|
17
|
+
const anonymousUserFixture = {
|
|
18
|
+
...dataFixture,
|
|
19
|
+
userIsAnonymous: true,
|
|
20
|
+
userIsLoggedIn: false,
|
|
21
|
+
showUserNavigation: true
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const commonHeader = <Header {...headerFixture} />
|
|
25
|
+
const subscribedUserHeader = <Header {...subscribedUserFixture} />
|
|
26
|
+
const loggedInUserHeader = <Header {...loggedInUserFixture} />
|
|
27
|
+
const anonymousUserHeader = <Header {...anonymousUserFixture} />
|
|
28
|
+
|
|
29
|
+
describe('dotcom-ui-header', () => {
|
|
30
|
+
it('renders the expected common header elements', () => {
|
|
31
|
+
const { container } = render(commonHeader)
|
|
32
|
+
|
|
33
|
+
const logo = container.querySelector('div[data-trackable="header-top"] .o-header__top-logo')
|
|
34
|
+
expect(logo?.hasChildNodes()).toBe(true)
|
|
35
|
+
|
|
36
|
+
const myFtLink = container.querySelector('div[data-trackable="header-top"] .o-header__top-icon-link--myft')
|
|
37
|
+
expect(myFtLink?.innerHTML).toContain('myFT')
|
|
38
|
+
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('renders an inlined SVG logo image', () => {
|
|
42
|
+
const { container } = render(commonHeader)
|
|
43
|
+
|
|
44
|
+
const logo = container.querySelector('div[data-trackable="header-top"] .o-header__top-logo')
|
|
45
|
+
expect(logo?.hasChildNodes()).toBe(true)
|
|
46
|
+
expect(logo?.innerHTML).toContain('Financial Times')
|
|
47
|
+
expect(logo?.querySelector('div[data-trackable="header-top"] .o-header__top-logo svg')).not.toBeNull()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('renders the sticky header', () => {
|
|
51
|
+
const { container } = render(commonHeader)
|
|
52
|
+
const header = container.querySelector('.o-header--sticky')
|
|
53
|
+
expect(header).not.toBeNull()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('renders the mobile header', () => {
|
|
57
|
+
const { container } = render(commonHeader)
|
|
58
|
+
const mobileHeader = container.querySelector('#o-header-nav-mobile')
|
|
59
|
+
expect(mobileHeader).not.toBeNull()
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
describe('When the user is subscribed', () => {
|
|
63
|
+
it('renders the expected logged in user header links', () => {
|
|
64
|
+
const { container } = render(subscribedUserHeader)
|
|
65
|
+
|
|
66
|
+
expect(container.querySelector('a[data-trackable="Portfolio"]')).not.toBeNull()
|
|
67
|
+
expect(container.querySelector('a[data-trackable="Settings & Account"]')).not.toBeNull()
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('does not render sign in link', () => {
|
|
71
|
+
const { container } = render(subscribedUserHeader)
|
|
72
|
+
|
|
73
|
+
expect(container.querySelector('a[data-trackable="Subscribe"]')).toBeNull()
|
|
74
|
+
expect(container.querySelector('a[data-trackable="Sign In"]')).toBeNull()
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
describe('When the user is logged in', () => {
|
|
79
|
+
it('renders the expected logged in user header links', () => {
|
|
80
|
+
const { container } = render(loggedInUserHeader)
|
|
81
|
+
|
|
82
|
+
expect(container.querySelector('a[data-trackable="Portfolio"]')).not.toBeNull()
|
|
83
|
+
expect(container.querySelector('a[data-trackable="Settings & Account"]')).not.toBeNull()
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('does not render sign in link', () => {
|
|
87
|
+
const { container } = render(loggedInUserHeader)
|
|
88
|
+
|
|
89
|
+
expect(container.querySelector('a[data-trackable="Subscribe"]')).not.toBeNull()
|
|
90
|
+
expect(container.querySelector('a[data-trackable="Sign In"]')).toBeNull()
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
describe('When the user is anonymous', () => {
|
|
95
|
+
it('renders the expected anonymous user header links', () => {
|
|
96
|
+
const { container } = render(anonymousUserHeader)
|
|
97
|
+
|
|
98
|
+
expect(
|
|
99
|
+
container.querySelector('.o-header__top-column .o-header__top-column--right a[data-trackable="Subscribe"]')
|
|
100
|
+
).not.toBeNull()
|
|
101
|
+
expect(
|
|
102
|
+
container.querySelector('.o-header__top-column .o-header__top-column--right a[data-trackable="Sign In"]')
|
|
103
|
+
).not.toBeNull()
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it('does not render the logged in user header links', () => {
|
|
107
|
+
const { container } = render(anonymousUserHeader)
|
|
108
|
+
|
|
109
|
+
expect(container.querySelector('a[data-trackable="Portfolio"]')).toBeNull()
|
|
110
|
+
expect(container.querySelector('a[data-trackable="Settings & Account"]')).toBeNull()
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
})
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react'
|
|
5
|
+
import { render } from '@testing-library/react'
|
|
6
|
+
|
|
7
|
+
import navigationData from '../../__stories__/story-data/index'
|
|
8
|
+
import { Drawer as Subject } from '../../'
|
|
9
|
+
|
|
10
|
+
const fixture = {
|
|
11
|
+
data: { ...navigationData.data, currentPath: '/world' }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const loggedInUserFixture = {
|
|
15
|
+
...fixture,
|
|
16
|
+
userIsAnonymous: false,
|
|
17
|
+
userIsLoggedIn: true
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const anonymousUserFixture = {
|
|
21
|
+
...fixture,
|
|
22
|
+
userIsAnonymous: true,
|
|
23
|
+
userIsLoggedIn: false
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
describe('dotcom-ui-header/src/components/drawer', () => {
|
|
27
|
+
describe('editions', () => {
|
|
28
|
+
it('renders the current edition text', () => {
|
|
29
|
+
const { container } = render(<Subject {...fixture} />)
|
|
30
|
+
|
|
31
|
+
expect(container.getElementsByClassName('o-header__drawer-current-edition')[0].innerHTML).toContain(
|
|
32
|
+
'UK Edition'
|
|
33
|
+
)
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('renders the alternative edition link', () => {
|
|
37
|
+
const { container } = render(<Subject {...fixture} />)
|
|
38
|
+
|
|
39
|
+
const [firstLink] = Array.from(container.getElementsByClassName('o-header__drawer-menu-link'))
|
|
40
|
+
expect(firstLink.innerHTML).toContain('Switch to International Edition')
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
describe('navigation links', () => {
|
|
45
|
+
it('renders the primary link section title', () => {
|
|
46
|
+
const { container } = render(<Subject {...fixture} />)
|
|
47
|
+
|
|
48
|
+
const [firstLink] = Array.from(container.getElementsByClassName('o-header__drawer-menu-item--heading'))
|
|
49
|
+
expect(firstLink.innerHTML).toContain('Top sections')
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it('renders the secondary link section title', () => {
|
|
53
|
+
const { container } = render(<Subject {...fixture} />)
|
|
54
|
+
|
|
55
|
+
const secondLink = Array.from(
|
|
56
|
+
container.getElementsByClassName('o-header__drawer-menu-item--heading')
|
|
57
|
+
)[1]
|
|
58
|
+
expect(secondLink.innerHTML).toContain('FT recommends')
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it('renders the tertiary link section divider', () => {
|
|
62
|
+
const { container } = render(<Subject {...fixture} />)
|
|
63
|
+
|
|
64
|
+
const [li] = Array.from(container.getElementsByClassName('o-header__drawer-menu-list--divide'))
|
|
65
|
+
expect(li.children[0].innerHTML).toContain('myFT')
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it('renders primary link subsections', () => {
|
|
69
|
+
const { container } = render(<Subject {...fixture} />)
|
|
70
|
+
|
|
71
|
+
const parentHeaders = Array.from(
|
|
72
|
+
container.getElementsByClassName('o-header__drawer-menu-link--parent')
|
|
73
|
+
).filter((header) => header.innerHTML.includes('Companies'))
|
|
74
|
+
|
|
75
|
+
expect(parentHeaders.length).toBe(1)
|
|
76
|
+
|
|
77
|
+
const toggleHeaders = Array.from(
|
|
78
|
+
container.getElementsByClassName('o-header__drawer-menu-toggle')
|
|
79
|
+
).filter((header) => header.innerHTML.includes('Show more Companies'))
|
|
80
|
+
|
|
81
|
+
expect(toggleHeaders.length).toBe(1)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it('highlights the current page', () => {
|
|
85
|
+
const { container } = render(<Subject {...fixture} />)
|
|
86
|
+
const currentPage = container.querySelector('[aria-current="page"]')
|
|
87
|
+
expect(currentPage?.innerHTML).toContain('World')
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
describe('user menu', () => {
|
|
92
|
+
describe('for a logged in user', () => {
|
|
93
|
+
it('renders sign out link', () => {
|
|
94
|
+
const { container } = render(<Subject {...loggedInUserFixture} />)
|
|
95
|
+
|
|
96
|
+
const signOutLink = container.querySelector('a[data-trackable="Sign Out"]')
|
|
97
|
+
expect(signOutLink?.innerHTML).toContain('Sign Out')
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it('renders settings and account link', () => {
|
|
101
|
+
const { container } = render(<Subject {...loggedInUserFixture} />)
|
|
102
|
+
|
|
103
|
+
const signOutLink = container.querySelector('a[data-trackable="Settings & Account"]')
|
|
104
|
+
expect(signOutLink?.innerHTML).toContain('Settings & Account')
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
describe('for an anonymous user', () => {
|
|
109
|
+
it('renders sign in link', () => {
|
|
110
|
+
const { container } = render(<Subject {...anonymousUserFixture} />)
|
|
111
|
+
|
|
112
|
+
const signInLink = container.querySelector('a[data-trackable="Sign In"')
|
|
113
|
+
expect(signInLink?.innerHTML).toContain('Sign In')
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
it('renders subscribe link', () => {
|
|
117
|
+
const { container } = render(<Subject {...anonymousUserFixture} />)
|
|
118
|
+
|
|
119
|
+
const subscribeLink = container.querySelector('a[data-trackable="Subscribe"]')
|
|
120
|
+
expect(subscribeLink?.innerHTML).toContain('Subscribe')
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
})
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
import 'jest-enzyme'
|
|
5
|
-
import React from 'react'
|
|
6
|
-
import { mount } from 'enzyme'
|
|
7
|
-
|
|
8
|
-
import dataFixture from '../../__stories__/story-data/index'
|
|
9
|
-
import { Header } from '../../index'
|
|
10
|
-
|
|
11
|
-
// data.currentPath to enable the mobile header
|
|
12
|
-
const headerFixture = {
|
|
13
|
-
...dataFixture,
|
|
14
|
-
data: { ...dataFixture.data, currentPath: '/' }
|
|
15
|
-
}
|
|
16
|
-
const subscribedUserFixture = { ...dataFixture, showUserNavigation: true, userIsSubscribed: true }
|
|
17
|
-
const loggedInUserFixture = { ...dataFixture, showUserNavigation: true }
|
|
18
|
-
const anonymousUserFixture = {
|
|
19
|
-
...dataFixture,
|
|
20
|
-
userIsAnonymous: true,
|
|
21
|
-
userIsLoggedIn: false,
|
|
22
|
-
showUserNavigation: true
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const commonHeader = <Header {...headerFixture} />
|
|
26
|
-
const subscribedUserHeader = <Header {...subscribedUserFixture} />
|
|
27
|
-
const loggedInUserHeader = <Header {...loggedInUserFixture} />
|
|
28
|
-
const anonymousUserHeader = <Header {...anonymousUserFixture} />
|
|
29
|
-
|
|
30
|
-
describe('dotcom-ui-header', () => {
|
|
31
|
-
const header = mount(commonHeader)
|
|
32
|
-
|
|
33
|
-
it('renders the expected common header elements', () => {
|
|
34
|
-
expect(header).not.toBeEmptyRender()
|
|
35
|
-
expect(header.find('div[data-trackable="header-top"] .o-header__top-logo')).toExist()
|
|
36
|
-
expect(
|
|
37
|
-
header.find(
|
|
38
|
-
'div[data-trackable="header-top"] .o-header__top-icon-link--search .o-header__top-link-label'
|
|
39
|
-
)
|
|
40
|
-
).toExist()
|
|
41
|
-
expect(
|
|
42
|
-
header.find('div[data-trackable="header-top"] .o-header__top-icon-link--menu .o-header__top-link-label')
|
|
43
|
-
).toExist()
|
|
44
|
-
expect(header.find('div[data-trackable="header-top"] .o-header__top-icon-link--myft')).toExist()
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
it('renders an inlined SVG logo image', () => {
|
|
48
|
-
expect(header.find('div[data-trackable="header-top"] .o-header__top-logo svg')).toExist()
|
|
49
|
-
expect(header.find('div[data-trackable="header-top"] .o-header__top-logo title')).toHaveText(
|
|
50
|
-
'Financial Times'
|
|
51
|
-
)
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
it('renders the sticky header', () => {
|
|
55
|
-
expect(header.find('.o-header--sticky')).toExist()
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('renders the mobile header', () => {
|
|
59
|
-
expect(header.find('#o-header-nav-mobile')).toExist()
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
describe('When the user is subscribed', () => {
|
|
63
|
-
const header = mount(subscribedUserHeader)
|
|
64
|
-
|
|
65
|
-
it('renders the expected logged in user header links', () => {
|
|
66
|
-
expect(header.find('a[data-trackable="Portfolio"]')).toExist()
|
|
67
|
-
expect(header.find('a[data-trackable="Settings & Account"]')).toExist()
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
it('does not render sign in link', () => {
|
|
71
|
-
expect(header.find('a[data-trackable="Subscribe"]')).not.toExist()
|
|
72
|
-
expect(header.find('a[data-trackable="Sign In"]')).not.toExist()
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
describe('When the user is logged in', () => {
|
|
77
|
-
const header = mount(loggedInUserHeader)
|
|
78
|
-
|
|
79
|
-
it('renders the expected logged in user header links', () => {
|
|
80
|
-
expect(header.find('a[data-trackable="Portfolio"]')).toExist()
|
|
81
|
-
expect(header.find('a[data-trackable="Settings & Account"]')).toExist()
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
it('does not render sign in link', () => {
|
|
85
|
-
expect(header.find('a[data-trackable="Subscribe"]')).toExist()
|
|
86
|
-
expect(header.find('a[data-trackable="Sign In"]')).not.toExist()
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
describe('When the user is anonymous', () => {
|
|
91
|
-
const header = mount(anonymousUserHeader)
|
|
92
|
-
|
|
93
|
-
it('renders the expected anonymous user header links', () => {
|
|
94
|
-
expect(
|
|
95
|
-
header.find('.o-header__top-column .o-header__top-column--right a[data-trackable="Subscribe"]')
|
|
96
|
-
).toExist()
|
|
97
|
-
expect(
|
|
98
|
-
header.find('.o-header__top-column .o-header__top-column--right a[data-trackable="Sign In"]')
|
|
99
|
-
).toExist()
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
it('does not render the logged in user header links', () => {
|
|
103
|
-
expect(header.find('a[data-trackable="Portfolio"]')).not.toExist()
|
|
104
|
-
expect(header.find('a[data-trackable="Settings & Account"]')).not.toExist()
|
|
105
|
-
})
|
|
106
|
-
})
|
|
107
|
-
})
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
import 'jest-enzyme'
|
|
5
|
-
import React from 'react'
|
|
6
|
-
import { mount } from 'enzyme'
|
|
7
|
-
|
|
8
|
-
import navigationData from '../../__stories__/story-data/index'
|
|
9
|
-
import { Drawer as Subject } from '../../'
|
|
10
|
-
|
|
11
|
-
const fixture = {
|
|
12
|
-
data: { ...navigationData.data, currentPath: '/world' }
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const loggedInUserFixture = {
|
|
16
|
-
...fixture,
|
|
17
|
-
userIsAnonymous: false,
|
|
18
|
-
userIsLoggedIn: true
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const anonymousUserFixture = {
|
|
22
|
-
...fixture,
|
|
23
|
-
userIsAnonymous: true,
|
|
24
|
-
userIsLoggedIn: false
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
describe('dotcom-ui-header/src/components/drawer', () => {
|
|
28
|
-
describe('editions', () => {
|
|
29
|
-
let result
|
|
30
|
-
|
|
31
|
-
beforeAll(() => {
|
|
32
|
-
result = mount(<Subject {...fixture} />)
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
it('renders the current edition text', () => {
|
|
36
|
-
expect(result.find('.o-header__drawer-current-edition')).toHaveText('UK Edition')
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it('renders the alternative edition link', () => {
|
|
40
|
-
expect(result.find('[data-trackable="edition-switcher"] a')).toHaveText(
|
|
41
|
-
'Switch to International Edition'
|
|
42
|
-
)
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
describe('navigation links', () => {
|
|
47
|
-
let result
|
|
48
|
-
|
|
49
|
-
beforeAll(() => {
|
|
50
|
-
result = mount(<Subject {...fixture} />)
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
it('renders the primary link section title', () => {
|
|
54
|
-
expect(result.find('.o-header__drawer-menu-item--heading').at(0)).toHaveText('Top sections')
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
it('renders the secondary link section title', () => {
|
|
58
|
-
expect(result.find('.o-header__drawer-menu-item--heading').at(1)).toHaveText('FT recommends')
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
it('renders the tertiary link section divider', () => {
|
|
62
|
-
expect(result.find('.o-header__drawer-menu-list--divide > li:first-child')).toHaveText('myFT')
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
it('renders primary link subsections', () => {
|
|
66
|
-
const section = result
|
|
67
|
-
.find('.o-header__drawer-menu-item')
|
|
68
|
-
.findWhere((node) => node.key() === '/companies')
|
|
69
|
-
.at(0)
|
|
70
|
-
|
|
71
|
-
expect(section.find('.o-header__drawer-menu-link--parent')).toHaveText('Companies')
|
|
72
|
-
expect(section.find('.o-header__drawer-menu-toggle')).toHaveText('Show more Companies')
|
|
73
|
-
expect(section.find('.o-header__drawer-menu-link--child').length).toBe(10)
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
it('highlights the current page', () => {
|
|
77
|
-
expect(result.find('[aria-current="page"]')).toHaveText('World')
|
|
78
|
-
})
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
describe('user menu', () => {
|
|
82
|
-
describe('for a logged in user', () => {
|
|
83
|
-
let result
|
|
84
|
-
|
|
85
|
-
beforeAll(() => {
|
|
86
|
-
result = mount(<Subject {...loggedInUserFixture} />)
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
it('renders sign out link', () => {
|
|
90
|
-
expect(result.find('a[data-trackable="Sign Out"]')).toExist()
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
it('renders settings and account link', () => {
|
|
94
|
-
expect(result.find('a[data-trackable="Settings & Account"]')).toExist()
|
|
95
|
-
})
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
describe('for an anonymous user', () => {
|
|
99
|
-
let result
|
|
100
|
-
|
|
101
|
-
beforeAll(() => {
|
|
102
|
-
result = mount(<Subject {...anonymousUserFixture} />)
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
it('renders sign in link', () => {
|
|
106
|
-
expect(result.find('a[data-trackable="Sign In"]')).toExist()
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
it('renders subscribe link', () => {
|
|
110
|
-
expect(result.find('a[data-trackable="Subscribe"]')).toExist()
|
|
111
|
-
})
|
|
112
|
-
})
|
|
113
|
-
})
|
|
114
|
-
})
|