@stackoverflow/stacks 1.10.0 → 1.10.2
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 +7 -5
- package/dist/css/stacks.min.css +1 -1
- package/dist/js/stacks.js +1 -0
- package/lib/base/body.less +1 -1
- package/lib/components/badge/badge.a11y.test.ts +121 -0
- package/lib/components/badge/badge.visual.test.ts +128 -0
- package/lib/components/check-control/check-control.a11y.test.ts +40 -0
- package/lib/components/check-control/check-control.visual.test.ts +38 -0
- package/lib/components/check-group/check-group.a11y.test.ts +51 -0
- package/lib/components/check-group/check-group.visual.test.ts +58 -0
- package/lib/components/checkbox_radio/checkbox_radio.a11y.test.ts +39 -0
- package/lib/components/checkbox_radio/checkbox_radio.visual.test.ts +35 -0
- package/lib/components/description/description.a11y.test.ts +30 -0
- package/lib/components/description/description.visual.test.ts +30 -0
- package/lib/components/toggle-switch/toggle-switch.a11y.test.ts +73 -0
- package/lib/components/toggle-switch/toggle-switch.less +2 -1
- package/lib/components/toggle-switch/toggle-switch.visual.test.ts +73 -0
- package/lib/components/uploader/uploader.ts +1 -0
- package/lib/exports/constants-type.less +3 -3
- package/package.json +12 -12
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import { defaultOptions, runComponentTests } from "../../test/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
|
+
runComponentTests({
|
|
15
|
+
type: "visual",
|
|
16
|
+
baseClass: "s-toggle-switch",
|
|
17
|
+
modifiers: {
|
|
18
|
+
global: idSuffix ? [idSuffix.substring(1)] : [], // for proper testid generation
|
|
19
|
+
},
|
|
20
|
+
tag: "input",
|
|
21
|
+
attributes: {
|
|
22
|
+
id,
|
|
23
|
+
type: "checkbox",
|
|
24
|
+
...(checked ? { checked: "" } : {}),
|
|
25
|
+
...(disabled ? { disabled: "" } : {}),
|
|
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
|
+
runComponentTests({
|
|
40
|
+
type: "visual",
|
|
41
|
+
baseClass: "s-toggle-switch",
|
|
42
|
+
variants: ["multiple"],
|
|
43
|
+
modifiers: {
|
|
44
|
+
global: offChecked ? ["off"] : [], // for proper testid generation
|
|
45
|
+
},
|
|
46
|
+
children: {
|
|
47
|
+
default: `
|
|
48
|
+
<input type="radio" name="group" id="four" ${
|
|
49
|
+
offChecked ? 'checked=""' : ""
|
|
50
|
+
}>
|
|
51
|
+
<label for="four" class="s-toggle-switch--label-off">Off</label>
|
|
52
|
+
<input type="radio" name="group" id="one" ${
|
|
53
|
+
!offChecked ? 'checked=""' : ""
|
|
54
|
+
}>
|
|
55
|
+
<label for="one">Weekly</label>
|
|
56
|
+
<input type="radio" name="group" id="two">
|
|
57
|
+
<label for="two">Daily</label>
|
|
58
|
+
<input type="radio" name="group" id="three">
|
|
59
|
+
<label for="three">3 hrs</label>
|
|
60
|
+
`,
|
|
61
|
+
},
|
|
62
|
+
options: {
|
|
63
|
+
...defaultOptions,
|
|
64
|
+
includeNullVariant: false,
|
|
65
|
+
},
|
|
66
|
+
template: ({ component, testid }) => html`
|
|
67
|
+
<div data-testid="${testid}" class="d-flex ai-center g8 p4 ws2">
|
|
68
|
+
${component}
|
|
69
|
+
</div>
|
|
70
|
+
`,
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -136,6 +136,7 @@ export class UploaderController extends Stacks.StacksController {
|
|
|
136
136
|
|
|
137
137
|
if (file.type.match("image/*") && file.data) {
|
|
138
138
|
thumbElement = document.createElement("img");
|
|
139
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
139
140
|
thumbElement.src = file.data.toString();
|
|
140
141
|
thumbElement.alt = file.name;
|
|
141
142
|
} else {
|
|
@@ -99,9 +99,9 @@ body {
|
|
|
99
99
|
// $ FONT SIZES (fs-)
|
|
100
100
|
// Base font-size is 13px.
|
|
101
101
|
// ----------------------------------------------------------------------------
|
|
102
|
-
--fs-fine:
|
|
103
|
-
--fs-caption:
|
|
104
|
-
--fs-body1:
|
|
102
|
+
--fs-fine: 11px;
|
|
103
|
+
--fs-caption: 12px;
|
|
104
|
+
--fs-body1: 13px;
|
|
105
105
|
|
|
106
106
|
// Relative to the root element
|
|
107
107
|
--fs-body2: 1.153846154rem;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/StackExchange/Stacks.git"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.10.
|
|
8
|
+
"version": "1.10.2",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
11
|
"lib"
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"@open-wc/testing": "^3.2.0",
|
|
47
47
|
"@rollup/plugin-commonjs": "^25.0.3",
|
|
48
48
|
"@rollup/plugin-replace": "^5.0.2",
|
|
49
|
-
"@stackoverflow/stacks-editor": "^0.8.
|
|
49
|
+
"@stackoverflow/stacks-editor": "^0.8.8",
|
|
50
50
|
"@stackoverflow/stacks-icons": "^5.4.0",
|
|
51
51
|
"@testing-library/dom": "^9.3.1",
|
|
52
52
|
"@testing-library/user-event": "^14.4.3",
|
|
53
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
54
|
-
"@typescript-eslint/parser": "^
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^6.2.1",
|
|
54
|
+
"@typescript-eslint/parser": "^6.2.1",
|
|
55
55
|
"@web/dev-server-esbuild": "^0.4.1",
|
|
56
|
-
"@web/dev-server-rollup": "^0.
|
|
57
|
-
"@web/test-runner": "^0.
|
|
56
|
+
"@web/dev-server-rollup": "^0.5.2",
|
|
57
|
+
"@web/test-runner": "^0.17.0",
|
|
58
58
|
"@web/test-runner-playwright": "^0.10.1",
|
|
59
|
-
"@web/test-runner-visual-regression": "^0.8.
|
|
59
|
+
"@web/test-runner-visual-regression": "^0.8.2",
|
|
60
60
|
"concurrently": "^8.2.0",
|
|
61
61
|
"css-loader": "^6.8.1",
|
|
62
62
|
"cssnano": "^6.0.1",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"eleventy-plugin-highlightjs": "^1.1.0",
|
|
65
65
|
"eleventy-plugin-nesting-toc": "^1.3.0",
|
|
66
66
|
"eslint": "^8.45.0",
|
|
67
|
-
"eslint-config-prettier": "^8.
|
|
67
|
+
"eslint-config-prettier": "^8.9.0",
|
|
68
68
|
"eslint-plugin-no-unsanitized": "^4.0.2",
|
|
69
69
|
"jquery": "^3.7.0",
|
|
70
70
|
"less-loader": "^11.1.3",
|
|
@@ -75,13 +75,13 @@
|
|
|
75
75
|
"postcss-loader": "^7.3.3",
|
|
76
76
|
"prettier": "^3.0.0",
|
|
77
77
|
"rollup-plugin-postcss": "^4.0.2",
|
|
78
|
-
"stylelint": "^15.10.
|
|
79
|
-
"stylelint-config-recommended": "^
|
|
78
|
+
"stylelint": "^15.10.2",
|
|
79
|
+
"stylelint-config-recommended": "^13.0.0",
|
|
80
80
|
"stylelint-config-standard": "^34.0.0",
|
|
81
81
|
"terser-webpack-plugin": "^5.3.9",
|
|
82
|
-
"ts-loader": "^9.4.
|
|
82
|
+
"ts-loader": "^9.4.4",
|
|
83
83
|
"typescript": "^5.1.6",
|
|
84
|
-
"webpack": "^5.88.
|
|
84
|
+
"webpack": "^5.88.2",
|
|
85
85
|
"webpack-cli": "^5.1.4",
|
|
86
86
|
"webpack-merge": "^5.9.0"
|
|
87
87
|
},
|