@scm-manager/ui-components 4.0.0-REACT19-20250917-125211 → 4.0.0-REACT19-20250922-115826
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/package.json +13 -18
- package/src/Paginator.test.tsx +70 -104
- package/src/Tooltip.tsx +1 -1
- package/src/__snapshots__/storyshots.test.ts.snap +1 -1
- package/src/buttons/AddButton.tsx +1 -1
- package/src/buttons/CreateButton.tsx +1 -1
- package/src/buttons/DeleteButton.tsx +1 -1
- package/src/buttons/EditButton.tsx +1 -1
- package/src/buttons/LinkStyleButton.tsx +1 -1
- package/src/buttons/OpenInFullscreenButton.tsx +2 -3
- package/src/buttons/SubmitButton.tsx +1 -1
- package/src/comparators.test.ts +3 -3
- package/src/index.ts +1 -2
- package/src/languages.test.ts +0 -1
- package/src/layout/GroupEntries.tsx +1 -1
- package/src/layout/NamespaceEntries.tsx +2 -2
- package/src/markdown/MarkdownHeadingRenderer.test.ts +1 -10
- package/src/markdown/MarkdownImageRenderer.test.ts +4 -12
- package/src/markdown/MarkdownLinkRenderer.test.tsx +0 -9
- package/src/modals/useRegisterModal.test.tsx +17 -16
- package/src/navigation/SecondaryNavigation.tsx +2 -2
- package/src/popover/Popover.tsx +1 -1
- package/src/repos/DiffButton.tsx +1 -1
- package/src/repos/DiffExpander.test.ts +3 -3
- package/src/repos/JumpToFileButton.tsx +2 -2
- package/src/repos/RepositoryEntry.tsx +5 -8
- package/src/repos/RepositoryFlag.tsx +1 -3
- package/src/repos/changesets/ChangesetButtonGroup.test.tsx +25 -20
- package/src/repos/changesets/ChangesetDescription.tsx +2 -2
- package/src/repos/changesets/ChangesetDiff.test.ts +1 -9
- package/src/repos/changesets/ChangesetList.tsx +2 -2
- package/src/repos/changesets/ChangesetRow.tsx +1 -1
- package/src/repos/changesets/Changesets.stories.tsx +5 -18
- package/src/repos/diff/LazyDiffFile.tsx +12 -13
- package/src/repositories.test.ts +18 -18
- package/src/validation.test.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scm-manager/ui-components",
|
|
3
|
-
"version": "4.0.0-REACT19-
|
|
3
|
+
"version": "4.0.0-REACT19-20250922-115826",
|
|
4
4
|
"description": "UI Components for SCM-Manager and its plugins",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"author": "Sebastian Sdorra <sebastian.sdorra@cloudogu.com>",
|
|
12
12
|
"license": "AGPL-3.0-only",
|
|
13
13
|
"scripts": {
|
|
14
|
-
"test": "
|
|
14
|
+
"test": "vitest",
|
|
15
15
|
"typecheck": "tsc",
|
|
16
16
|
"storybook": "storybook dev -p 6006",
|
|
17
17
|
"build-storybook": "storybook build",
|
|
@@ -34,13 +34,10 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@scm-manager/babel-preset": "^2.13.1",
|
|
36
36
|
"@scm-manager/eslint-config": "^2.18.2",
|
|
37
|
-
"@scm-manager/jest-preset": "^2.15.0-alpha1",
|
|
38
37
|
"@scm-manager/prettier-config": "^2.12.0",
|
|
39
38
|
"@scm-manager/tsconfig": "^2.13.0",
|
|
40
|
-
"@scm-manager/ui-
|
|
41
|
-
"@scm-manager/ui-
|
|
42
|
-
"@scm-manager/ui-text": "4.0.0-REACT19-20250917-125211",
|
|
43
|
-
"@scm-manager/ui-types": "4.0.0-REACT19-20250917-125211",
|
|
39
|
+
"@scm-manager/ui-syntaxhighlighting": "4.0.0-REACT19-20250922-115826",
|
|
40
|
+
"@scm-manager/ui-types": "4.0.0-REACT19-20250922-115826",
|
|
44
41
|
"@storybook/addon-actions": "^9.0.8",
|
|
45
42
|
"@storybook/addon-docs": "^9.1.5",
|
|
46
43
|
"@storybook/addon-essentials": "^9.0.0-alpha.12",
|
|
@@ -56,23 +53,24 @@
|
|
|
56
53
|
"@types/react": "^19.1.1",
|
|
57
54
|
"@types/react-select": "^2.0.19",
|
|
58
55
|
"@types/unist": "^2.0.3",
|
|
56
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
57
|
+
"@vitest/web-worker": "^3.2.4",
|
|
58
|
+
"ci-info": "^4.3.1",
|
|
59
59
|
"decode-named-character-reference": "^1.0.1",
|
|
60
60
|
"fetch-mock": "^7.5.1",
|
|
61
61
|
"gitdiff-parser": "^0.2.2",
|
|
62
62
|
"minimatch": "^10.0.3",
|
|
63
|
-
"react-test-renderer": "^19.1.1",
|
|
64
63
|
"react-router-dom": "^7.9.1",
|
|
64
|
+
"react-test-renderer": "^19.1.1",
|
|
65
65
|
"sass-loader": "^12.3.0",
|
|
66
66
|
"storybook-addon-i18next": "^1.3.0",
|
|
67
|
-
"storybook-addon-themes": "^6.1.0"
|
|
67
|
+
"storybook-addon-themes": "^6.1.0",
|
|
68
|
+
"vitest": "^3.2.4"
|
|
68
69
|
},
|
|
69
70
|
"dependencies": {
|
|
70
|
-
"@scm-manager/ui-api": "4.0.0-REACT19-
|
|
71
|
-
"@scm-manager/ui-
|
|
72
|
-
"@scm-manager/ui-
|
|
73
|
-
"@scm-manager/ui-extensions": "4.0.0-REACT19-20250917-125211",
|
|
74
|
-
"@scm-manager/ui-layout": "4.0.0-REACT19-20250917-125211",
|
|
75
|
-
"@scm-manager/ui-overlays": "4.0.0-REACT19-20250917-125211",
|
|
71
|
+
"@scm-manager/ui-api": "4.0.0-REACT19-20250922-115826",
|
|
72
|
+
"@scm-manager/ui-core": "4.0.0-REACT19-20250922-115826",
|
|
73
|
+
"@scm-manager/ui-extensions": "4.0.0-REACT19-20250922-115826",
|
|
76
74
|
"deepmerge": "^4.2.2",
|
|
77
75
|
"hast-util-sanitize": "^3.0.2",
|
|
78
76
|
"react-diff-view": "2.6.0",
|
|
@@ -94,9 +92,6 @@
|
|
|
94
92
|
"@scm-manager/babel-preset"
|
|
95
93
|
]
|
|
96
94
|
},
|
|
97
|
-
"jest": {
|
|
98
|
-
"preset": "@scm-manager/jest-preset"
|
|
99
|
-
},
|
|
100
95
|
"prettier": "@scm-manager/prettier-config",
|
|
101
96
|
"eslintConfig": {
|
|
102
97
|
"extends": "@scm-manager/eslint-config"
|
package/src/Paginator.test.tsx
CHANGED
|
@@ -18,14 +18,6 @@ import React from "react";
|
|
|
18
18
|
import { render, screen } from "@testing-library/react";
|
|
19
19
|
import Paginator from "./Paginator";
|
|
20
20
|
|
|
21
|
-
describe("Temporary test to be removed", () => {
|
|
22
|
-
it("true", () => {
|
|
23
|
-
expect(true).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
//TODO Fix jest preset to include TextEncoder in its environment
|
|
28
|
-
/*
|
|
29
21
|
describe("paginator rendering tests", () => {
|
|
30
22
|
const dummyLink = {
|
|
31
23
|
href: "https://dummy",
|
|
@@ -41,12 +33,11 @@ describe("paginator rendering tests", () => {
|
|
|
41
33
|
|
|
42
34
|
render(<Paginator collection={collection} />);
|
|
43
35
|
|
|
44
|
-
const buttons = await screen.findAllByRole("button");
|
|
36
|
+
const buttons: HTMLButtonElement[] = await screen.findAllByRole("button");
|
|
45
37
|
|
|
46
|
-
|
|
38
|
+
assert.lengthOf(buttons, 7);
|
|
47
39
|
buttons.forEach((button) => {
|
|
48
|
-
|
|
49
|
-
expect(button).toBeDisabled();
|
|
40
|
+
assert.strictEqual(button.disabled, true, "all buttons should be disabled");
|
|
50
41
|
});
|
|
51
42
|
});
|
|
52
43
|
|
|
@@ -64,28 +55,24 @@ describe("paginator rendering tests", () => {
|
|
|
64
55
|
|
|
65
56
|
render(<Paginator collection={collection} />);
|
|
66
57
|
|
|
67
|
-
const buttons = await screen.findAllByRole("button");
|
|
58
|
+
const buttons: HTMLButtonElement[] = await screen.findAllByRole("button");
|
|
68
59
|
|
|
69
|
-
|
|
60
|
+
assert.lengthOf(buttons, 5);
|
|
61
|
+
|
|
62
|
+
assert.strictEqual(buttons[0].disabled, true, "previous button should be disabled");
|
|
63
|
+
assert.strictEqual(buttons[1].disabled, false, "next button should be enabled");
|
|
70
64
|
|
|
71
|
-
// previous button
|
|
72
|
-
expect(buttons[0]).toBeDisabled();
|
|
73
|
-
// last button
|
|
74
|
-
expect(buttons[1]).toBeEnabled();
|
|
75
|
-
// first button
|
|
76
65
|
const firstButton = buttons[2];
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
assert.strictEqual(firstButton.disabled, true, "first button should be disabled");
|
|
67
|
+
assert.strictEqual(firstButton.textContent?.trim(), "1", "first button be 1");
|
|
79
68
|
|
|
80
|
-
// next button
|
|
81
69
|
const nextButton = buttons[3];
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
assert.strictEqual(nextButton.disabled, false, "next button should be enabled");
|
|
71
|
+
assert.strictEqual(nextButton.textContent?.trim(), "2", "next button be 2");
|
|
84
72
|
|
|
85
|
-
// last button
|
|
86
73
|
const lastButton = buttons[4];
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
assert.strictEqual(lastButton.disabled, false, "last button should be enabled");
|
|
75
|
+
assert.strictEqual(lastButton.textContent?.trim(), "148", "last button be 148");
|
|
89
76
|
});
|
|
90
77
|
|
|
91
78
|
it("should render buttons for second page", async () => {
|
|
@@ -103,33 +90,28 @@ describe("paginator rendering tests", () => {
|
|
|
103
90
|
|
|
104
91
|
render(<Paginator collection={collection} />);
|
|
105
92
|
|
|
106
|
-
const buttons = await screen.findAllByRole("button");
|
|
93
|
+
const buttons: HTMLButtonElement[] = await screen.findAllByRole("button");
|
|
94
|
+
|
|
95
|
+
assert.lengthOf(buttons, 6);
|
|
107
96
|
|
|
108
|
-
|
|
97
|
+
assert.strictEqual(buttons[0].disabled, false, "previous button should be enabled");
|
|
98
|
+
assert.strictEqual(buttons[1].disabled, false, "next button should be enabled");
|
|
109
99
|
|
|
110
|
-
// previous button
|
|
111
|
-
expect(buttons[0]).toBeEnabled();
|
|
112
|
-
// last button
|
|
113
|
-
expect(buttons[1]).toBeEnabled();
|
|
114
|
-
// first button
|
|
115
100
|
const firstButton = buttons[2];
|
|
116
|
-
|
|
117
|
-
|
|
101
|
+
assert.strictEqual(firstButton.disabled, false, "first button should be enabled");
|
|
102
|
+
assert.strictEqual(firstButton.textContent?.trim(), "1", "first button be 1");
|
|
118
103
|
|
|
119
|
-
// current button
|
|
120
104
|
const currentButton = buttons[3];
|
|
121
|
-
|
|
122
|
-
|
|
105
|
+
assert.strictEqual(currentButton.disabled, true, "current button should be disabled");
|
|
106
|
+
assert.strictEqual(currentButton.textContent?.trim(), "2", "current button be 2");
|
|
123
107
|
|
|
124
|
-
// next button
|
|
125
108
|
const nextButton = buttons[4];
|
|
126
|
-
|
|
127
|
-
|
|
109
|
+
assert.strictEqual(nextButton.disabled, false, "next button should be enabled");
|
|
110
|
+
assert.strictEqual(nextButton.textContent?.trim(), "3", "next button be 3");
|
|
128
111
|
|
|
129
|
-
// last button
|
|
130
112
|
const lastButton = buttons[5];
|
|
131
|
-
|
|
132
|
-
|
|
113
|
+
assert.strictEqual(lastButton.disabled, false, "last button should be enabled");
|
|
114
|
+
assert.strictEqual(lastButton.textContent?.trim(), "148", "last button be 148");
|
|
133
115
|
});
|
|
134
116
|
|
|
135
117
|
it("should render buttons for last page", async () => {
|
|
@@ -145,28 +127,24 @@ describe("paginator rendering tests", () => {
|
|
|
145
127
|
|
|
146
128
|
render(<Paginator collection={collection} />);
|
|
147
129
|
|
|
148
|
-
const buttons = await screen.findAllByRole("button");
|
|
130
|
+
const buttons: HTMLButtonElement[] = await screen.findAllByRole("button");
|
|
131
|
+
|
|
132
|
+
assert.lengthOf(buttons, 5);
|
|
149
133
|
|
|
150
|
-
|
|
134
|
+
assert.strictEqual(buttons[0].disabled, false, "previous button should be enabled");
|
|
135
|
+
assert.strictEqual(buttons[1].disabled, true, "next button should be disabled");
|
|
151
136
|
|
|
152
|
-
// previous button
|
|
153
|
-
expect(buttons[0]).toBeEnabled();
|
|
154
|
-
// last button
|
|
155
|
-
expect(buttons[1]).toBeDisabled();
|
|
156
|
-
// first button
|
|
157
137
|
const firstButton = buttons[2];
|
|
158
|
-
|
|
159
|
-
|
|
138
|
+
assert.strictEqual(firstButton.disabled, false, "first button should be enabled");
|
|
139
|
+
assert.strictEqual(firstButton.textContent?.trim(), "1", "first button be 1");
|
|
160
140
|
|
|
161
|
-
// next button
|
|
162
141
|
const nextButton = buttons[3];
|
|
163
|
-
|
|
164
|
-
|
|
142
|
+
assert.strictEqual(nextButton.disabled, false, "next button should be enabled");
|
|
143
|
+
assert.strictEqual(nextButton.textContent?.trim(), "147", "next button be 147");
|
|
165
144
|
|
|
166
|
-
// last button
|
|
167
145
|
const lastButton = buttons[4];
|
|
168
|
-
|
|
169
|
-
|
|
146
|
+
assert.strictEqual(lastButton.disabled, true, "last button should be disabled");
|
|
147
|
+
assert.strictEqual(lastButton.textContent?.trim(), "148", "last button be 148");
|
|
170
148
|
});
|
|
171
149
|
|
|
172
150
|
it("should render buttons for penultimate page", async () => {
|
|
@@ -184,33 +162,28 @@ describe("paginator rendering tests", () => {
|
|
|
184
162
|
|
|
185
163
|
render(<Paginator collection={collection} />);
|
|
186
164
|
|
|
187
|
-
const buttons = await screen.findAllByRole("button");
|
|
165
|
+
const buttons: HTMLButtonElement[] = await screen.findAllByRole("button");
|
|
188
166
|
|
|
189
|
-
|
|
167
|
+
assert.lengthOf(buttons, 6);
|
|
190
168
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
// last button
|
|
194
|
-
expect(buttons[1]).toBeEnabled();
|
|
169
|
+
assert.strictEqual(buttons[0].disabled, false, "previous button should be enabled");
|
|
170
|
+
assert.strictEqual(buttons[1].disabled, false, "next button should be enabled");
|
|
195
171
|
|
|
196
|
-
// first button
|
|
197
172
|
const firstButton = buttons[2];
|
|
198
|
-
|
|
199
|
-
|
|
173
|
+
assert.strictEqual(firstButton.disabled, false, "first button should be enabled");
|
|
174
|
+
assert.strictEqual(firstButton.textContent?.trim(), "1", "first button be 1");
|
|
200
175
|
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
176
|
+
const previousButton = buttons[3];
|
|
177
|
+
assert.strictEqual(previousButton.disabled, false, "previous button should be enabled");
|
|
178
|
+
assert.strictEqual(previousButton.textContent?.trim(), "146", "previous button be 146");
|
|
204
179
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
expect(nextButton).toHaveTextContent("147");
|
|
180
|
+
const currentButton = buttons[4];
|
|
181
|
+
assert.strictEqual(currentButton.disabled, true, "current button should be disabled");
|
|
182
|
+
assert.strictEqual(currentButton.textContent?.trim(), "147", "current button be 147");
|
|
209
183
|
|
|
210
|
-
// last button
|
|
211
184
|
const lastButton = buttons[5];
|
|
212
|
-
|
|
213
|
-
|
|
185
|
+
assert.strictEqual(lastButton.disabled, false, "last button should be enabled");
|
|
186
|
+
assert.strictEqual(lastButton.textContent?.trim(), "148", "last button be 148");
|
|
214
187
|
});
|
|
215
188
|
|
|
216
189
|
it("should render buttons for a page in the middle", async () => {
|
|
@@ -228,39 +201,32 @@ describe("paginator rendering tests", () => {
|
|
|
228
201
|
|
|
229
202
|
render(<Paginator collection={collection} />);
|
|
230
203
|
|
|
231
|
-
const buttons = await screen.findAllByRole("button");
|
|
204
|
+
const buttons: HTMLButtonElement[] = await screen.findAllByRole("button");
|
|
232
205
|
|
|
233
|
-
|
|
206
|
+
assert.lengthOf(buttons, 7);
|
|
234
207
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
// next button
|
|
238
|
-
expect(buttons[1]).toBeEnabled();
|
|
208
|
+
assert.strictEqual(buttons[0].disabled, false, "previous button should be enabled");
|
|
209
|
+
assert.strictEqual(buttons[1].disabled, false, "next button should be enabled");
|
|
239
210
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
expect(firstButton).toHaveTextContent("1");
|
|
211
|
+
const firstButton = buttons[2] as HTMLButtonElement;
|
|
212
|
+
assert.strictEqual(firstButton.disabled, false, "first button should be enabled");
|
|
213
|
+
assert.strictEqual(firstButton.textContent?.trim(), "1", "first button be 1");
|
|
244
214
|
|
|
245
|
-
// previous Button
|
|
246
215
|
const previousButton = buttons[3];
|
|
247
|
-
|
|
248
|
-
|
|
216
|
+
assert.strictEqual(previousButton.disabled, false, "previous button should be enabled");
|
|
217
|
+
assert.strictEqual(previousButton.textContent?.trim(), "41", "previous button be 41");
|
|
249
218
|
|
|
250
|
-
// current button
|
|
251
219
|
const currentButton = buttons[4];
|
|
252
|
-
|
|
253
|
-
|
|
220
|
+
assert.strictEqual(currentButton.disabled, true, "current button should be disabled");
|
|
221
|
+
assert.strictEqual(currentButton.textContent?.trim(), "42", "current button be 42");
|
|
254
222
|
|
|
255
|
-
// next button
|
|
256
223
|
const nextButton = buttons[5];
|
|
257
|
-
|
|
258
|
-
|
|
224
|
+
assert.strictEqual(nextButton.disabled, false, "next button should be enabled");
|
|
225
|
+
assert.strictEqual(nextButton.textContent?.trim(), "43", "next button be 43");
|
|
259
226
|
|
|
260
|
-
// last button
|
|
261
227
|
const lastButton = buttons[6];
|
|
262
|
-
|
|
263
|
-
|
|
228
|
+
assert.strictEqual(lastButton.disabled, false, "last button should be enabled");
|
|
229
|
+
assert.strictEqual(lastButton.textContent?.trim(), "148", "last button be 148");
|
|
264
230
|
});
|
|
265
231
|
|
|
266
232
|
it("should call the function with the last previous url", async () => {
|
|
@@ -285,9 +251,9 @@ describe("paginator rendering tests", () => {
|
|
|
285
251
|
|
|
286
252
|
render(<Paginator collection={collection} onPageChange={callMe} />);
|
|
287
253
|
|
|
288
|
-
const previousButton =
|
|
254
|
+
const previousButton = screen.getByRole("button", { name: /paginator.previous/i });
|
|
289
255
|
previousButton.click();
|
|
290
256
|
|
|
291
|
-
|
|
257
|
+
assert.strictEqual(urlToOpen, "https://www.scm-manager.org", "the url passed to the function is not correct");
|
|
292
258
|
});
|
|
293
|
-
})
|
|
259
|
+
});
|
package/src/Tooltip.tsx
CHANGED
|
@@ -144,7 +144,7 @@ type Props = {
|
|
|
144
144
|
export type TooltipLocation = "bottom" | "right" | "top" | "left";
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
|
-
* @deprecated
|
|
147
|
+
* @deprecated Use Tooltip from ui-core instead
|
|
148
148
|
*/
|
|
149
149
|
const Tooltip: FC<Props> = ({ className, message, location = "right", multiline, children, id }) => {
|
|
150
150
|
const [open, setOpen] = useState(false);
|
|
@@ -18,7 +18,7 @@ import React from "react";
|
|
|
18
18
|
import Button, { ButtonProps } from "./Button";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* @deprecated Use
|
|
21
|
+
* @deprecated Use Button from ui-core instead
|
|
22
22
|
*/
|
|
23
23
|
class AddButton extends React.Component<ButtonProps> {
|
|
24
24
|
render() {
|
|
@@ -18,7 +18,7 @@ import React from "react";
|
|
|
18
18
|
import Button, { ButtonProps } from "./Button";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* @deprecated Use
|
|
21
|
+
* @deprecated Use Button from ui-core instead
|
|
22
22
|
*/
|
|
23
23
|
class DeleteButton extends React.Component<ButtonProps> {
|
|
24
24
|
render() {
|
|
@@ -18,7 +18,7 @@ import React from "react";
|
|
|
18
18
|
import Button, { ButtonProps } from "./Button";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* @deprecated Use
|
|
21
|
+
* @deprecated Use Button from ui-core instead
|
|
22
22
|
*/
|
|
23
23
|
class EditButton extends React.Component<ButtonProps> {
|
|
24
24
|
render() {
|
|
@@ -18,7 +18,7 @@ import styled from "styled-components";
|
|
|
18
18
|
import NoStyleButton from "./NoStyleButton";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* @deprecated Use
|
|
21
|
+
* @deprecated Use Button from ui-core instead
|
|
22
22
|
*/
|
|
23
23
|
const LinkStyleButton = styled(NoStyleButton)`
|
|
24
24
|
text-decoration: underline;
|
|
@@ -14,12 +14,11 @@
|
|
|
14
14
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import
|
|
18
|
-
import { FC, ReactNode, useState } from "react";
|
|
17
|
+
import React, { FC, ReactNode, useState } from "react";
|
|
19
18
|
import { useTranslation } from "react-i18next";
|
|
20
19
|
import styled from "styled-components";
|
|
20
|
+
import { Tooltip } from "@scm-manager/ui-core";
|
|
21
21
|
import FullscreenModal from "../modals/FullscreenModal";
|
|
22
|
-
import { Tooltip } from "@scm-manager/ui-overlays";
|
|
23
22
|
|
|
24
23
|
type Props = {
|
|
25
24
|
modalTitle: string;
|
|
@@ -23,7 +23,7 @@ type SubmitButtonProps = ButtonProps & {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* @deprecated Use
|
|
26
|
+
* @deprecated Use Button from ui-core instead
|
|
27
27
|
*/
|
|
28
28
|
class SubmitButton extends React.Component<SubmitButtonProps> {
|
|
29
29
|
static defaultProps = {
|
package/src/comparators.test.ts
CHANGED
|
@@ -48,7 +48,7 @@ describe("key comparator tests", () => {
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
it("should not fail if item is undefined", () => {
|
|
51
|
-
const array:
|
|
51
|
+
const array: Array<Record<string, unknown> | undefined> = createObjects("key", ["a"]);
|
|
52
52
|
array.push(undefined);
|
|
53
53
|
array.push(createObject("key", "z"));
|
|
54
54
|
array.sort(byKey("key"));
|
|
@@ -78,7 +78,7 @@ describe("length comparator tests", () => {
|
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
it("should not fail if item is undefined", () => {
|
|
81
|
-
const array:
|
|
81
|
+
const array: Array<Record<string, unknown> | undefined> = createObjects("key", ["."]);
|
|
82
82
|
array.push(undefined);
|
|
83
83
|
array.push(createObject("key", ".."));
|
|
84
84
|
array.sort(byValueLength("key"));
|
|
@@ -133,7 +133,7 @@ describe("nested key comparator tests", () => {
|
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
it("should not fail if item is undefined", () => {
|
|
136
|
-
const array:
|
|
136
|
+
const array: Array<Record<string, unknown> | undefined> = createObjects("key", "nested", ["a"]);
|
|
137
137
|
array.push(undefined);
|
|
138
138
|
array.push(createObject("key", "nested", "z"));
|
|
139
139
|
array.sort(byNestedKeys("key", "nested"));
|
package/src/index.ts
CHANGED
|
@@ -74,8 +74,7 @@ export { default as CardColumn } from "./CardColumn";
|
|
|
74
74
|
export { default as CardColumnSmall } from "./CardColumnSmall";
|
|
75
75
|
export { default as CommaSeparatedList } from "./CommaSeparatedList";
|
|
76
76
|
export { default as PreformattedCodeBlock } from "./PreformattedCodeBlock";
|
|
77
|
-
export { SplitAndReplace, type Replacement } from "@scm-manager/ui-
|
|
78
|
-
export { useShortcut } from "@scm-manager/ui-shortcuts";
|
|
77
|
+
export { SplitAndReplace, useShortcut, type Replacement } from "@scm-manager/ui-core";
|
|
79
78
|
export { regExpPattern as changesetShortLinkRegex } from "./markdown/remarkChangesetShortLinkParser";
|
|
80
79
|
export * from "./markdown/PluginApi";
|
|
81
80
|
export * from "./devices";
|
package/src/languages.test.ts
CHANGED
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
import React, { FC, ReactNode } from "react";
|
|
18
18
|
import { useTranslation } from "react-i18next";
|
|
19
|
+
import { Link } from "react-router-dom";
|
|
19
20
|
import { useLocalStorage } from "@scm-manager/ui-api";
|
|
20
|
-
import { CardList, Collapsible } from "@scm-manager/ui-
|
|
21
|
+
import { CardList, Collapsible } from "@scm-manager/ui-core";
|
|
21
22
|
import { RepositoryGroup } from "@scm-manager/ui-types";
|
|
22
|
-
import { Link } from "react-router-dom";
|
|
23
23
|
import { Icon } from "../index";
|
|
24
24
|
|
|
25
25
|
type Props = {
|
|
@@ -14,17 +14,8 @@
|
|
|
14
14
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import React from "react";
|
|
18
17
|
import { headingToAnchorId } from "./MarkdownHeadingRenderer";
|
|
19
18
|
|
|
20
|
-
describe("Temporary test to be removed", () => {
|
|
21
|
-
it("true", () => {
|
|
22
|
-
expect(true).toBe(true);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
//TODO Fix jest preset to include TextEncoder in its environment
|
|
27
|
-
/*
|
|
28
19
|
describe("headingToAnchorId tests", () => {
|
|
29
20
|
it("should lower case the text", () => {
|
|
30
21
|
expect(headingToAnchorId("Hello")).toBe("hello");
|
|
@@ -36,4 +27,4 @@ describe("headingToAnchorId tests", () => {
|
|
|
36
27
|
expect(headingToAnchorId("awesome stuff")).toBe("awesome-stuff");
|
|
37
28
|
expect(headingToAnchorId("a b c d e f")).toBe("a-b-c-d-e-f");
|
|
38
29
|
});
|
|
39
|
-
})
|
|
30
|
+
});
|
|
@@ -14,16 +14,8 @@
|
|
|
14
14
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import React from "react";
|
|
18
17
|
import { createLocalLink } from "./MarkdownImageRenderer";
|
|
19
18
|
|
|
20
|
-
describe("Temporary test to be removed", () => {
|
|
21
|
-
it("true", () => {
|
|
22
|
-
expect(true).toBe(true);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
/*
|
|
27
19
|
describe("createLocalLink tests", () => {
|
|
28
20
|
const revision = "revision";
|
|
29
21
|
const basePath = `/repo/namespace/name/code/sources/${revision}/`;
|
|
@@ -38,7 +30,7 @@ describe("createLocalLink tests", () => {
|
|
|
38
30
|
|
|
39
31
|
it("should return modified contentLink for absolute link", () => {
|
|
40
32
|
expect(createLocalLink(basePath, contentLink, revision, currentPath, "/path/anotherImg.jpg")).toBe(
|
|
41
|
-
"http://localhost:8081/scm/api/v2/repositories/namespace/name/content/revision/path/anotherImg.jpg"
|
|
33
|
+
"http://localhost:8081/scm/api/v2/repositories/namespace/name/content/revision/path/anotherImg.jpg",
|
|
42
34
|
);
|
|
43
35
|
});
|
|
44
36
|
|
|
@@ -49,8 +41,8 @@ describe("createLocalLink tests", () => {
|
|
|
49
41
|
contentLink,
|
|
50
42
|
"feature/awesome",
|
|
51
43
|
currentPath,
|
|
52
|
-
link
|
|
53
|
-
)
|
|
44
|
+
link,
|
|
45
|
+
),
|
|
54
46
|
).toContain("feature%2Fawesome");
|
|
55
47
|
});
|
|
56
|
-
})
|
|
48
|
+
});
|
|
@@ -17,14 +17,6 @@
|
|
|
17
17
|
import { isAnchorLink, isExternalLink, isLinkWithProtocol, isInternalScmRepoLink } from "./paths";
|
|
18
18
|
import { createLocalLink } from "./MarkdownLinkRenderer";
|
|
19
19
|
|
|
20
|
-
describe("Temporary test to be removed", () => {
|
|
21
|
-
it("true", () => {
|
|
22
|
-
expect(true).toBe(true);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
//TODO Fix jest preset to include TextEncoder in its environment
|
|
27
|
-
/*
|
|
28
20
|
describe("test isAnchorLink", () => {
|
|
29
21
|
it("should return true", () => {
|
|
30
22
|
expect(isAnchorLink("#some-thing")).toBe(true);
|
|
@@ -135,4 +127,3 @@ describe("test createLocalLink", () => {
|
|
|
135
127
|
expect(localLink).toBe(expected);
|
|
136
128
|
};
|
|
137
129
|
});
|
|
138
|
-
*/
|
|
@@ -19,16 +19,18 @@ import React, { FC, ReactNode } from "react";
|
|
|
19
19
|
import ActiveModalCountContext, { ModalStateContextType } from "./activeModalCountContext";
|
|
20
20
|
import useRegisterModal from "./useRegisterModal";
|
|
21
21
|
|
|
22
|
-
const createWrapper =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const createWrapper = (context: ModalStateContextType): FC<{ children: ReactNode }> => {
|
|
23
|
+
const Wrapper: FC<{ children: ReactNode }> = ({ children }) => (
|
|
24
|
+
<ActiveModalCountContext.Provider value={context}>{children}</ActiveModalCountContext.Provider>
|
|
25
|
+
);
|
|
26
|
+
Wrapper.displayName = "ActiveModalCountContextWrapper";
|
|
27
|
+
return Wrapper;
|
|
28
|
+
};
|
|
27
29
|
|
|
28
30
|
describe("useRegisterModal", () => {
|
|
29
31
|
it("should increment and not decrement on active registration", () => {
|
|
30
|
-
const increment =
|
|
31
|
-
const decrement =
|
|
32
|
+
const increment = vi.fn();
|
|
33
|
+
const decrement = vi.fn();
|
|
32
34
|
|
|
33
35
|
renderHook(() => useRegisterModal(true), {
|
|
34
36
|
wrapper: createWrapper({ value: 0, increment, decrement }),
|
|
@@ -39,8 +41,8 @@ describe("useRegisterModal", () => {
|
|
|
39
41
|
});
|
|
40
42
|
|
|
41
43
|
it("should not decrement on inactive registration", () => {
|
|
42
|
-
const increment =
|
|
43
|
-
const decrement =
|
|
44
|
+
const increment = vi.fn();
|
|
45
|
+
const decrement = vi.fn();
|
|
44
46
|
|
|
45
47
|
renderHook(() => useRegisterModal(false), {
|
|
46
48
|
wrapper: createWrapper({ value: 0, increment, decrement }),
|
|
@@ -51,8 +53,8 @@ describe("useRegisterModal", () => {
|
|
|
51
53
|
});
|
|
52
54
|
|
|
53
55
|
it("should not decrement on inactive de-registration", () => {
|
|
54
|
-
const increment =
|
|
55
|
-
const decrement =
|
|
56
|
+
const increment = vi.fn();
|
|
57
|
+
const decrement = vi.fn();
|
|
56
58
|
|
|
57
59
|
const result = renderHook(() => useRegisterModal(false), {
|
|
58
60
|
wrapper: createWrapper({ value: 0, increment, decrement }),
|
|
@@ -65,8 +67,8 @@ describe("useRegisterModal", () => {
|
|
|
65
67
|
});
|
|
66
68
|
|
|
67
69
|
it("should decrement once on active de-registration", () => {
|
|
68
|
-
const increment =
|
|
69
|
-
const decrement =
|
|
70
|
+
const increment = vi.fn();
|
|
71
|
+
const decrement = vi.fn();
|
|
70
72
|
|
|
71
73
|
const result = renderHook(() => useRegisterModal(false, true), {
|
|
72
74
|
wrapper: createWrapper({ value: 0, increment, decrement }),
|
|
@@ -79,11 +81,10 @@ describe("useRegisterModal", () => {
|
|
|
79
81
|
});
|
|
80
82
|
|
|
81
83
|
it("should decrement once when switching from active to inactive", () => {
|
|
82
|
-
const increment =
|
|
83
|
-
const decrement =
|
|
84
|
+
const increment = vi.fn();
|
|
85
|
+
const decrement = vi.fn();
|
|
84
86
|
|
|
85
87
|
const result = renderHook(({ active }: { active: boolean }) => useRegisterModal(active), {
|
|
86
|
-
// @ts-ignore
|
|
87
88
|
wrapper: createWrapper({ value: 0, increment, decrement }),
|
|
88
89
|
initialProps: { active: true },
|
|
89
90
|
});
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import React, { FC, ReactNode } from "react";
|
|
18
|
-
import styled from "styled-components";
|
|
19
18
|
import { useTranslation } from "react-i18next";
|
|
19
|
+
import styled from "styled-components";
|
|
20
|
+
import { Button } from "@scm-manager/ui-core";
|
|
20
21
|
import { useSecondaryNavigation } from "../useSecondaryNavigation";
|
|
21
|
-
import { Button } from "@scm-manager/ui-buttons";
|
|
22
22
|
|
|
23
23
|
type Props = {
|
|
24
24
|
label: string;
|
package/src/popover/Popover.tsx
CHANGED
package/src/repos/DiffButton.tsx
CHANGED
|
@@ -295,7 +295,7 @@ describe("with hunks the diff expander", () => {
|
|
|
295
295
|
const preceedingHunk = diffExpander.getHunk(0).hunk;
|
|
296
296
|
fetchMock.get(
|
|
297
297
|
"http://localhost:8081/scm/api/v2/content/abc/CommitMessage.js?start=8&end=13",
|
|
298
|
-
"new line 9\nnew line 10\nnew line 11\nnew line 12\nnew line 13"
|
|
298
|
+
"new line 9\nnew line 10\nnew line 11\nnew line 12\nnew line 13",
|
|
299
299
|
);
|
|
300
300
|
let newFile: FileDiff;
|
|
301
301
|
await diffExpander
|
|
@@ -324,7 +324,7 @@ describe("with hunks the diff expander", () => {
|
|
|
324
324
|
const oldHunkCount = diffExpander.hunkCount();
|
|
325
325
|
fetchMock.get(
|
|
326
326
|
"http://localhost:8081/scm/api/v2/content/abc/CommitMessage.js?start=40&end=50",
|
|
327
|
-
"new line 40\nnew line 41\nnew line 42"
|
|
327
|
+
"new line 40\nnew line 41\nnew line 42",
|
|
328
328
|
);
|
|
329
329
|
let newFile: FileDiff;
|
|
330
330
|
await diffExpander
|
|
@@ -337,7 +337,7 @@ describe("with hunks the diff expander", () => {
|
|
|
337
337
|
it("should set end to -1 if requested to expand to the end", async () => {
|
|
338
338
|
fetchMock.get(
|
|
339
339
|
"http://localhost:8081/scm/api/v2/content/abc/CommitMessage.js?start=40&end=-1",
|
|
340
|
-
"new line 40\nnew line 41\nnew line 42"
|
|
340
|
+
"new line 40\nnew line 41\nnew line 42",
|
|
341
341
|
);
|
|
342
342
|
let newFile: FileDiff;
|
|
343
343
|
await diffExpander
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import React, { FC } from "react";
|
|
18
|
-
import styled from "styled-components";
|
|
19
18
|
import { Link } from "react-router-dom";
|
|
20
|
-
import
|
|
19
|
+
import styled from "styled-components";
|
|
20
|
+
import { Tooltip } from "@scm-manager/ui-core";
|
|
21
21
|
import Icon from "../Icon";
|
|
22
22
|
|
|
23
23
|
const Button = styled(Link)`
|
|
@@ -15,18 +15,15 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import React, { FC } from "react";
|
|
18
|
+
import { useTranslation } from "react-i18next";
|
|
19
|
+
import { Link } from "react-router-dom";
|
|
20
|
+
import styled from "styled-components";
|
|
21
|
+
import { Card, Icon, Menu, useKeyboardIteratorTargetV2 } from "@scm-manager/ui-core";
|
|
22
|
+
import { ExtensionPoint, extensionPoints } from "@scm-manager/ui-extensions";
|
|
18
23
|
import { Repository } from "@scm-manager/ui-types";
|
|
19
24
|
import DateFromNow from "../DateFromNow";
|
|
20
25
|
import RepositoryAvatar from "./RepositoryAvatar";
|
|
21
|
-
import { ExtensionPoint, extensionPoints } from "@scm-manager/ui-extensions";
|
|
22
26
|
import RepositoryFlags from "./RepositoryFlags";
|
|
23
|
-
import styled from "styled-components";
|
|
24
|
-
import { useTranslation } from "react-i18next";
|
|
25
|
-
import { Card } from "@scm-manager/ui-layout";
|
|
26
|
-
import { Link } from "react-router-dom";
|
|
27
|
-
import { Menu } from "@scm-manager/ui-overlays";
|
|
28
|
-
import { Icon } from "@scm-manager/ui-buttons";
|
|
29
|
-
import { useKeyboardIteratorTargetV2 } from "@scm-manager/ui-core";
|
|
30
27
|
|
|
31
28
|
type DateProp = Date | string;
|
|
32
29
|
|
|
@@ -15,10 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import React, { FC, ReactNode } from "react";
|
|
18
|
+
import { Card, CardVariant, Tooltip } from "@scm-manager/ui-core";
|
|
18
19
|
import { Color, Size } from "../styleConstants";
|
|
19
|
-
import { Card } from "@scm-manager/ui-layout";
|
|
20
|
-
import { CardVariant } from "@scm-manager/ui-core";
|
|
21
|
-
import { Tooltip } from "@scm-manager/ui-overlays";
|
|
22
20
|
import { TooltipLocation } from "../Tooltip";
|
|
23
21
|
|
|
24
22
|
type Props = {
|
|
@@ -14,52 +14,57 @@
|
|
|
14
14
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import
|
|
17
|
+
import React from "react";
|
|
18
|
+
import { BrowserRouter } from "react-router-dom";
|
|
18
19
|
import { render } from "@testing-library/react";
|
|
19
20
|
import { Branch, Changeset, Repository } from "@scm-manager/ui-types";
|
|
21
|
+
import * as changesets from "./changesets";
|
|
20
22
|
import ChangesetButtonGroup from "./ChangesetButtonGroup";
|
|
21
|
-
import React from "react";
|
|
22
|
-
import { BrowserRouter } from "react-router-dom";
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
vi.mock("react-router", async (importOriginal) => {
|
|
25
|
+
const actual = await importOriginal();
|
|
26
|
+
return {
|
|
27
|
+
...(actual as Record<string, unknown>),
|
|
28
|
+
// Mock the 'Link' component to render an <a> tag directly, bypassing the broken router context (Fixes basename error)
|
|
29
|
+
Link: vi.fn(({ to, children, ...props }) => (
|
|
30
|
+
<a href={to} {...props}>
|
|
31
|
+
{children}
|
|
32
|
+
</a>
|
|
33
|
+
)),
|
|
34
|
+
};
|
|
29
35
|
});
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
const createChangesetLink = vi.spyOn(changesets, "createChangesetLink").mockReturnValue("/changeset");
|
|
38
|
+
const createChangesetLinkByBranch = vi.spyOn(changesets, "createChangesetLinkByBranch").mockReturnValue("/branch");
|
|
39
|
+
|
|
40
|
+
afterEach(() => {
|
|
41
|
+
vi.resetAllMocks();
|
|
35
42
|
});
|
|
36
43
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
test("shouldCallCreateChangesetLinkWithoutBranch", async () => {
|
|
44
|
+
describe("ChangesetButtonGroup", () => {
|
|
45
|
+
it("should call createChangesetLink without branch", () => {
|
|
40
46
|
const { repository, changeset } = createTestData();
|
|
41
47
|
render(
|
|
42
48
|
<BrowserRouter>
|
|
43
49
|
<ChangesetButtonGroup repository={repository} changeset={changeset}></ChangesetButtonGroup>
|
|
44
|
-
</BrowserRouter
|
|
50
|
+
</BrowserRouter>,
|
|
45
51
|
);
|
|
46
52
|
expect(createChangesetLink).toHaveBeenCalled();
|
|
47
53
|
expect(createChangesetLinkByBranch).toHaveBeenCalledTimes(0);
|
|
48
54
|
});
|
|
49
55
|
|
|
50
|
-
|
|
56
|
+
it("should call createChangesetLink by branch with branch", () => {
|
|
51
57
|
const { repository, changeset, branch } = createTestData();
|
|
52
58
|
render(
|
|
53
59
|
<BrowserRouter>
|
|
54
60
|
<ChangesetButtonGroup repository={repository} changeset={changeset} branch={branch}></ChangesetButtonGroup>
|
|
55
|
-
</BrowserRouter
|
|
61
|
+
</BrowserRouter>,
|
|
56
62
|
);
|
|
57
63
|
expect(createChangesetLinkByBranch).toHaveBeenCalled();
|
|
58
64
|
expect(createChangesetLink).toHaveBeenCalledTimes(0);
|
|
59
65
|
});
|
|
60
66
|
});
|
|
61
67
|
|
|
62
|
-
// TODO centralized test data
|
|
63
68
|
function createTestData() {
|
|
64
69
|
const repository: Repository = { _links: {}, name: "", namespace: "", type: "" };
|
|
65
70
|
const changeset: Changeset = {
|
|
@@ -73,4 +78,4 @@ function createTestData() {
|
|
|
73
78
|
};
|
|
74
79
|
const branch: Branch = { _links: {}, name: "", revision: "" };
|
|
75
80
|
return { repository, changeset, branch };
|
|
76
|
-
}
|
|
81
|
+
}
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import React, { FC } from "react";
|
|
18
|
-
import {
|
|
18
|
+
import { Replacement, SplitAndReplace } from "@scm-manager/ui-core";
|
|
19
19
|
import { extensionPoints, useBinder } from "@scm-manager/ui-extensions";
|
|
20
|
-
import {
|
|
20
|
+
import { Changeset } from "@scm-manager/ui-types";
|
|
21
21
|
|
|
22
22
|
type Props = {
|
|
23
23
|
changeset: Changeset;
|
|
@@ -16,14 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
import { createUrl, isDiffSupported } from "./ChangesetDiff";
|
|
18
18
|
|
|
19
|
-
describe("Temporary test to be removed", () => {
|
|
20
|
-
it("true", () => {
|
|
21
|
-
expect(true).toBe(true);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
//TODO Fix jest preset to include TextEncoder in its environment
|
|
26
|
-
/*
|
|
27
19
|
describe("isDiffSupported tests", () => {
|
|
28
20
|
it("should return true if diff link is defined", () => {
|
|
29
21
|
const supported = isDiffSupported({
|
|
@@ -105,4 +97,4 @@ describe("createUrl tests", () => {
|
|
|
105
97
|
}),
|
|
106
98
|
).toThrow();
|
|
107
99
|
});
|
|
108
|
-
})
|
|
100
|
+
});
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import ChangesetRow from "./ChangesetRow";
|
|
18
17
|
import React, { FC } from "react";
|
|
18
|
+
import { KeyboardIterator } from "@scm-manager/ui-core";
|
|
19
19
|
import { Branch, Changeset, File, Repository } from "@scm-manager/ui-types";
|
|
20
|
-
import
|
|
20
|
+
import ChangesetRow from "./ChangesetRow";
|
|
21
21
|
|
|
22
22
|
type Props = {
|
|
23
23
|
repository: Repository;
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
import React, { FC } from "react";
|
|
18
18
|
import classNames from "classnames";
|
|
19
19
|
import styled from "styled-components";
|
|
20
|
+
import { useKeyboardIteratorTarget } from "@scm-manager/ui-core";
|
|
20
21
|
import { ExtensionPoint, extensionPoints } from "@scm-manager/ui-extensions";
|
|
21
22
|
import { Branch, Changeset, File, Repository } from "@scm-manager/ui-types";
|
|
22
23
|
import ChangesetButtonGroup from "./ChangesetButtonGroup";
|
|
23
24
|
import SingleChangeset from "./SingleChangeset";
|
|
24
|
-
import { useKeyboardIteratorTarget } from "@scm-manager/ui-shortcuts";
|
|
25
25
|
|
|
26
26
|
type Props = {
|
|
27
27
|
repository: Repository;
|
|
@@ -26,9 +26,8 @@
|
|
|
26
26
|
// import hitchhiker from "../../__resources__/hitchhiker.png";
|
|
27
27
|
// import { Person } from "../../avatar/Avatar";
|
|
28
28
|
// import { Changeset } from "@scm-manager/ui-types";
|
|
29
|
-
// import { Replacement } from "@scm-manager/ui-
|
|
29
|
+
// import { Replacement, ShortcutDocsContextProvider } from "@scm-manager/ui-core";
|
|
30
30
|
// import ChangesetList from "./ChangesetList";
|
|
31
|
-
// import { ShortcutDocsContextProvider } from "@scm-manager/ui-shortcuts";
|
|
32
31
|
//
|
|
33
32
|
// const Wrapper = styled.div`
|
|
34
33
|
// margin: 25rem 4rem;
|
|
@@ -289,23 +288,19 @@
|
|
|
289
288
|
// ));
|
|
290
289
|
|
|
291
290
|
import React from "react";
|
|
291
|
+
import { MemoryRouter } from "react-router-dom";
|
|
292
292
|
import styled from "styled-components";
|
|
293
293
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
294
|
+
import { Replacement, ShortcutDocsContextProvider } from "@scm-manager/ui-core";
|
|
294
295
|
import { Binder, BinderContext } from "@scm-manager/ui-extensions";
|
|
295
|
-
import { ShortcutDocsContextProvider } from "@scm-manager/ui-shortcuts";
|
|
296
296
|
import { Changeset } from "@scm-manager/ui-types";
|
|
297
|
-
import { Replacement } from "@scm-manager/ui-text";
|
|
298
|
-
|
|
299
|
-
import ChangesetRow from "./ChangesetRow";
|
|
300
|
-
import ChangesetList from "./ChangesetList";
|
|
301
297
|
import repository from "../../__resources__/repository";
|
|
302
298
|
import { five, four, one, three, two } from "../../__resources__/changesets";
|
|
303
299
|
// @ts-ignore
|
|
304
300
|
import hitchhiker from "../../__resources__/hitchhiker.png";
|
|
305
301
|
import { Person } from "../../avatar/Avatar";
|
|
306
|
-
import
|
|
307
|
-
|
|
308
|
-
// --- Helfer-Funktionen und Mock-Daten (aus der Original-Story übernommen) ---
|
|
302
|
+
import ChangesetRow from "./ChangesetRow";
|
|
303
|
+
import ChangesetList from "./ChangesetList";
|
|
309
304
|
|
|
310
305
|
const Wrapper = styled.div`
|
|
311
306
|
margin: 2rem 4rem;
|
|
@@ -340,8 +335,6 @@ function copy<T>(input: T): T {
|
|
|
340
335
|
return JSON.parse(JSON.stringify(input));
|
|
341
336
|
}
|
|
342
337
|
|
|
343
|
-
// --- Storybook Metadaten ---
|
|
344
|
-
|
|
345
338
|
const meta: Meta<typeof ChangesetRow> = {
|
|
346
339
|
title: "Repositories/Changesets",
|
|
347
340
|
component: ChangesetRow,
|
|
@@ -354,11 +347,8 @@ const meta: Meta<typeof ChangesetRow> = {
|
|
|
354
347
|
|
|
355
348
|
export default meta;
|
|
356
349
|
|
|
357
|
-
// --- Story-Definitionen ---
|
|
358
|
-
|
|
359
350
|
type Story = StoryObj<typeof meta>;
|
|
360
351
|
|
|
361
|
-
// Einfache Stories mit `args`
|
|
362
352
|
export const Default: Story = {
|
|
363
353
|
args: { repository, changeset: three },
|
|
364
354
|
};
|
|
@@ -375,7 +365,6 @@ export const WithMultipleCoAuthors: Story = {
|
|
|
375
365
|
args: { repository, changeset: four },
|
|
376
366
|
};
|
|
377
367
|
|
|
378
|
-
// Komplexe Stories mit `render`
|
|
379
368
|
export const WithAvatar: Story = {
|
|
380
369
|
render: () => withAvatarFactory(() => hitchhiker, three),
|
|
381
370
|
};
|
|
@@ -402,7 +391,6 @@ export const Replacements: Story = {
|
|
|
402
391
|
},
|
|
403
392
|
};
|
|
404
393
|
|
|
405
|
-
// Stories für Signaturen
|
|
406
394
|
export const WithUnknownSignature: Story = {
|
|
407
395
|
render: () => {
|
|
408
396
|
const changeset = copy(three);
|
|
@@ -469,7 +457,6 @@ export const WithMultipleSignaturesValid: Story = {
|
|
|
469
457
|
},
|
|
470
458
|
};
|
|
471
459
|
|
|
472
|
-
// Story für die ChangesetList
|
|
473
460
|
export const ListWithNavigation: Story = {
|
|
474
461
|
name: "List With Navigation",
|
|
475
462
|
render: () => (
|
|
@@ -17,25 +17,24 @@
|
|
|
17
17
|
import React, { FC, useCallback, useEffect, useMemo, useState } from "react";
|
|
18
18
|
import { useTranslation } from "react-i18next";
|
|
19
19
|
import classNames from "classnames";
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
20
|
+
import styled from "styled-components";
|
|
21
|
+
import { useContentType } from "@scm-manager/ui-api";
|
|
22
|
+
import { ErrorNotification, Icon } from "@scm-manager/ui-core";
|
|
22
23
|
import { Hunk as HunkType, Link } from "@scm-manager/ui-types";
|
|
23
|
-
import
|
|
24
|
-
import DiffButton from "../DiffButton";
|
|
25
|
-
import { MenuContext } from "../../navigation/MenuContext";
|
|
24
|
+
import { ButtonGroup } from "../../buttons";
|
|
26
25
|
import OpenInFullscreenButton from "../../buttons/OpenInFullscreenButton";
|
|
27
|
-
import DiffExpander from "../DiffExpander";
|
|
28
26
|
import { Modal } from "../../modals";
|
|
29
|
-
import {
|
|
30
|
-
import
|
|
31
|
-
import
|
|
27
|
+
import { MenuContext } from "../../navigation";
|
|
28
|
+
import DiffButton from "../DiffButton";
|
|
29
|
+
import BinaryDiffFileContent, { canDisplayBinaryFile } from "./BinaryDiffFileContent";
|
|
30
|
+
import DiffExpander from "../DiffExpander";
|
|
31
|
+
import TokenizedDiffView from "../TokenizedDiffView";
|
|
32
32
|
import ChangeTag from "./ChangeTag";
|
|
33
|
-
import { getAnchorId, hasContent as determineHasContent, hoverFileTitle } from "./helpers";
|
|
34
33
|
import DiffFileHunk from "./DiffFileHunk";
|
|
34
|
+
import FileTitle from "./FileTitle";
|
|
35
|
+
import { getAnchorId, hasContent as determineHasContent, hoverFileTitle } from "./helpers";
|
|
36
|
+
import { DiffFilePanel, FullWidthTitleHeader, MarginlessModalContent, PanelHeading } from "./styledElements";
|
|
35
37
|
import { DiffFileProps } from "./types";
|
|
36
|
-
import { useContentType } from "@scm-manager/ui-api";
|
|
37
|
-
import BinaryDiffFileContent, { canDisplayBinaryFile } from "./BinaryDiffFileContent";
|
|
38
|
-
import styled from "styled-components";
|
|
39
38
|
|
|
40
39
|
type Props = DiffFileProps;
|
|
41
40
|
|
package/src/repositories.test.ts
CHANGED
|
@@ -27,10 +27,10 @@ describe("getProtocolLinkByType tests", () => {
|
|
|
27
27
|
protocol: [
|
|
28
28
|
{
|
|
29
29
|
name: "http",
|
|
30
|
-
href: "http://scm.scm-manager.org/repo/scm/core"
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
}
|
|
30
|
+
href: "http://scm.scm-manager.org/repo/scm/core",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const link = getProtocolLinkByType(repository, "http");
|
|
@@ -46,14 +46,14 @@ describe("getProtocolLinkByType tests", () => {
|
|
|
46
46
|
protocol: [
|
|
47
47
|
{
|
|
48
48
|
name: "http",
|
|
49
|
-
href: "http://scm.scm-manager.org/repo/scm/core"
|
|
49
|
+
href: "http://scm.scm-manager.org/repo/scm/core",
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
name: "ssh",
|
|
53
|
-
href: "git@scm.scm-manager.org:scm/core"
|
|
54
|
-
}
|
|
55
|
-
]
|
|
56
|
-
}
|
|
53
|
+
href: "git@scm.scm-manager.org:scm/core",
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
const link = getProtocolLinkByType(repository, "http");
|
|
@@ -68,9 +68,9 @@ describe("getProtocolLinkByType tests", () => {
|
|
|
68
68
|
_links: {
|
|
69
69
|
protocol: {
|
|
70
70
|
name: "http",
|
|
71
|
-
href: "http://scm.scm-manager.org/repo/scm/core"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
71
|
+
href: "http://scm.scm-manager.org/repo/scm/core",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
const link = getProtocolLinkByType(repository, "http");
|
|
@@ -86,14 +86,14 @@ describe("getProtocolLinkByType tests", () => {
|
|
|
86
86
|
protocol: [
|
|
87
87
|
{
|
|
88
88
|
name: "http",
|
|
89
|
-
href: "http://scm.scm-manager.org/repo/scm/core"
|
|
89
|
+
href: "http://scm.scm-manager.org/repo/scm/core",
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
name: "ssh",
|
|
93
|
-
href: "git@scm.scm-manager.org:scm/core"
|
|
94
|
-
}
|
|
95
|
-
]
|
|
96
|
-
}
|
|
93
|
+
href: "git@scm.scm-manager.org:scm/core",
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
const link = getProtocolLinkByType(repository, "awesome");
|
|
@@ -105,7 +105,7 @@ describe("getProtocolLinkByType tests", () => {
|
|
|
105
105
|
namespace: "scm",
|
|
106
106
|
name: "core",
|
|
107
107
|
type: "git",
|
|
108
|
-
_links: {}
|
|
108
|
+
_links: {},
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
const link = getProtocolLinkByType(repository, "http");
|
package/src/validation.test.ts
CHANGED
|
@@ -88,7 +88,7 @@ describe("test mail validation", () => {
|
|
|
88
88
|
"s.sdorra @ostfalia.de",
|
|
89
89
|
"s.sdorra@[ostfalia.de",
|
|
90
90
|
"abc.example.com",
|
|
91
|
-
"a@b@c@example.com"
|
|
91
|
+
"a@b@c@example.com",
|
|
92
92
|
];
|
|
93
93
|
for (const mail of invalid) {
|
|
94
94
|
it(`should return false for '${mail}'`, () => {
|
|
@@ -113,7 +113,7 @@ describe("test mail validation", () => {
|
|
|
113
113
|
"example@s.example",
|
|
114
114
|
"user.name+tag+sorting@example.com",
|
|
115
115
|
"name/surname@example.com",
|
|
116
|
-
"user%example.com@example.org"
|
|
116
|
+
"user%example.com@example.org",
|
|
117
117
|
];
|
|
118
118
|
for (const mail of valid) {
|
|
119
119
|
it(`should return true for '${mail}'`, () => {
|