@stackoverflow/stacks 2.3.3 → 2.5.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/dist/css/stacks.css +37 -4884
- package/dist/css/stacks.min.css +1 -1
- package/lib/components/button/button.less +0 -18
- package/lib/components/tag/tag.less +16 -68
- package/lib/components/topbar/topbar.less +33 -3
- package/lib/exports/color-mixins.less +0 -2
- package/lib/exports/exports.less +0 -1
- package/lib/stacks-static.less +0 -5
- package/package.json +12 -11
- package/lib/atomic/__snapshots__/color-new.less.test.ts.snap +0 -3015
- package/lib/atomic/__snapshots__/color.less.test.ts.snap +0 -3132
- package/lib/atomic/__snapshots__/misc.less.test.ts.snap +0 -893
- package/lib/atomic/__snapshots__/spacing.less.test.ts.snap +0 -1928
- package/lib/atomic/color.less.test.ts +0 -12
- package/lib/atomic/misc.less.test.ts +0 -12
- package/lib/atomic/spacing.less.test.ts +0 -12
- package/lib/atomic/v1/__snapshots__/border.less.test.ts.snap +0 -546
- package/lib/atomic/v1/__snapshots__/color.less.test.ts.snap +0 -6750
- package/lib/atomic/v1/__snapshots__/typography.less.test.ts.snap +0 -16
- package/lib/atomic/v1/border.less +0 -210
- package/lib/atomic/v1/border.less.test.ts +0 -14
- package/lib/atomic/v1/color.less +0 -183
- package/lib/atomic/v1/color.less.test.ts +0 -14
- package/lib/atomic/v1/typography.less +0 -8
- package/lib/atomic/v1/typography.less.test.ts +0 -14
- package/lib/components/activity-indicator/activity-indicator.a11y.test.ts +0 -13
- package/lib/components/activity-indicator/activity-indicator.visual.test.ts +0 -22
- package/lib/components/anchor/anchor.a11y.test.ts +0 -35
- package/lib/components/anchor/anchor.visual.test.ts +0 -47
- package/lib/components/avatar/avatar.a11y.test.ts +0 -35
- package/lib/components/avatar/avatar.visual.test.ts +0 -50
- package/lib/components/award-bling/award-bling.a11y.test.ts +0 -15
- package/lib/components/award-bling/award-bling.visual.test.ts +0 -24
- package/lib/components/badge/badge.a11y.test.ts +0 -143
- package/lib/components/badge/badge.visual.test.ts +0 -165
- package/lib/components/banner/banner.a11y.test.ts +0 -36
- package/lib/components/banner/banner.test.ts +0 -73
- package/lib/components/banner/banner.visual.test.ts +0 -36
- package/lib/components/block-link/block-link.a11y.test.ts +0 -57
- package/lib/components/block-link/block-link.visual.test.ts +0 -57
- package/lib/components/breadcrumbs/breadcrumbs.a11y.test.ts +0 -36
- package/lib/components/breadcrumbs/breadcrumbs.visual.test.ts +0 -36
- package/lib/components/button/button.a11y.test.ts +0 -21
- package/lib/components/button/button.test.setup.ts +0 -36
- package/lib/components/button/button.visual.test.ts +0 -18
- package/lib/components/button-group/button-group.a11y.test.ts +0 -12
- package/lib/components/button-group/button-group.test.setup.ts +0 -77
- package/lib/components/button-group/button-group.visual.test.ts +0 -7
- package/lib/components/card/card.a11y.test.ts +0 -12
- package/lib/components/card/card.visual.test.ts +0 -52
- package/lib/components/check-control/check-control.a11y.test.ts +0 -33
- package/lib/components/check-control/check-control.visual.test.ts +0 -36
- package/lib/components/check-group/check-group.a11y.test.ts +0 -49
- package/lib/components/check-group/check-group.visual.test.ts +0 -56
- package/lib/components/checkbox_radio/checkbox_radio.a11y.test.ts +0 -37
- package/lib/components/checkbox_radio/checkbox_radio.visual.test.ts +0 -33
- package/lib/components/code-block/code-block.a11y.test.ts +0 -27
- package/lib/components/code-block/code-block.visual.test.ts +0 -18
- package/lib/components/description/description.a11y.test.ts +0 -28
- package/lib/components/description/description.visual.test.ts +0 -28
- package/lib/components/empty-state/empty-state.a11y.test.ts +0 -16
- package/lib/components/empty-state/empty-state.visual.test.ts +0 -16
- package/lib/components/expandable/expandable.a11y.test.ts +0 -26
- package/lib/components/expandable/expandable.test.ts +0 -51
- package/lib/components/expandable/expandable.visual.test.ts +0 -26
- package/lib/components/input-fill/input-fill.a11y.test.ts +0 -21
- package/lib/components/input-fill/input-fill.visual.test.ts +0 -21
- package/lib/components/input-icon/input-icon.a11y.test.ts +0 -81
- package/lib/components/input-icon/input-icon.visual.test.ts +0 -92
- package/lib/components/input-message/input-message.a11y.test.ts +0 -57
- package/lib/components/input-message/input-message.visual.test.ts +0 -58
- package/lib/components/input_textarea/input_textarea.a11y.test.ts +0 -109
- package/lib/components/input_textarea/input_textarea.visual.test.ts +0 -95
- package/lib/components/label/label.a11y.test.ts +0 -47
- package/lib/components/label/label.visual.test.ts +0 -65
- package/lib/components/link/link.a11y.test.ts +0 -27
- package/lib/components/link/link.visual.test.ts +0 -31
- package/lib/components/link-preview/link-preview.a11y.test.ts +0 -47
- package/lib/components/link-preview/link-preview.visual.test.ts +0 -52
- package/lib/components/menu/menu.a11y.test.ts +0 -39
- package/lib/components/menu/menu.visual.test.ts +0 -39
- package/lib/components/modal/modal.a11y.test.ts +0 -41
- package/lib/components/modal/modal.test.ts +0 -155
- package/lib/components/modal/modal.visual.test.ts +0 -41
- package/lib/components/navigation/navigation.a11y.test.ts +0 -81
- package/lib/components/navigation/navigation.visual.test.ts +0 -98
- package/lib/components/notice/notice.a11y.test.ts +0 -16
- package/lib/components/notice/notice.visual.test.ts +0 -25
- package/lib/components/page-title/page-title.a11y.test.ts +0 -28
- package/lib/components/page-title/page-title.visual.test.ts +0 -58
- package/lib/components/pagination/pagination.a11y.test.ts +0 -21
- package/lib/components/pagination/pagination.visual.test.ts +0 -25
- package/lib/components/popover/tooltip.test.ts +0 -62
- package/lib/components/post-summary/post-summary.a11y.test.ts +0 -25
- package/lib/components/post-summary/post-summary.test.setup.ts +0 -435
- package/lib/components/post-summary/post-summary.visual.test.ts +0 -17
- package/lib/components/progress-bar/progress-bar.a11y.test.ts +0 -189
- package/lib/components/progress-bar/progress-bar.visual.test.ts +0 -188
- package/lib/components/select/select.a11y.test.ts +0 -72
- package/lib/components/select/select.visual.test.ts +0 -72
- package/lib/components/spinner/spinner.a11y.test.ts +0 -14
- package/lib/components/spinner/spinner.visual.test.ts +0 -40
- package/lib/components/table/table.a11y.test.ts +0 -112
- package/lib/components/table/table.test.ts +0 -366
- package/lib/components/table/table.visual.test.ts +0 -104
- package/lib/components/tag/tag.a11y.test.ts +0 -28
- package/lib/components/tag/tag.visual.test.ts +0 -43
- package/lib/components/toast/toast.a11y.test.ts +0 -29
- package/lib/components/toast/toast.test.ts +0 -64
- package/lib/components/toast/toast.visual.test.ts +0 -30
- package/lib/components/toggle-switch/toggle-switch.a11y.test.ts +0 -66
- package/lib/components/toggle-switch/toggle-switch.visual.test.ts +0 -70
- package/lib/components/topbar/topbar.visual.test.ts +0 -216
- package/lib/exports/__snapshots__/color-mixins.less.test.ts.snap +0 -558
- package/lib/exports/__snapshots__/color.less.test.ts.snap +0 -819
- package/lib/exports/color-mixins.less.test.ts +0 -150
- package/lib/exports/color.less.test.ts +0 -12
- package/lib/exports/v1/__snapshots__/constants-colors.less.test.ts.snap +0 -902
- package/lib/exports/v1/constants-colors.less +0 -893
- package/lib/exports/v1/constants-colors.less.test.ts +0 -12
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("toggle-switch", () => {
|
|
6
|
-
// Single toggle switch
|
|
7
|
-
[true, false].forEach((checked) => {
|
|
8
|
-
[true, false].forEach((disabled) => {
|
|
9
|
-
const idSuffix = `${checked ? "-checked" : ""}${
|
|
10
|
-
disabled ? "-disabled" : ""
|
|
11
|
-
}`;
|
|
12
|
-
const id = `toggle-switch${idSuffix}`;
|
|
13
|
-
|
|
14
|
-
runA11yTests({
|
|
15
|
-
baseClass: "s-toggle-switch",
|
|
16
|
-
modifiers: {
|
|
17
|
-
global: idSuffix ? [idSuffix.substring(1)] : [], // for proper testid generation
|
|
18
|
-
},
|
|
19
|
-
tag: "input",
|
|
20
|
-
attributes: {
|
|
21
|
-
id,
|
|
22
|
-
type: "checkbox",
|
|
23
|
-
...(checked ? { checked: "" } : {}),
|
|
24
|
-
...(disabled ? { disabled: "" } : {}),
|
|
25
|
-
},
|
|
26
|
-
template: ({ component, testid }) => html`
|
|
27
|
-
<div data-testid="${testid}">
|
|
28
|
-
<label for="${id}">toggle</label>
|
|
29
|
-
${component}
|
|
30
|
-
</div>
|
|
31
|
-
`,
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// Multiple toggle switch variant
|
|
37
|
-
[true, false].forEach((offChecked) => {
|
|
38
|
-
runA11yTests({
|
|
39
|
-
baseClass: "s-toggle-switch",
|
|
40
|
-
variants: ["multiple"],
|
|
41
|
-
modifiers: {
|
|
42
|
-
global: offChecked ? ["off"] : [], // for proper testid generation
|
|
43
|
-
},
|
|
44
|
-
children: {
|
|
45
|
-
default: `
|
|
46
|
-
<input type="radio" name="group" id="four" ${
|
|
47
|
-
offChecked ? 'checked=""' : ""
|
|
48
|
-
}>
|
|
49
|
-
<label for="four" class="s-toggle-switch--label-off">Off</label>
|
|
50
|
-
<input type="radio" name="group" id="one" ${
|
|
51
|
-
!offChecked ? 'checked=""' : ""
|
|
52
|
-
}>
|
|
53
|
-
<label for="one">one</label>
|
|
54
|
-
<input type="radio" name="group" id="two">
|
|
55
|
-
<label for="two">two</label>
|
|
56
|
-
`,
|
|
57
|
-
},
|
|
58
|
-
options: {
|
|
59
|
-
includeNullVariant: false,
|
|
60
|
-
},
|
|
61
|
-
template: ({ component, testid }) => html`
|
|
62
|
-
<div data-testid="${testid}">${component}</div>
|
|
63
|
-
`,
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
});
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("toggle-switch", () => {
|
|
6
|
-
// Single toggle switch
|
|
7
|
-
[true, false].forEach((checked) => {
|
|
8
|
-
[true, false].forEach((disabled) => {
|
|
9
|
-
const testidSuffix = `${checked ? "checked" : "unchecked"}${
|
|
10
|
-
disabled ? "-disabled" : "-enabled"
|
|
11
|
-
}`;
|
|
12
|
-
const id = `toggle-switch-${testidSuffix}`;
|
|
13
|
-
|
|
14
|
-
runVisualTests({
|
|
15
|
-
baseClass: "s-toggle-switch",
|
|
16
|
-
tag: "input",
|
|
17
|
-
attributes: {
|
|
18
|
-
id,
|
|
19
|
-
type: "checkbox",
|
|
20
|
-
...(checked ? { checked: "" } : {}),
|
|
21
|
-
...(disabled ? { disabled: "" } : {}),
|
|
22
|
-
},
|
|
23
|
-
options: {
|
|
24
|
-
includeNullModifier: false,
|
|
25
|
-
testidSuffix,
|
|
26
|
-
},
|
|
27
|
-
template: ({ component, testid }) => html`
|
|
28
|
-
<div data-testid="${testid}" class="p4 ws1">
|
|
29
|
-
<label class="v-visible-sr" for="${id}">toggle</label>
|
|
30
|
-
${component}
|
|
31
|
-
</div>
|
|
32
|
-
`,
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// Multiple toggle switch variant
|
|
38
|
-
[true, false].forEach((offChecked) => {
|
|
39
|
-
runVisualTests({
|
|
40
|
-
baseClass: "s-toggle-switch",
|
|
41
|
-
variants: ["multiple"],
|
|
42
|
-
children: {
|
|
43
|
-
default: `
|
|
44
|
-
<input type="radio" name="group" id="off" ${
|
|
45
|
-
offChecked ? 'checked=""' : ""
|
|
46
|
-
}>
|
|
47
|
-
<label for="off" class="s-toggle-switch--label-off">Off</label>
|
|
48
|
-
<input type="radio" name="group" id="one" ${
|
|
49
|
-
!offChecked ? 'checked=""' : ""
|
|
50
|
-
}>
|
|
51
|
-
<label for="one">Weekly</label>
|
|
52
|
-
<input type="radio" name="group" id="two">
|
|
53
|
-
<label for="two">Daily</label>
|
|
54
|
-
<input type="radio" name="group" id="three">
|
|
55
|
-
<label for="three">3 hrs</label>
|
|
56
|
-
`,
|
|
57
|
-
},
|
|
58
|
-
options: {
|
|
59
|
-
includeNullModifier: false,
|
|
60
|
-
includeNullVariant: false,
|
|
61
|
-
testidSuffix: offChecked ? "unchecked" : "checked",
|
|
62
|
-
},
|
|
63
|
-
template: ({ component, testid }) => html`
|
|
64
|
-
<div data-testid="${testid}" class="d-flex ai-center g8 p4 ws2">
|
|
65
|
-
${component}
|
|
66
|
-
</div>
|
|
67
|
-
`,
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
});
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
import {
|
|
4
|
-
IconAchievements,
|
|
5
|
-
IconAlert,
|
|
6
|
-
IconHelp,
|
|
7
|
-
IconInbox,
|
|
8
|
-
IconModerator,
|
|
9
|
-
IconReviewQueue,
|
|
10
|
-
IconSearch,
|
|
11
|
-
IconStackExchange,
|
|
12
|
-
} from "@stackoverflow/stacks-icons/icons";
|
|
13
|
-
import { html } from "@open-wc/testing";
|
|
14
|
-
|
|
15
|
-
const base64Image =
|
|
16
|
-
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATwAAAE8CAMAAABq2/00AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABhQTFRF/3IA/////44y/8OS/+fU//Xs/6tn/9e2EhvbMQAABH9JREFUeNrs3e1y2ygAhWELJHH/d7zuJpN1XAnxoe408Ly/6xnnHXEOIEwfDwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/gbAGEhrZl2VloY20PIk8tAzZbfkXA7eeuHyysVfdFMsXiY66ptiWF8Re05BdxF7HkBV7PUNW7FVx4E7sVSwrDjBw2+pC7NWwHtkTe3ULM7En9v6O2ONF7Ik9sSf2IPbEntgTexB7t8feTsynniD2Oh6tXex1hFoUe02kaxVi72JMZs+Rib0LLdkXFGLvaECWjkOxdxVmUex1rB6S2Kss2lcytSH2LnVkakPsXQ7E8xwTe5fuMrUh9vKj8CP4xN7lNOXc3mnwib1M2X7Z28VeS93mg0/sFZTG6WCMVSE51fqsYL4s9jpqQ+yV1caxErHXUxtir6c2xF5HbYRF7LXXhtjrqQ2x11MbYu9tLG4VtSH2empD7BUNxpPaSGKvPPh2sdcxX45i78baEHs18+X32hB7NfPl99oQex21MVHsxViaR8W1MU3s/XpMSvWF0tqYJfY+BmMq01dcG+scP6/6enTK9BW+1J0j9l5aYN0rP5BzM0XsbSUnAlpqY4LYezexFeRSbpslH3uDXdF64OG6est258PohXE8BK+7o6g29rJTQsPt1F3qK9qdTwMP2Wz2X1Vv0UvdbeQ53nl2Xesr2Z0Pww7Zs5lsafWW1MY+6JDNxv5/+kLb5/fXfzLirRdhKSGnr6A2tkGvJoxLGZnqva6NkAbdgA+pUN9a+QuWYYPu+98ee/W1/PJgoMG7lek7nW3UHiEdbKpcqu+kO2L9b4aG0rcWjt5jfWf2Z7kCeE891XtSG/O86A5d+tbZj1h0VW+c/ja90FG9uxMCFdWb/+SkZ1Oaq/d1vjzvXfvF+tLp+aiZT5S1Vm90lrFj02B3bW1d9X7T92u+7Aq9qk2D+Fob/v/Myu7YostC76xe9K966evfr5+7ekuXHVy1V6+R275pEMd3kPbGB+Syeod/8D7Sf41NBvPdMf7a4uXpaTGY0zd+4r0vDlKtwdPqHf/BOzzf8zQYqvRtcz54mXfUNUVyUL0T7AhcrBbKY/C36p1geVEy1y00+F3fBA9eKFxnlRXJa/XOcKxnqeF6Pv1VvTPc7RuXai6K5LN6Z9hQSUsb2Rh86pviUultaScTg/sMD15YeqmcT8/bFx1Foi/umk9P3hcMfqTenrabBT5j8DGTwHivwelOCTwNrnfJm/Ol2U0GZ74WdE+dBn9+Z/z2J9UZ7IjB7dZv8gPl9RRJIq89BiN57QZ38trn04G8k62E6xjcHuQ1D+JEXrvBnbz2+XQgr30+/SCveT69ktceg4m8doOBvDG/CXnkkTezvOXPQB555JFHHnnkkUceeeSRRx555JFHHnnkkWcnmTzyyCOPPPLII4888sgjjzzfhDzyyCOPPPL+9Ff+eyCPPPLII4888sgjjzzyyCOPPPLII4888sgDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPy//CPAAPiZOI3BPDFQAAAAAElFTkSuQmCC";
|
|
17
|
-
|
|
18
|
-
// Children
|
|
19
|
-
const children = {
|
|
20
|
-
hamburger: {
|
|
21
|
-
unselected: `<a href="#" class="s-topbar--menu-btn" aria-label="menu"><span></span></a>`,
|
|
22
|
-
selected: `<a href="#" class="s-topbar--menu-btn is-selected" aria-label="menu"><span></span></a>`,
|
|
23
|
-
},
|
|
24
|
-
logo: `<a href="#" class="s-topbar--logo" aria-label="logo">${IconStackExchange}</a>`,
|
|
25
|
-
notice: {
|
|
26
|
-
default: `<a href="#" class="s-topbar--notice">old</a>`,
|
|
27
|
-
unread: `<a href="#" class="s-topbar--notice is-unread">new</a>`,
|
|
28
|
-
},
|
|
29
|
-
navigation: {
|
|
30
|
-
minimal: `<ol class="s-navigation fw-nowrap"><li><a href="#" class="s-navigation--item">Products</a></li></ol>`,
|
|
31
|
-
full: `<ol class="s-navigation fw-nowrap sm:d-none">
|
|
32
|
-
<li><a href="#" class="s-navigation--item">About</a></li>
|
|
33
|
-
<li><a href="#" class="s-navigation--item is-selected">Products</a></li>
|
|
34
|
-
<li><a href="#" class="s-navigation--item">For Teams</a></li>
|
|
35
|
-
</ol>`,
|
|
36
|
-
},
|
|
37
|
-
searchbar: {
|
|
38
|
-
input: `<div class="s-topbar--searchbar--input-group">
|
|
39
|
-
<input type="text" placeholder="Search…" value="" autocomplete="off" class="s-input s-input__search">
|
|
40
|
-
${IconSearch.replace("svg-icon iconSearch", "s-input-icon s-input-icon__search svg-icon iconSearch")}
|
|
41
|
-
</div>`,
|
|
42
|
-
select: `<div class="s-select">
|
|
43
|
-
<select aria-label="Search scope">
|
|
44
|
-
<option selected="selected">All</option>
|
|
45
|
-
<option>Public</option>
|
|
46
|
-
<option>Private Team 1</option>
|
|
47
|
-
</select>
|
|
48
|
-
</div>`,
|
|
49
|
-
},
|
|
50
|
-
content: {
|
|
51
|
-
items: `
|
|
52
|
-
<li>
|
|
53
|
-
<a href="#" class="s-topbar--item" aria-label="Inbox">
|
|
54
|
-
${IconInbox} <span class="s-activity-indicator s-activity-indicator__danger">3</span>
|
|
55
|
-
</a>
|
|
56
|
-
</li>
|
|
57
|
-
<li>
|
|
58
|
-
<a href="#" class="s-topbar--item" aria-label="Achievements">
|
|
59
|
-
${IconAchievements} <span class="s-activity-indicator s-activity-indicator__success">+10</span>
|
|
60
|
-
</a>
|
|
61
|
-
</li>
|
|
62
|
-
<li>
|
|
63
|
-
<a href="#" class="s-topbar--item" aria-label="Review queues">
|
|
64
|
-
${IconReviewQueue}
|
|
65
|
-
<div class="s-activity-indicator s-activity-indicator__danger">
|
|
66
|
-
<div class="v-visible-sr">New activity</div>
|
|
67
|
-
</div>
|
|
68
|
-
</a>
|
|
69
|
-
</li>
|
|
70
|
-
<li><a href="#" class="s-topbar--item" aria-label="Help center">${IconHelp}</a></li>
|
|
71
|
-
<li><a href="#" class="s-topbar--item" aria-label="Site switcher">${IconStackExchange}</a></li>
|
|
72
|
-
<li><a href="#" class="s-topbar--item" title="Moderator inbox">${IconModerator}</a></li>
|
|
73
|
-
<li>
|
|
74
|
-
<a href="#" class="s-topbar--item" title="8 posts flagged for moderator attention">
|
|
75
|
-
<span class="s-badge s-badge__bounty">8</span>
|
|
76
|
-
</a>
|
|
77
|
-
</li>
|
|
78
|
-
`,
|
|
79
|
-
unset: `<li><a href="#" class="s-topbar--item" aria-label="Unset item">${IconAlert}</a></li>`,
|
|
80
|
-
loggedOut: `
|
|
81
|
-
<li>
|
|
82
|
-
<a href="#" class="s-topbar--item s-topbar--item__unset s-btn s-btn__outlined ws-nowrap">Log in</a>
|
|
83
|
-
</li>
|
|
84
|
-
<li>
|
|
85
|
-
<a href="#" class="s-topbar--item s-topbar--item__unset s-btn s-btn__filled ws-nowrap">Sign up</a>
|
|
86
|
-
</li>
|
|
87
|
-
`,
|
|
88
|
-
loggedIn: `<li>
|
|
89
|
-
<a href="#" class="s-topbar--item s-user-card s-user-card__small">
|
|
90
|
-
<span class="s-avatar s-avatar__24 s-user-card--avatar">
|
|
91
|
-
<img class="s-avatar--image" alt="demo avatar" src="${base64Image}">
|
|
92
|
-
<span class="v-visible-sr">John Doe</span>
|
|
93
|
-
</span>
|
|
94
|
-
<div class="s-user-card--info">
|
|
95
|
-
<ul class="s-user-card--awards">
|
|
96
|
-
<li class="s-user-card--rep">3,145</li>
|
|
97
|
-
<li class="s-award-bling s-award-bling__gold">3</li>
|
|
98
|
-
<li class="s-award-bling s-award-bling__silver">9</li>
|
|
99
|
-
<li class="s-award-bling s-award-bling__bronze">20</li>
|
|
100
|
-
</ul>
|
|
101
|
-
</div>
|
|
102
|
-
</a>
|
|
103
|
-
</li>`,
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const topbarChildren = ({
|
|
108
|
-
hamburger = "",
|
|
109
|
-
loggedIn = true,
|
|
110
|
-
navigation = "",
|
|
111
|
-
notice = "",
|
|
112
|
-
searchInput = false,
|
|
113
|
-
searchSelect = false,
|
|
114
|
-
unsetItem = false,
|
|
115
|
-
}: {
|
|
116
|
-
hamburger?: "" | "selected" | "unselected";
|
|
117
|
-
loggedIn?: boolean;
|
|
118
|
-
navigation?: "" | "minimal" | "full";
|
|
119
|
-
notice?: "" | "default" | "unread";
|
|
120
|
-
searchInput?: boolean;
|
|
121
|
-
searchSelect?: boolean;
|
|
122
|
-
unsetItem?: boolean;
|
|
123
|
-
}) => {
|
|
124
|
-
return `
|
|
125
|
-
<div class="s-topbar--container">
|
|
126
|
-
${hamburger ? (hamburger === "unselected" ? children.hamburger.unselected : children.hamburger.selected) : ""}
|
|
127
|
-
${children.logo}
|
|
128
|
-
${notice ? (notice === "default" ? children.notice.default : children.notice.unread) : ""}
|
|
129
|
-
${
|
|
130
|
-
navigation
|
|
131
|
-
? `
|
|
132
|
-
<nav aria-label="Demo primary navigation" role="presentation">
|
|
133
|
-
<ol class="s-navigation fw-nowrap sm:d-none">
|
|
134
|
-
${navigation === "minimal" ? children.navigation.minimal : children.navigation.full}
|
|
135
|
-
</ol>
|
|
136
|
-
</nav>
|
|
137
|
-
`
|
|
138
|
-
: ""
|
|
139
|
-
}
|
|
140
|
-
${
|
|
141
|
-
searchInput
|
|
142
|
-
? `
|
|
143
|
-
<form class="s-topbar--searchbar" autocomplete="off">
|
|
144
|
-
${searchSelect ? children.searchbar.select : ""}
|
|
145
|
-
${children.searchbar.input}
|
|
146
|
-
</form>
|
|
147
|
-
`
|
|
148
|
-
: ""
|
|
149
|
-
}
|
|
150
|
-
<nav class="s-topbar--navigation" aria-label="Demo secondary navigation" role="presentation">
|
|
151
|
-
<ol class="s-topbar--content">
|
|
152
|
-
${unsetItem ? children.content.unset : ""}
|
|
153
|
-
${children.content.items}
|
|
154
|
-
${loggedIn ? children.content.loggedIn : children.content.loggedOut}
|
|
155
|
-
</ol>
|
|
156
|
-
</nav>
|
|
157
|
-
</div>
|
|
158
|
-
`;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
// Configurations
|
|
162
|
-
const topbars = {
|
|
163
|
-
default: topbarChildren({ hamburger: "unselected" }),
|
|
164
|
-
advanced: topbarChildren({
|
|
165
|
-
navigation: "minimal",
|
|
166
|
-
notice: "default",
|
|
167
|
-
searchInput: true,
|
|
168
|
-
searchSelect: true,
|
|
169
|
-
unsetItem: true,
|
|
170
|
-
}),
|
|
171
|
-
input: topbarChildren({ navigation: "minimal", searchInput: true }),
|
|
172
|
-
alt: topbarChildren({
|
|
173
|
-
hamburger: "selected",
|
|
174
|
-
navigation: "full",
|
|
175
|
-
notice: "unread",
|
|
176
|
-
searchInput: true,
|
|
177
|
-
searchSelect: true,
|
|
178
|
-
unsetItem: true,
|
|
179
|
-
}),
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
describe("topbar", () => {
|
|
183
|
-
runVisualTests({
|
|
184
|
-
baseClass: "s-topbar",
|
|
185
|
-
tag: "header",
|
|
186
|
-
children: topbars,
|
|
187
|
-
variants: ["dark variant", "light variant"], // `variant` added to make file labeling clearer
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
// Custom theme variables
|
|
191
|
-
runVisualTests({
|
|
192
|
-
baseClass: "s-topbar",
|
|
193
|
-
children: {
|
|
194
|
-
themed: topbars.default,
|
|
195
|
-
},
|
|
196
|
-
template: ({ component, testid }) => html`
|
|
197
|
-
<div data-testid="${testid}">
|
|
198
|
-
<style type="text/css">
|
|
199
|
-
.s-topbar {
|
|
200
|
-
--theme-topbar-accent-border: red;
|
|
201
|
-
--theme-topbar-background-color: green;
|
|
202
|
-
--theme-topbar-bottom-border: blue;
|
|
203
|
-
--theme-topbar-height: 80px;
|
|
204
|
-
--theme-topbar-item-color: yellow;
|
|
205
|
-
--theme-topbar-search-background: pink;
|
|
206
|
-
--theme-topbar-search-border: purple;
|
|
207
|
-
--theme-topbar-search-placeholder: white;
|
|
208
|
-
--theme-topbar-select-background: lightblue;
|
|
209
|
-
--theme-topbar-select-color: magenta;
|
|
210
|
-
}
|
|
211
|
-
</style>
|
|
212
|
-
${component}
|
|
213
|
-
</div>
|
|
214
|
-
`,
|
|
215
|
-
});
|
|
216
|
-
});
|