@ons/design-system 72.10.9 → 72.11.0
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 +9 -5
- package/components/announcement-banner/_announcement-banner.scss +24 -0
- package/components/announcement-banner/_macro.njk +33 -0
- package/components/announcement-banner/_macro.spec.js +106 -0
- package/components/announcement-banner/_test_examples.js +22 -0
- package/components/announcement-banner/example-banner-black.njk +12 -0
- package/components/announcement-banner/example-banner-red.njk +13 -0
- package/components/announcement-banner/example-banner-teal.njk +13 -0
- package/components/button/_button.scss +29 -1
- package/components/chart/_chart.scss +3 -0
- package/components/chart/_macro.njk +10 -4
- package/components/chart/_macro.spec.js +1150 -642
- package/components/chart/chart-iframe-resize.js +2 -2
- package/components/chart/example-iframe-chart.njk +1 -1
- package/components/duration/example-duration-error-for-single-field.njk +0 -1
- package/components/duration/example-duration-error.njk +0 -1
- package/components/footer/_macro.spec.js +2 -2
- package/components/header/_macro.njk +5 -16
- package/components/header/example-header-button-and-navigation.njk +133 -0
- package/components/header/example-header-external-with-navigation-and-search.njk +1 -1
- package/components/navigation/_macro.njk +11 -16
- package/components/navigation/_navigation.scss +24 -0
- package/components/table/_macro.njk +107 -112
- package/components/table/_macro.spec.js +35 -44
- package/components/table/_table.scss +0 -12
- package/components/table/example-table-sortable.njk +1 -1
- package/components/tabs/example-tabs-details.njk +1 -1
- package/components/textarea/_macro.njk +1 -0
- package/components/textarea/_macro.spec.js +1 -0
- package/components/timeout-panel/timeout-panel.spec.js +1 -1
- package/css/main.css +1 -1
- package/layout/_template.njk +13 -0
- package/package.json +3 -3
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/main.scss +1 -0
- package/scss/vars/_colors.scss +3 -0
- package/scss/vars/_forms.scss +11 -0
- package/components/table/example-table-scrollable.njk +0 -158
|
@@ -55,6 +55,41 @@ describe('macro: table', () => {
|
|
|
55
55
|
expect($('.ons-table').hasClass('another-extra-class')).toBe(true);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
+
it('renders "scrollable" container element', () => {
|
|
59
|
+
const $ = cheerio.load(renderComponent('table', EXAMPLE_TABLE));
|
|
60
|
+
|
|
61
|
+
expect($('.ons-table-scrollable').length).toBe(1);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('renders "content" container element', () => {
|
|
65
|
+
const $ = cheerio.load(renderComponent('table', EXAMPLE_TABLE));
|
|
66
|
+
|
|
67
|
+
expect($('.ons-table-scrollable__content').length).toBe(1);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('renders an appropriate `aria-label` attribute on the "content" container element', () => {
|
|
71
|
+
const $ = cheerio.load(
|
|
72
|
+
renderComponent('table', {
|
|
73
|
+
...EXAMPLE_TABLE,
|
|
74
|
+
caption: 'Example table caption',
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
expect($('.ons-table-scrollable__content').attr('aria-label')).toBe('Example table caption. Scrollable table');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('renders a custom `aria-label` attribute on the "content" container element', () => {
|
|
82
|
+
const $ = cheerio.load(
|
|
83
|
+
renderComponent('table', {
|
|
84
|
+
...EXAMPLE_TABLE,
|
|
85
|
+
caption: 'Example table caption',
|
|
86
|
+
ariaLabel: 'Special table',
|
|
87
|
+
}),
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
expect($('.ons-table-scrollable__content').attr('aria-label')).toBe('Example table caption. Special table');
|
|
91
|
+
});
|
|
92
|
+
|
|
58
93
|
describe('header row', () => {
|
|
59
94
|
it('renders header cells with expected text', () => {
|
|
60
95
|
const $ = cheerio.load(renderComponent('table', EXAMPLE_TABLE));
|
|
@@ -496,50 +531,6 @@ describe('macro: table', () => {
|
|
|
496
531
|
});
|
|
497
532
|
});
|
|
498
533
|
|
|
499
|
-
describe('scrollable variant', () => {
|
|
500
|
-
const params = {
|
|
501
|
-
...EXAMPLE_TABLE,
|
|
502
|
-
variants: ['scrollable'],
|
|
503
|
-
caption: 'Example table caption',
|
|
504
|
-
};
|
|
505
|
-
|
|
506
|
-
it('has the "scrollable" variant class', () => {
|
|
507
|
-
const $ = cheerio.load(renderComponent('table', params));
|
|
508
|
-
|
|
509
|
-
expect($('.ons-table').hasClass('ons-table--scrollable')).toBe(true);
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
it('renders "scrollable" container element', () => {
|
|
513
|
-
const $ = cheerio.load(renderComponent('table', params));
|
|
514
|
-
|
|
515
|
-
expect($('.ons-table-scrollable').length).toBe(1);
|
|
516
|
-
expect($('.ons-table-scrollable--on').length).toBe(1);
|
|
517
|
-
});
|
|
518
|
-
|
|
519
|
-
it('renders "content" container element', () => {
|
|
520
|
-
const $ = cheerio.load(renderComponent('table', params));
|
|
521
|
-
|
|
522
|
-
expect($('.ons-table-scrollable__content').length).toBe(1);
|
|
523
|
-
});
|
|
524
|
-
|
|
525
|
-
it('renders an appropriate `aria-label` attribute on the "content" container element', () => {
|
|
526
|
-
const $ = cheerio.load(renderComponent('table', params));
|
|
527
|
-
|
|
528
|
-
expect($('.ons-table-scrollable__content').attr('aria-label')).toBe('Example table caption. Scrollable table');
|
|
529
|
-
});
|
|
530
|
-
|
|
531
|
-
it('renders a custom `aria-label` attribute on the "content" container element', () => {
|
|
532
|
-
const $ = cheerio.load(
|
|
533
|
-
renderComponent('table', {
|
|
534
|
-
...params,
|
|
535
|
-
ariaLabel: 'Special table',
|
|
536
|
-
}),
|
|
537
|
-
);
|
|
538
|
-
|
|
539
|
-
expect($('.ons-table-scrollable__content').attr('aria-label')).toBe('Example table caption. Special table');
|
|
540
|
-
});
|
|
541
|
-
});
|
|
542
|
-
|
|
543
534
|
describe('sortable variant', () => {
|
|
544
535
|
const params = {
|
|
545
536
|
...EXAMPLE_TABLE,
|
|
@@ -116,12 +116,6 @@
|
|
|
116
116
|
background: var(--ons-color-grey-75);
|
|
117
117
|
border-radius: 20px;
|
|
118
118
|
}
|
|
119
|
-
&--on {
|
|
120
|
-
.ons-table__header,
|
|
121
|
-
.ons-table__cell {
|
|
122
|
-
white-space: nowrap;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
119
|
&__content {
|
|
126
120
|
overflow: visible;
|
|
127
121
|
overflow-x: auto;
|
|
@@ -134,12 +128,6 @@
|
|
|
134
128
|
outline: 3px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
|
|
135
129
|
outline-offset: 1px;
|
|
136
130
|
}
|
|
137
|
-
.ons-table__header,
|
|
138
|
-
.ons-table__cell {
|
|
139
|
-
@include mq('2xs', m) {
|
|
140
|
-
white-space: nowrap;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
131
|
.ons-table__right-shadow,
|
|
144
132
|
.ons-table__left-shadow {
|
|
145
133
|
height: 100%;
|
|
@@ -178,6 +178,7 @@ describe('macro: textarea', () => {
|
|
|
178
178
|
faker.renderComponent('textarea', EXAMPLE_TEXTAREA);
|
|
179
179
|
|
|
180
180
|
expect(labelSpy.occurrences).toContainEqual({
|
|
181
|
+
id: 'example-id-label',
|
|
181
182
|
for: 'example-id',
|
|
182
183
|
text: 'Please provide some feedback',
|
|
183
184
|
description: 'For example, describe any difficulties you experienced in the use of this service',
|
|
@@ -137,7 +137,7 @@ describe('script: timeout panel', () => {
|
|
|
137
137
|
});
|
|
138
138
|
});
|
|
139
139
|
|
|
140
|
-
describe('when
|
|
140
|
+
describe('when JavaScript is disabled', () => {
|
|
141
141
|
beforeEach(async () => {
|
|
142
142
|
const expiryTime = new Date(Date.now() + 1 * 1000);
|
|
143
143
|
const expiryTimeInISOFormat = new Date(expiryTime).toISOString();
|