@ons/design-system 67.0.2 → 67.0.4
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/README.md +1 -2
- package/components/details/_details.scss +5 -0
- package/components/details/_macro.njk +9 -9
- package/components/header/example-header-external-with-sub-navigation-removed.njk +70 -0
- package/components/header/example-header-external-with-sub-navigation.njk +3 -2
- package/components/input/_input.scss +6 -0
- package/components/input/_macro.njk +32 -2
- package/components/input/example-input-text-width-constrained.njk +1 -1
- package/components/label/_macro.njk +4 -1
- package/components/navigation/_macro.njk +18 -16
- package/components/navigation/navigation.spec.js +89 -14
- package/components/table-of-contents/example-table-of-contents-sticky-full-page.njk +114 -0
- package/components/table-of-contents/toc.spec.js +113 -3
- package/components/tabs/_macro.njk +1 -1
- package/components/tabs/_macro.spec.js +0 -10
- package/css/main.css +1 -1
- package/js/analytics.js +26 -24
- package/js/main.js +1 -0
- package/layout/_dsTemplate.njk +33 -0
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/objects/_page.scss +1 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ To enable this we use [nvm (Node Version Manager)](https://github.com/creationix
|
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
35
|
yarn install
|
|
36
|
-
husky install
|
|
36
|
+
yarn husky install
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
### Start a local server
|
|
@@ -130,7 +130,6 @@ Checkout the branch locally and run:
|
|
|
130
130
|
|
|
131
131
|
`yarn test-visual:approve` - This will approve the failures/diff caught by the tests.
|
|
132
132
|
|
|
133
|
-
|
|
134
133
|
`git lfs push --all origin` - First commit the files in the normal way then run the command. This will push the new reference images to Git LFS.
|
|
135
134
|
|
|
136
135
|
You can then commit and push the updated references and your changes to your branch. The test images that would have been created when you ran `yarn test-visual` are gitignored and the new references images will be pushed to Git LFS.
|
|
@@ -23,6 +23,7 @@ $details-caret-width: 1.5rem;
|
|
|
23
23
|
margin-left: -$details-caret-width;
|
|
24
24
|
padding-left: $details-caret-width;
|
|
25
25
|
}
|
|
26
|
+
|
|
26
27
|
.ons-details__icon .ons-icon {
|
|
27
28
|
fill: var(--ons-color-text-link-focus);
|
|
28
29
|
}
|
|
@@ -30,9 +31,11 @@ $details-caret-width: 1.5rem;
|
|
|
30
31
|
|
|
31
32
|
&:hover:not(:focus) {
|
|
32
33
|
color: var(--ons-color-text-link-hover);
|
|
34
|
+
|
|
33
35
|
.ons-details__icon {
|
|
34
36
|
fill: var(--ons-color-text-link-hover);
|
|
35
37
|
}
|
|
38
|
+
|
|
36
39
|
.ons-details__title {
|
|
37
40
|
text-decoration: underline solid var(--ons-color-text-link-hover) 2px;
|
|
38
41
|
}
|
|
@@ -60,6 +63,7 @@ $details-caret-width: 1.5rem;
|
|
|
60
63
|
margin-bottom: 0;
|
|
61
64
|
text-underline-position: under;
|
|
62
65
|
transform: translateY(-1px);
|
|
66
|
+
pointer-events: none;
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
|
|
@@ -126,5 +130,6 @@ $details-caret-width: 1.5rem;
|
|
|
126
130
|
|
|
127
131
|
&__icon {
|
|
128
132
|
display: none;
|
|
133
|
+
pointer-events: none;
|
|
129
134
|
}
|
|
130
135
|
}
|
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
class="ons-details__heading ons-js-details-heading" role="button"
|
|
12
12
|
{% if params.headingAttributes %}{% for attribute, value in (params.headingAttributes.items() if params.headingAttributes is mapping and params.headingAttributes.items else params.headingAttributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
|
|
13
13
|
>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
{% set titleTag = params.titleTag | default("h2") %}
|
|
15
|
+
<{{ titleTag }} class="ons-details__title">{{ params.title }}</{{ titleTag }}>
|
|
16
|
+
<span class="ons-details__icon">
|
|
17
|
+
{% from "components/icon/_macro.njk" import onsIcon %}
|
|
18
|
+
{{-
|
|
19
|
+
onsIcon({
|
|
20
|
+
"iconType": "chevron"
|
|
21
|
+
})
|
|
22
|
+
-}}</span>
|
|
23
23
|
</div>
|
|
24
24
|
<div id="{{ params.id }}-content" class="ons-details__content ons-js-details-content"
|
|
25
25
|
{% if params.contentAttributes %}{% for attribute, value in (params.contentAttributes.items() if params.contentAttributes is mapping and params.contentAttributes.items else params.contentAttributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
"fullWidth": true
|
|
3
|
+
---
|
|
4
|
+
{% from "components/header/_macro.njk" import onsHeader %}
|
|
5
|
+
|
|
6
|
+
{{
|
|
7
|
+
onsHeader({
|
|
8
|
+
"title": 'Service manual',
|
|
9
|
+
"mastheadLogoUrl": '#0',
|
|
10
|
+
"titleUrl": '#0',
|
|
11
|
+
"navigation": {
|
|
12
|
+
"id": 'main-nav',
|
|
13
|
+
"ariaLabel": 'Main menu',
|
|
14
|
+
"currentPath": [ '#design-system', '#patterns', '#access-codes' ],
|
|
15
|
+
"currentPageTitle": 'Design system',
|
|
16
|
+
"itemsList": [
|
|
17
|
+
{
|
|
18
|
+
"text": 'Service standard',
|
|
19
|
+
"url": '#0'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"text": 'Design system',
|
|
23
|
+
"url": '#design-system'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"text": 'Accessibility',
|
|
27
|
+
"url": '#0'
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"text": 'Brand guidelines',
|
|
31
|
+
"url": '#0'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"text": 'Content style guide',
|
|
35
|
+
"url": '#0'
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"toggleNavigationButton": {
|
|
39
|
+
"text": 'Menu',
|
|
40
|
+
"ariaLabel": 'Toggle menu'
|
|
41
|
+
},
|
|
42
|
+
"subNavigation": {
|
|
43
|
+
"id": 'sub-nav',
|
|
44
|
+
"overviewURL": '#design-system',
|
|
45
|
+
"overviewText": 'Overview',
|
|
46
|
+
"ariaLabel": 'Section menu',
|
|
47
|
+
"currentPath": '#access-codes',
|
|
48
|
+
"removeHorizontalSubNav": true,
|
|
49
|
+
"itemsList": [
|
|
50
|
+
{
|
|
51
|
+
"text": 'Guidance',
|
|
52
|
+
"url": '#0'
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"text": 'Foundations',
|
|
56
|
+
"url": '#0'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"text": 'Components',
|
|
60
|
+
"url": '#0'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"text": 'Patterns',
|
|
64
|
+
"url": '#patterns'
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
}}
|
|
@@ -41,9 +41,10 @@
|
|
|
41
41
|
},
|
|
42
42
|
"subNavigation": {
|
|
43
43
|
"id": 'sub-nav',
|
|
44
|
-
"overviewURL": '#
|
|
44
|
+
"overviewURL": '#design-system',
|
|
45
45
|
"overviewText": 'Overview',
|
|
46
46
|
"ariaLabel": 'Section menu',
|
|
47
|
+
"currentPath": '#access-codes',
|
|
47
48
|
"itemsList": [
|
|
48
49
|
{
|
|
49
50
|
"text": 'Guidance',
|
|
@@ -129,4 +130,4 @@
|
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
})
|
|
132
|
-
}}
|
|
133
|
+
}}
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
{% endif %}
|
|
58
58
|
{% endset %}
|
|
59
59
|
{% set field %}
|
|
60
|
-
{% if params.label and params.label.text
|
|
60
|
+
{% if (not params.accessiblePlaceholder or params.label.description) and (params.label and params.label.text)%}
|
|
61
61
|
{{ onsLabel({
|
|
62
62
|
"for": params.id,
|
|
63
63
|
"id": params.label.id,
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"accessiblePlaceholder": params.accessiblePlaceholder,
|
|
69
69
|
"inline": params.label.inline
|
|
70
70
|
}) }}
|
|
71
|
+
|
|
71
72
|
{% endif %}
|
|
72
73
|
|
|
73
74
|
{% if params.prefix or params.suffix %}
|
|
@@ -100,7 +101,19 @@
|
|
|
100
101
|
</span>
|
|
101
102
|
{% endif %}
|
|
102
103
|
{% elif params.searchButton %}
|
|
103
|
-
<span class="ons-grid--flex
|
|
104
|
+
<span class="ons-grid--flex ons-input_search-button{% if params.label.description %} ons-input--with-text-description{% endif %}">
|
|
105
|
+
{% if params.accessiblePlaceholder %}
|
|
106
|
+
{{ onsLabel({
|
|
107
|
+
"for": params.id,
|
|
108
|
+
"id": params.label.id,
|
|
109
|
+
"text": params.label.text,
|
|
110
|
+
"classes": params.label.classes,
|
|
111
|
+
"attributes": params.label.attributes,
|
|
112
|
+
"accessiblePlaceholder": params.accessiblePlaceholder,
|
|
113
|
+
"inline": params.label.inline
|
|
114
|
+
}) }}
|
|
115
|
+
{% endif %}
|
|
116
|
+
|
|
104
117
|
{{ input | safe }}
|
|
105
118
|
{%- set buttonLabel -%}
|
|
106
119
|
{%- if params.searchButton.visuallyHideButtonText == true -%}
|
|
@@ -124,7 +137,24 @@
|
|
|
124
137
|
}}
|
|
125
138
|
</span>
|
|
126
139
|
{% else %}
|
|
140
|
+
{% if params.accessiblePlaceholder %}
|
|
141
|
+
<span class="ons-grid--flex {% if params.label.description %} ons-input--with-text-description{% endif %}">
|
|
142
|
+
{% if params.accessiblePlaceholder %}
|
|
143
|
+
{{ onsLabel({
|
|
144
|
+
"for": params.id,
|
|
145
|
+
"id": params.label.id,
|
|
146
|
+
"text": params.label.text,
|
|
147
|
+
"classes": params.label.classes,
|
|
148
|
+
"attributes": params.label.attributes,
|
|
149
|
+
"accessiblePlaceholder": params.accessiblePlaceholder,
|
|
150
|
+
"inline": params.label.inline
|
|
151
|
+
}) }}
|
|
152
|
+
{% endif %}
|
|
153
|
+
{% endif %}
|
|
127
154
|
{{ input | safe }}
|
|
155
|
+
{% if params.accessiblePlaceholder %}
|
|
156
|
+
</span>
|
|
157
|
+
{% endif %}
|
|
128
158
|
{% endif %}
|
|
129
159
|
{% endset %}
|
|
130
160
|
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
{{- params.description -}}
|
|
17
17
|
</span>
|
|
18
18
|
{%- endset %}
|
|
19
|
-
|
|
19
|
+
{%- if params.description and params.accessiblePlaceholder -%}
|
|
20
|
+
{{- description | safe -}}
|
|
21
|
+
{%- else -%}
|
|
20
22
|
<label
|
|
21
23
|
class="{% if params.inputType is not defined -%}ons-label{%- endif %}{{- ' ' + params.classes if params.classes else "" -}}{%- if params.description %} ons-label--with-description{%- endif %} {{- ' ons-label--placeholder' if params.accessiblePlaceholder else "" -}}"
|
|
22
24
|
{% if params.description %}aria-describedby="{{ descriptionID }}"{% endif %}
|
|
@@ -41,4 +43,5 @@
|
|
|
41
43
|
{{- description | safe -}}
|
|
42
44
|
{%- endif -%}
|
|
43
45
|
{%- endif %}
|
|
46
|
+
{%- endif -%}
|
|
44
47
|
{% endmacro %}
|
|
@@ -58,21 +58,23 @@
|
|
|
58
58
|
</div>
|
|
59
59
|
</div>
|
|
60
60
|
{% if params.navigation.subNavigation %}
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<
|
|
67
|
-
{% if item.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
61
|
+
{% if not params.navigation.subNavigation.removeHorizontalSubNav %}
|
|
62
|
+
<nav class="ons-navigation ons-navigation--sub ons-u-d-no@xxs@l{{ ' ' + params.navigation.subNavigation.classes if params.navigation.subNavigation.classes }}" id="{{ params.navigation.subNavigation.id }}" aria-label="{{ params.navigation.subNavigation.ariaLabel | default("Section menu") }}" data-analytics="header-section-navigation">
|
|
63
|
+
<div class="ons-container ons-container--gutterless@xxs@l{{ ' ons-container--full-width' if params.fullWidth or params.navigation.fullWidth }}{{ ' ons-container--wide' if params.wide or params.navigation.wide }}">
|
|
64
|
+
<ul class="ons-navigation__list ons-navigation__list">
|
|
65
|
+
{% for item in params.navigation.subNavigation.itemsList %}
|
|
66
|
+
<li class="ons-navigation__item {{ item.classes }}{{ ' ons-navigation__item--active' if (item.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and item.url in params.navigation.currentPath) }}">
|
|
67
|
+
<a class="ons-navigation__link ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}" {% endif %}>
|
|
68
|
+
{% if item.title %}{{ item.title }}
|
|
69
|
+
{% elif item.text %}{{ item.text }}
|
|
70
|
+
{% endif %}
|
|
71
|
+
</a>
|
|
72
|
+
</li>
|
|
73
|
+
{% endfor %}
|
|
74
|
+
</ul>
|
|
75
|
+
</div>
|
|
76
|
+
</nav>
|
|
77
|
+
{% endif %}
|
|
76
78
|
<div class="ons-u-d-no@l{{ ' ' + params.navigation.subNavigation.classes if params.navigation.subNavigation.classes }}">
|
|
77
79
|
{{ onsButton({
|
|
78
80
|
"text": params.navigation.currentPageTitle,
|
|
@@ -88,7 +90,7 @@
|
|
|
88
90
|
<nav class="ons-navigation ons-navigation--sub-mobile ons-u-d-no ons-js-secondary-nav ons-u-mt-xs" id="{{ params.navigation.subNavigation.id }}--mobile" aria-hidden="true" aria-label="{{ params.navigation.subNavigation.ariaLabel | default("Section menu") }}" data-analytics="header-section-navigation">
|
|
89
91
|
<div class="ons-container ons-container--gutterless@xxs@l{{ ' ons-container--full-width' if params.navigation.fullWidth }}{{ ' ons-container--wide' if params.navigation.wide }}">
|
|
90
92
|
<ul class="ons-navigation__list ons-navigation__list--parent">
|
|
91
|
-
<li class="ons-navigation__item">
|
|
93
|
+
<li class="ons-navigation__item{{ ' ons-navigation__item--active' if (params.navigation.subNavigation.overviewURL == params.navigation.subNavigation.currentPath)}}">
|
|
92
94
|
<a class="ons-navigation__link" href="{{ params.navigation.subNavigation.overviewURL }}">{{ params.navigation.subNavigation.overviewText | default('Overview') }}</a>
|
|
93
95
|
</li>
|
|
94
96
|
{% for item in params.navigation.subNavigation.itemsList %}
|
|
@@ -86,6 +86,66 @@ const EXAMPLE_NAVIGATION_WITH_SUBNAVIGATION = {
|
|
|
86
86
|
},
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
+
const EXAMPLE_NAVIGATION_WITH_SUBNAVIGATION_REMOVED = {
|
|
90
|
+
navigation: {
|
|
91
|
+
id: 'main-nav',
|
|
92
|
+
ariaLabel: 'Main menu',
|
|
93
|
+
currentPath: '#1',
|
|
94
|
+
currentPageTitle: 'Main nav item 2',
|
|
95
|
+
itemsList: [
|
|
96
|
+
{
|
|
97
|
+
title: 'Main nav item 1',
|
|
98
|
+
url: '#0',
|
|
99
|
+
classes: 'custom-class-main-item-1',
|
|
100
|
+
id: 'main-item-1',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
title: 'Main nav item 2',
|
|
104
|
+
url: '#1',
|
|
105
|
+
classes: 'custom-class-main-item-2',
|
|
106
|
+
id: 'main-item-2',
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
subNavigation: {
|
|
110
|
+
id: 'sub-nav-hidden',
|
|
111
|
+
overviewURL: '#overview',
|
|
112
|
+
overviewText: 'Overview',
|
|
113
|
+
ariaLabel: 'Section menu',
|
|
114
|
+
currentPath: '#1',
|
|
115
|
+
removeHorizontalSubNav: true,
|
|
116
|
+
itemsList: [
|
|
117
|
+
{
|
|
118
|
+
title: 'Sub nav item 1',
|
|
119
|
+
url: '#0',
|
|
120
|
+
classes: 'custom-class-sub-item-1',
|
|
121
|
+
id: 'sub-item-1',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
title: 'Sub nav item 2',
|
|
125
|
+
url: '#1',
|
|
126
|
+
classes: 'custom-class-sub-item-2',
|
|
127
|
+
id: 'sub-item-2',
|
|
128
|
+
sections: [
|
|
129
|
+
{
|
|
130
|
+
sectionTitle: 'Section 1',
|
|
131
|
+
children: [
|
|
132
|
+
{
|
|
133
|
+
title: 'Child item 1',
|
|
134
|
+
url: '#0',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
title: 'Child item 2',
|
|
138
|
+
url: '#1',
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
|
|
89
149
|
describe('script: navigation', () => {
|
|
90
150
|
afterEach(async () => {
|
|
91
151
|
// Clear viewport size and browser emulation after each test.
|
|
@@ -102,7 +162,7 @@ describe('script: navigation', () => {
|
|
|
102
162
|
});
|
|
103
163
|
|
|
104
164
|
it('has removed the display class from the menu toggle button', async () => {
|
|
105
|
-
const hasClass = await page.$eval(buttonEl, node => node.classList.contains('ons-u-d-no'));
|
|
165
|
+
const hasClass = await page.$eval(buttonEl, (node) => node.classList.contains('ons-u-d-no'));
|
|
106
166
|
expect(hasClass).toBe(false);
|
|
107
167
|
});
|
|
108
168
|
});
|
|
@@ -115,13 +175,13 @@ describe('script: navigation', () => {
|
|
|
115
175
|
|
|
116
176
|
it('has the correct aria hidden attribute on the navigation list', async () => {
|
|
117
177
|
const nav = await page.$(navEl);
|
|
118
|
-
const hasAriaAttribute = await nav.evaluate(node => node.getAttribute('aria-hidden') !== null);
|
|
178
|
+
const hasAriaAttribute = await nav.evaluate((node) => node.getAttribute('aria-hidden') !== null);
|
|
119
179
|
expect(hasAriaAttribute).toBe(ariaStatus);
|
|
120
180
|
});
|
|
121
181
|
|
|
122
182
|
it('has aria-expanded set as `false` on the navigation toggle button', async () => {
|
|
123
183
|
const button = await page.$(buttonEl);
|
|
124
|
-
const ariaExpandedIsFalse = await button.evaluate(node => node.getAttribute('aria-expanded') === 'false');
|
|
184
|
+
const ariaExpandedIsFalse = await button.evaluate((node) => node.getAttribute('aria-expanded') === 'false');
|
|
125
185
|
expect(ariaExpandedIsFalse).toBe(true);
|
|
126
186
|
});
|
|
127
187
|
});
|
|
@@ -134,7 +194,7 @@ describe('script: navigation', () => {
|
|
|
134
194
|
|
|
135
195
|
it('has aria-hidden set as `true` on the navigation list', async () => {
|
|
136
196
|
const nav = await page.$(navEl);
|
|
137
|
-
const hasAriaAttribute = await nav.evaluate(node => node.getAttribute('aria-hidden') === 'true');
|
|
197
|
+
const hasAriaAttribute = await nav.evaluate((node) => node.getAttribute('aria-hidden') === 'true');
|
|
138
198
|
expect(hasAriaAttribute).toBe(true);
|
|
139
199
|
});
|
|
140
200
|
|
|
@@ -146,12 +206,12 @@ describe('script: navigation', () => {
|
|
|
146
206
|
|
|
147
207
|
it('has aria-hidden set as `false` on the navigation list', async () => {
|
|
148
208
|
const nav = await page.$(navEl);
|
|
149
|
-
const hasAriaAttribute = await nav.evaluate(node => node.getAttribute('aria-hidden') === 'false');
|
|
209
|
+
const hasAriaAttribute = await nav.evaluate((node) => node.getAttribute('aria-hidden') === 'false');
|
|
150
210
|
expect(hasAriaAttribute).toBe(true);
|
|
151
211
|
});
|
|
152
212
|
|
|
153
213
|
it('has the hide class removed from the navigation list', async () => {
|
|
154
|
-
const hasClass = await page.$eval(navEl, node =>
|
|
214
|
+
const hasClass = await page.$eval(navEl, (node) =>
|
|
155
215
|
node.classList.contains('ons-u-d-no@xxs@l' || 'ons-u-d-no' || 'ons-u-d-no@xs@l'),
|
|
156
216
|
);
|
|
157
217
|
expect(hasClass).toBe(false);
|
|
@@ -159,12 +219,12 @@ describe('script: navigation', () => {
|
|
|
159
219
|
|
|
160
220
|
it('has aria-expanded set as `true` on the navigation toggle button', async () => {
|
|
161
221
|
const button = await page.$(buttonEl);
|
|
162
|
-
const ariaExpandedIsTrue = await button.evaluate(node => node.getAttribute('aria-expanded') === 'true');
|
|
222
|
+
const ariaExpandedIsTrue = await button.evaluate((node) => node.getAttribute('aria-expanded') === 'true');
|
|
163
223
|
expect(ariaExpandedIsTrue).toBe(true);
|
|
164
224
|
});
|
|
165
225
|
|
|
166
226
|
it('has the correct class applied to the navigation toggle button', async () => {
|
|
167
|
-
const hasClass = await page.$eval(buttonEl, node => node.classList.contains('active'));
|
|
227
|
+
const hasClass = await page.$eval(buttonEl, (node) => node.classList.contains('active'));
|
|
168
228
|
expect(hasClass).toBe(true);
|
|
169
229
|
});
|
|
170
230
|
});
|
|
@@ -180,18 +240,18 @@ describe('script: navigation', () => {
|
|
|
180
240
|
|
|
181
241
|
it('has aria-hidden set as `true` on the navigation list', async () => {
|
|
182
242
|
const nav = await page.$(navEl);
|
|
183
|
-
const hasAriaAttribute = await nav.evaluate(node => node.getAttribute('aria-hidden') === 'true');
|
|
243
|
+
const hasAriaAttribute = await nav.evaluate((node) => node.getAttribute('aria-hidden') === 'true');
|
|
184
244
|
expect(hasAriaAttribute).toBe(true);
|
|
185
245
|
});
|
|
186
246
|
|
|
187
247
|
it('has aria-expanded set as `false` on the navigation toggle button', async () => {
|
|
188
248
|
const button = await page.$(buttonEl);
|
|
189
|
-
const ariaExpandedIsTrue = await button.evaluate(node => node.getAttribute('aria-expanded') === 'false');
|
|
249
|
+
const ariaExpandedIsTrue = await button.evaluate((node) => node.getAttribute('aria-expanded') === 'false');
|
|
190
250
|
expect(ariaExpandedIsTrue).toBe(true);
|
|
191
251
|
});
|
|
192
252
|
|
|
193
253
|
it('has the active class removed from the navigation toggle button', async () => {
|
|
194
|
-
const hasClass = await page.$eval(buttonEl, node => node.classList.contains('active'));
|
|
254
|
+
const hasClass = await page.$eval(buttonEl, (node) => node.classList.contains('active'));
|
|
195
255
|
expect(hasClass).toBe(false);
|
|
196
256
|
});
|
|
197
257
|
});
|
|
@@ -210,18 +270,18 @@ describe('script: navigation', () => {
|
|
|
210
270
|
|
|
211
271
|
it('has the aria-hidden attribute removed from the navigation list', async () => {
|
|
212
272
|
const nav = await page.$(navEl);
|
|
213
|
-
const hasAriaAttribute = await nav.evaluate(node => node.getAttribute('aria-hidden') !== null);
|
|
273
|
+
const hasAriaAttribute = await nav.evaluate((node) => node.getAttribute('aria-hidden') !== null);
|
|
214
274
|
expect(hasAriaAttribute).toBe(false);
|
|
215
275
|
});
|
|
216
276
|
|
|
217
277
|
it('has aria-expanded removed from the navigation toggle button', async () => {
|
|
218
278
|
const button = await page.$(buttonEl);
|
|
219
|
-
const hasAriaExpanded = await button.evaluate(node => node.getAttribute('aria-expanded') !== null);
|
|
279
|
+
const hasAriaExpanded = await button.evaluate((node) => node.getAttribute('aria-expanded') !== null);
|
|
220
280
|
expect(hasAriaExpanded).toBe(false);
|
|
221
281
|
});
|
|
222
282
|
|
|
223
283
|
it('has the hide class removed from the navigation list', async () => {
|
|
224
|
-
const hasClass = await page.$eval(navEl, node =>
|
|
284
|
+
const hasClass = await page.$eval(navEl, (node) =>
|
|
225
285
|
node.classList.contains('ons-u-d-no@xxs@l' || 'ons-u-d-no' || 'ons-u-d-no@xs@l'),
|
|
226
286
|
);
|
|
227
287
|
expect(hasClass).toBe(false);
|
|
@@ -230,3 +290,18 @@ describe('script: navigation', () => {
|
|
|
230
290
|
},
|
|
231
291
|
);
|
|
232
292
|
});
|
|
293
|
+
|
|
294
|
+
describe('level: sub navigation', () => {
|
|
295
|
+
describe('when removeHorizontalSubNav is set to true', () => {
|
|
296
|
+
beforeEach(async () => {
|
|
297
|
+
await setTestPage('/test', renderComponent('header', EXAMPLE_NAVIGATION_WITH_SUBNAVIGATION_REMOVED));
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
it('does not render the sub-nav element', async () => {
|
|
301
|
+
const hasSubNavEl = (await page.content()).includes('.ons-navigation--sub');
|
|
302
|
+
expect(hasSubNavEl).toBe(false);
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Example: Table of contents on full page"
|
|
3
|
+
layout: ~
|
|
4
|
+
---
|
|
5
|
+
{% from "components/table-of-contents/_macro.njk" import onsTableOfContents %}
|
|
6
|
+
|
|
7
|
+
{% extends "layout/_template.njk" %}
|
|
8
|
+
|
|
9
|
+
{% set pageConfig = {
|
|
10
|
+
"header": {
|
|
11
|
+
"title": "What is the census?"
|
|
12
|
+
},
|
|
13
|
+
"breadcrumbs": {
|
|
14
|
+
"ariaLabel": 'Back',
|
|
15
|
+
"itemsList": [
|
|
16
|
+
{
|
|
17
|
+
"url": '/',
|
|
18
|
+
"id": "back-example-feedback-form-error",
|
|
19
|
+
"text": 'Back',
|
|
20
|
+
"attributes": {
|
|
21
|
+
"data-attribute": "Example attribute"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"footer": {
|
|
27
|
+
"OGLLink": {
|
|
28
|
+
"pre": 'All content is available under the',
|
|
29
|
+
"link": 'Open Government Licence v3.0',
|
|
30
|
+
"url": 'https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/',
|
|
31
|
+
"post": ', except where otherwise stated'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
} %}
|
|
35
|
+
|
|
36
|
+
{% block main %}
|
|
37
|
+
<div class="ons-page__container ons-container">
|
|
38
|
+
<div class="ons-grid ons-js-toc-container">
|
|
39
|
+
<div class="ons-grid__col ons-grid__col--sticky@m ons-col-4@m">
|
|
40
|
+
{{
|
|
41
|
+
onsTableOfContents({
|
|
42
|
+
"title": 'Contents',
|
|
43
|
+
"ariaLabel": 'Sections in this page',
|
|
44
|
+
"itemsList": [
|
|
45
|
+
{
|
|
46
|
+
"url": '#section1',
|
|
47
|
+
"text": 'What is the census?'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"url": '#section2',
|
|
51
|
+
"text": 'The online census has now closed'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"url": '#section3',
|
|
55
|
+
"text": 'What happens after Census Day'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"url": '#section4',
|
|
59
|
+
"text": 'The census in Northern Ireland and Scotland'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"url": '#section5',
|
|
63
|
+
"text": 'The last census'
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
})
|
|
67
|
+
}}
|
|
68
|
+
</div>
|
|
69
|
+
<div class="ons-grid__col ons-col-7@m ons-push-1@m">
|
|
70
|
+
<section id="section1">
|
|
71
|
+
<h2>What is the census?</h2>
|
|
72
|
+
<p>The census is a survey that happens every 10 years and gives us a picture of all the people and households in England and Wales.</p>
|
|
73
|
+
|
|
74
|
+
<p>Your answers to the census questions will help organisations make decisions on planning and funding public services in your area, including transport, education and healthcare.</p>
|
|
75
|
+
</section>
|
|
76
|
+
<section id="section2">
|
|
77
|
+
<h2>The online census has now closed</h2>
|
|
78
|
+
<p>Census Day was on Sunday 21 March 2021.</p>
|
|
79
|
+
|
|
80
|
+
<p>If you still have a paper census questionnaire, fill it in as soon as you can and return it to FREEPOST, Census 2021.</p>
|
|
81
|
+
</section>
|
|
82
|
+
<section id="section3">
|
|
83
|
+
<h2>What happens after Census Day</h2>
|
|
84
|
+
<p>Two follow-up surveys, the <a href="#0">Census Coverage Survey</a> and the <a href="#0">Census Quality Survey</a>, help to improve the quality and accuracy of the census results.</p>
|
|
85
|
+
|
|
86
|
+
<p>Over the next year, we work hard to process the answers from all the census questionnaires. This is so that we can publish the initial Census 2021 findings one year after the census and the main releases two years after the census.</p>
|
|
87
|
+
|
|
88
|
+
<p>To make sure the Census 2021 statistics we publish meet the needs of those who use them, we also run an outputs consultation.</p>
|
|
89
|
+
</section>
|
|
90
|
+
<section id="section4">
|
|
91
|
+
<h2>The census in Northern Ireland and Scotland</h2>
|
|
92
|
+
<p>The Office for National Statistics (ONS) runs the census in England and Wales.</p>
|
|
93
|
+
|
|
94
|
+
<p>If you live in Northern Ireland, visit the Northern Ireland Statistics Agency (NISRA) census website to find out about the census for Northern Ireland.</p>
|
|
95
|
+
|
|
96
|
+
<p>If you live in Scotland, visit the National Records of Scotland census website to find out how to take part in the census for Scotland.</p>
|
|
97
|
+
</section>
|
|
98
|
+
<section id="section5">
|
|
99
|
+
<h2>The last census</h2>
|
|
100
|
+
<p>The last census took place in 2011. Many people and organisations used information from the 2011 Census in a variety of ways.</p>
|
|
101
|
+
|
|
102
|
+
<p>For example, Bristol City Council used it to inform decisions on how to fund local housing improvements. It was also essential for the charity Redbridge Council for Voluntary Services to help people from ethnic minority groups learn more about dementia.</p>
|
|
103
|
+
|
|
104
|
+
<p>To read more about the benefits that information from the 2011 Census helped to create, visit the Office for National Statistics (ONS) website.</p>
|
|
105
|
+
<p>The Census Coverage Survey (CCS) was a short, separate survey that we at the Office for National Statistics (ONS) started six to eight weeks after Census Day.</p>
|
|
106
|
+
|
|
107
|
+
<p>The CCS helps make sure everyone is counted and our census results are as accurate as possible. It asked similar questions to the main census, just fewer of them, at addresses in a selection of postcodes across England and Wales.</p>
|
|
108
|
+
|
|
109
|
+
<p>The CCS has now closed.</p>
|
|
110
|
+
</section>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
{% endblock %}
|