@stackoverflow/stacks 1.6.5 → 1.6.7

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.
@@ -19,6 +19,7 @@
19
19
  &&__deleted {
20
20
  --_uc-fc: var(--black-500);
21
21
  }
22
+
22
23
  &&__highlighted {
23
24
  --_uc-bg: var(--theme-secondary-050);
24
25
  --_uc-bar: var(--br-md);
@@ -34,12 +35,13 @@
34
35
  --_uc-p: 0;
35
36
  --_uc-info-ai: center;
36
37
  --_uc-info-fd: row;
37
-
38
38
  }
39
+
39
40
  &&__full {
40
41
  --_uc-ai: flex-start;
41
42
  --_uc-link-fs: var(--fs-body2);
42
43
  }
44
+
43
45
  &&__minimal {
44
46
  --_uc-link-ws: nowrap;
45
47
  --_uc-rep-fc: var(--black-600);
@@ -52,6 +54,7 @@
52
54
  font-size: var(--fs-caption);
53
55
  color: var(--black-500);
54
56
  }
57
+
55
58
  & &--awards {
56
59
  li {
57
60
  font-size: var(--fs-caption);
@@ -62,6 +65,7 @@
62
65
  display: flex;
63
66
  gap: var(--su6);
64
67
  }
68
+
65
69
  & &--info {
66
70
  align-items: var(--_uc-info-ai);
67
71
  flex-direction: var(--_uc-info-fd);
@@ -69,6 +73,7 @@
69
73
  display: flex;
70
74
  gap: var(--su4);
71
75
  }
76
+
72
77
  & &--link {
73
78
  font-size: var(--_uc-link-fs);
74
79
  white-space: var(--_uc-link-ws);
@@ -78,16 +83,19 @@
78
83
  min-width: 0; // Allow things to wrap
79
84
  overflow-wrap: break-word;
80
85
  }
86
+
81
87
  & &--rep {
82
88
  color: var(--_uc-rep-fc);
83
89
 
84
90
  font-weight: 700;
85
91
  }
92
+
86
93
  & &--tags {
87
94
  align-items: center;
88
95
  min-width: 0; // Allow things to wrap
89
96
  flex-wrap: wrap;
90
97
  }
98
+
91
99
  & &--time {
92
100
  color: var(--_uc-time-fc);
93
101
  white-space: var(--_uc-time-ws);
@@ -96,6 +104,7 @@
96
104
  grid-column: ~"1 / 3";
97
105
  grid-row: ~"1 / 2";
98
106
  }
107
+
99
108
  & &--type {
100
109
  a {
101
110
  color: inherit;
@@ -0,0 +1,62 @@
1
+ import { html, fixture, expect } from "@open-wc/testing";
2
+ import { screen, waitForElementToBeRemoved } from "@testing-library/dom";
3
+ import userEvent from "@testing-library/user-event";
4
+ import "../ts/index";
5
+
6
+ const user = userEvent.setup();
7
+
8
+ describe("s-tooltip", () => {
9
+ it("should make the tooltip element visible on hover (after a delay)", async () => {
10
+ const trigger = await fixture(html`
11
+ <button
12
+ class="s-btn s-btn__filled"
13
+ role="button"
14
+ data-controller="s-tooltip"
15
+ title="tooltip content"
16
+ data-s-tooltip-placement="bottom-start"
17
+ >
18
+ Hover tooltip popover
19
+ </button>
20
+ `);
21
+
22
+ expect(screen.queryByRole("tooltip")).to.be.null;
23
+
24
+ await user.hover(trigger);
25
+ const tooltip = await screen.findByRole("tooltip");
26
+ expect(tooltip).to.be.visible;
27
+
28
+ await user.unhover(trigger);
29
+ await waitForElementToBeRemoved(() => screen.queryByRole("tooltip"));
30
+ });
31
+
32
+ it("should not flicker when the host contains an SVG and the user hover on it", async () => {
33
+ await fixture(html`
34
+ <button
35
+ class="s-btn"
36
+ role="button"
37
+ title="tooltip content"
38
+ data-controller="s-tooltip"
39
+ data-s-tooltip-placement="bottom-start"
40
+ >
41
+ <svg
42
+ data-testid="svg"
43
+ aria-hidden="true"
44
+ class="bg-red-500"
45
+ width="18"
46
+ height="18"
47
+ viewBox="0 0 18 18"
48
+ ></svg>
49
+ 👈 Shouldn't flicker 🤷‍
50
+ </button>
51
+ `);
52
+ const button = screen.getByRole("button");
53
+ const svg = screen.getByTestId("svg");
54
+
55
+ await user.hover(button);
56
+ const tooltip = await screen.findByRole("tooltip");
57
+ expect(tooltip).to.be.visible;
58
+
59
+ await user.hover(svg);
60
+ expect(tooltip).to.be.visible;
61
+ });
62
+ });
@@ -0,0 +1,31 @@
1
+ import { html, fixture } from "@open-wc/testing";
2
+ import { screen } from "@testing-library/dom";
3
+ import userEvent from "@testing-library/user-event";
4
+ import { visualDiff } from "@web/test-runner-visual-regression";
5
+ import "../ts/index";
6
+
7
+ const user = userEvent.setup();
8
+
9
+ describe("s-tooltip", () => {
10
+ it("should not introduce visual regressions", async () => {
11
+ const wrapper = await fixture(html`
12
+ <div style="height: 100px; width: 160px; display: inline-block;">
13
+ <button
14
+ class="s-btn s-btn__filled"
15
+ role="button"
16
+ data-controller="s-tooltip"
17
+ title="tooltip content"
18
+ data-s-tooltip-placement="bottom-start"
19
+ >
20
+ Hover tooltip popover
21
+ </button>
22
+ </div>
23
+ `);
24
+
25
+ const trigger = screen.getByRole("button");
26
+ await user.hover(trigger);
27
+ await screen.findByRole("tooltip");
28
+
29
+ await visualDiff(wrapper, "s-tooltip");
30
+ });
31
+ });
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.6.5",
8
+ "version": "1.6.7",
9
9
  "files": [
10
10
  "dist",
11
11
  "lib"
@@ -22,8 +22,11 @@
22
22
  "build:docs": "webpack --mode=production --config ./docs/webpack.config.js && cd ./docs && eleventy",
23
23
  "start:webpack": "webpack --watch --config ./docs/webpack.config.js",
24
24
  "start:eleventy": "cd ./docs && eleventy --serve",
25
- "test": "backstop test",
26
- "approve": "backstop approve",
25
+ "test": "web-test-runner",
26
+ "test:unit": "web-test-runner --group=unit",
27
+ "test:unit:watch": "web-test-runner --group=unit --watch",
28
+ "test:visual": "web-test-runner --group=visual",
29
+ "test:visual:update": "web-test-runner --group=visual --update-visual-baseline",
27
30
  "prepublishOnly": "npm run build",
28
31
  "lint": "concurrently -n w: npm:lint:*",
29
32
  "lint:ts": "eslint ./lib/ts",
@@ -37,13 +40,22 @@
37
40
  },
38
41
  "devDependencies": {
39
42
  "@11ty/eleventy": "^1.0.2",
40
- "@highlightjs/cdn-assets": "^11.6.0",
41
- "@stackoverflow/stacks-editor": "^0.8.2",
42
- "@stackoverflow/stacks-icons": "^3.1.0",
43
- "@typescript-eslint/eslint-plugin": "^5.42.0",
44
- "@typescript-eslint/parser": "^5.44.0",
45
- "backstopjs": "^6.1.4",
46
- "concurrently": "^7.5.0",
43
+ "@highlightjs/cdn-assets": "^11.7.0",
44
+ "@open-wc/testing": "^3.1.7",
45
+ "@rollup/plugin-commonjs": "^24.0.0",
46
+ "@rollup/plugin-replace": "^5.0.1",
47
+ "@stackoverflow/stacks-editor": "^0.8.3",
48
+ "@stackoverflow/stacks-icons": "^4.0.0",
49
+ "@testing-library/dom": "^8.19.0",
50
+ "@testing-library/user-event": "^14.4.3",
51
+ "@typescript-eslint/eslint-plugin": "^5.47.1",
52
+ "@typescript-eslint/parser": "^5.46.0",
53
+ "@web/dev-server-esbuild": "^0.3.3",
54
+ "@web/dev-server-rollup": "https://github.com/giamir/web/raw/fix-dev-server-rollup/packages/dev-server-rollup/web-dev-server-rollup-0.3.19.tgz",
55
+ "@web/test-runner": "^0.15.0",
56
+ "@web/test-runner-playwright": "^0.9.0",
57
+ "@web/test-runner-visual-regression": "^0.7.0",
58
+ "concurrently": "^7.6.0",
47
59
  "css-loader": "^6.7.2",
48
60
  "cssnano": "^5.1.14",
49
61
  "docsearch.js": "^2.6.3",
@@ -51,7 +63,7 @@
51
63
  "eleventy-plugin-nesting-toc": "^1.3.0",
52
64
  "eslint": "^8.29.0",
53
65
  "eslint-config-prettier": "^8.5.0",
54
- "eslint-plugin-no-unsanitized": "^4.0.1",
66
+ "eslint-plugin-no-unsanitized": "^4.0.2",
55
67
  "jquery": "^3.6.1",
56
68
  "less-loader": "^11.1.0",
57
69
  "list.js": "^2.3.1",
@@ -60,12 +72,13 @@
60
72
  "postcss-less": "^6.0.0",
61
73
  "postcss-loader": "^7.0.1",
62
74
  "prettier": "^2.7.1",
75
+ "rollup-plugin-postcss": "^4.0.2",
63
76
  "stylelint": "^14.16.0",
64
77
  "stylelint-config-recommended": "^9.0.0",
65
78
  "stylelint-config-standard": "^29.0.0",
66
79
  "terser-webpack-plugin": "^5.3.6",
67
- "ts-loader": "^9.4.1",
68
- "typescript": "^4.9.3",
80
+ "ts-loader": "^9.4.2",
81
+ "typescript": "^4.9.4",
69
82
  "webpack": "^5.75.0",
70
83
  "webpack-cli": "^5.0.0",
71
84
  "webpack-merge": "^5.8.0"
@@ -84,5 +97,8 @@
84
97
  "not and_uc > 0",
85
98
  "not Samsung > 0",
86
99
  "not Android > 0"
87
- ]
100
+ ],
101
+ "overrides": {
102
+ "aria-query": "~5.0.0"
103
+ }
88
104
  }