@truedat/dd 7.13.1 → 7.13.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "7.13.1",
3
+ "version": "7.13.3",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "module": "src/index.js",
@@ -48,7 +48,7 @@
48
48
  "@testing-library/jest-dom": "^6.6.3",
49
49
  "@testing-library/react": "^16.3.0",
50
50
  "@testing-library/user-event": "^14.6.1",
51
- "@truedat/test": "7.13.1",
51
+ "@truedat/test": "7.13.3",
52
52
  "identity-obj-proxy": "^3.0.0",
53
53
  "jest": "^29.7.0",
54
54
  "redux-saga-test-plan": "^4.0.6"
@@ -83,5 +83,5 @@
83
83
  "svg-pan-zoom": "^3.6.2",
84
84
  "swr": "^2.3.3"
85
85
  },
86
- "gitHead": "17c040e6539b00eab7870d0d82ac91910e85b7ac"
86
+ "gitHead": "cdfd5ec2e862523bc46b45f5174c724918889240"
87
87
  }
@@ -12,7 +12,7 @@ export const StructureNotesDownloadButton = ({ structureId }) => {
12
12
 
13
13
  const { trigger: triggerDownload, isMutating: isDownloading } =
14
14
  useDataStructureDownload();
15
-
15
+
16
16
  const handleDownload = () => {
17
17
  triggerDownload({
18
18
  data_structure_id: structureId,
@@ -31,8 +31,11 @@ export const StructureNotesDownloadButton = ({ structureId }) => {
31
31
  <Button
32
32
  icon="download"
33
33
  onClick={() => setOpen(true)}
34
- loading={isDownloading}
34
+ loading={isDownloading}
35
35
  className="basic structureButton profile"
36
+ data-tooltip={formatMessage({
37
+ id: "structure.actions.downloadNotes.tooltip",
38
+ })}
36
39
  />
37
40
  }
38
41
  open={open}
@@ -44,27 +47,22 @@ export const StructureNotesDownloadButton = ({ structureId }) => {
44
47
  {formatMessage({ id: "structure.actions.downloadNotes.modal.title" })}
45
48
  </Modal.Header>
46
49
  <Modal.Content>
47
- <Checkbox
48
- className="bgOrange"
49
- toggle
50
- label={formatMessage({
51
- id: "structure.actions.downloadNotes.includeChildren",
52
- })}
53
- onChange={() => setIncludeChildren(!includeChildren)}
54
- checked={includeChildren}
55
- style={{ top: "6px", marginRight: "7.5px" }}
56
- />
57
-
50
+ <Checkbox
51
+ className="bgOrange"
52
+ toggle
53
+ label={formatMessage({
54
+ id: "structure.actions.downloadNotes.includeChildren",
55
+ })}
56
+ onChange={() => setIncludeChildren(!includeChildren)}
57
+ checked={includeChildren}
58
+ style={{ top: "6px", marginRight: "7.5px" }}
59
+ />
58
60
  </Modal.Content>
59
61
  <Modal.Actions>
60
62
  <Button onClick={() => setOpen(false)}>
61
63
  {formatMessage({ id: "actions.cancel" })}
62
64
  </Button>
63
- <Button
64
- primary
65
- onClick={handleDownload}
66
- loading={isDownloading}
67
- >
65
+ <Button primary onClick={handleDownload} loading={isDownloading}>
68
66
  <Icon name="download" />
69
67
  {formatMessage({ id: "actions.download" })}
70
68
  </Button>
@@ -12,7 +12,9 @@ jest.mock("../../hooks/useStructures", () => ({
12
12
  const messages = {
13
13
  "structure.actions.downloadNotes": "Download notes",
14
14
  "structure.actions.downloadNotes.modal.title": "Download Structure Notes",
15
- "structure.actions.downloadNotes.includeChildren": "Include direct children notes",
15
+ "structure.actions.downloadNotes.tooltip": "Download structure notes",
16
+ "structure.actions.downloadNotes.includeChildren":
17
+ "Include direct children notes",
16
18
  "actions.cancel": "Cancel",
17
19
  "actions.download": "Download",
18
20
  };
@@ -40,9 +42,7 @@ describe("StructureNotesDownloadButton", () => {
40
42
 
41
43
  it("always renders download button", () => {
42
44
  renderWithIntl(
43
- <StructureNotesDownloadButton
44
- structureId={mockStructureId}
45
- />
45
+ <StructureNotesDownloadButton structureId={mockStructureId} />
46
46
  );
47
47
 
48
48
  const button = screen.getByRole("button");
@@ -50,50 +50,53 @@ describe("StructureNotesDownloadButton", () => {
50
50
  expect(button).toHaveAttribute("class", expect.stringContaining("basic"));
51
51
  });
52
52
 
53
+ it("renders button with tooltip", () => {
54
+ renderWithIntl(
55
+ <StructureNotesDownloadButton structureId={mockStructureId} />
56
+ );
57
+
58
+ const button = screen.getByRole("button");
59
+ expect(button).toHaveAttribute("data-tooltip", "Download structure notes");
60
+ });
61
+
53
62
  it("opens modal when button is clicked", () => {
54
63
  renderWithIntl(
55
- <StructureNotesDownloadButton
56
- structureId={mockStructureId}
57
- />
64
+ <StructureNotesDownloadButton structureId={mockStructureId} />
58
65
  );
59
66
 
60
67
  const button = screen.getByRole("button");
61
68
  fireEvent.click(button);
62
69
 
63
- expect(
64
- screen.getByText("Download Structure Notes")
65
- ).toBeInTheDocument();
70
+ expect(screen.getByText("Download Structure Notes")).toBeInTheDocument();
66
71
  });
67
72
 
68
73
  it("displays include children checkbox in modal", () => {
69
74
  renderWithIntl(
70
- <StructureNotesDownloadButton
71
- structureId={mockStructureId}
72
- />
75
+ <StructureNotesDownloadButton structureId={mockStructureId} />
73
76
  );
74
77
 
75
78
  const button = screen.getByRole("button");
76
79
  fireEvent.click(button);
77
80
 
78
- const includeChildrenLabel = screen.getByText("Include direct children notes");
81
+ const includeChildrenLabel = screen.getByText(
82
+ "Include direct children notes"
83
+ );
79
84
  expect(includeChildrenLabel).toBeInTheDocument();
80
-
85
+
81
86
  const checkbox = screen.getByRole("checkbox");
82
87
  expect(checkbox).toBeInTheDocument();
83
88
  });
84
89
 
85
90
  it("allows toggling include children checkbox", () => {
86
91
  renderWithIntl(
87
- <StructureNotesDownloadButton
88
- structureId={mockStructureId}
89
- />
92
+ <StructureNotesDownloadButton structureId={mockStructureId} />
90
93
  );
91
94
 
92
95
  const button = screen.getByRole("button");
93
96
  fireEvent.click(button);
94
97
 
95
98
  const checkbox = screen.getByRole("checkbox");
96
-
99
+
97
100
  expect(checkbox).not.toBeChecked();
98
101
 
99
102
  fireEvent.click(checkbox);
@@ -105,9 +108,7 @@ describe("StructureNotesDownloadButton", () => {
105
108
 
106
109
  it("calls trigger with correct parameters when download button is clicked", async () => {
107
110
  renderWithIntl(
108
- <StructureNotesDownloadButton
109
- structureId={mockStructureId}
110
- />
111
+ <StructureNotesDownloadButton structureId={mockStructureId} />
111
112
  );
112
113
 
113
114
  const openButton = screen.getByRole("button");
@@ -127,16 +128,14 @@ describe("StructureNotesDownloadButton", () => {
127
128
  lang: "en",
128
129
  structure_url_schema: expect.stringContaining("http"),
129
130
  download_type: "editable",
130
- note_type: "published"
131
+ note_type: "published",
131
132
  });
132
133
  });
133
134
  });
134
135
 
135
136
  it("calls trigger with include_children false when checkbox is not selected", async () => {
136
137
  renderWithIntl(
137
- <StructureNotesDownloadButton
138
- structureId={mockStructureId}
139
- />
138
+ <StructureNotesDownloadButton structureId={mockStructureId} />
140
139
  );
141
140
 
142
141
  const openButton = screen.getByRole("button");
@@ -155,16 +154,14 @@ describe("StructureNotesDownloadButton", () => {
155
154
  lang: "en",
156
155
  structure_url_schema: expect.stringContaining("http"),
157
156
  download_type: "editable",
158
- note_type: "published"
157
+ note_type: "published",
159
158
  });
160
159
  });
161
160
  });
162
161
 
163
162
  it("closes modal after download", async () => {
164
163
  renderWithIntl(
165
- <StructureNotesDownloadButton
166
- structureId={mockStructureId}
167
- />
164
+ <StructureNotesDownloadButton structureId={mockStructureId} />
168
165
  );
169
166
 
170
167
  const openButton = screen.getByRole("button");
@@ -190,9 +187,7 @@ describe("StructureNotesDownloadButton", () => {
190
187
  });
191
188
 
192
189
  renderWithIntl(
193
- <StructureNotesDownloadButton
194
- structureId={mockStructureId}
195
- />
190
+ <StructureNotesDownloadButton structureId={mockStructureId} />
196
191
  );
197
192
 
198
193
  const button = screen.getByRole("button");
@@ -201,9 +196,7 @@ describe("StructureNotesDownloadButton", () => {
201
196
 
202
197
  it("closes modal when cancel button is clicked", () => {
203
198
  renderWithIntl(
204
- <StructureNotesDownloadButton
205
- structureId={mockStructureId}
206
- />
199
+ <StructureNotesDownloadButton structureId={mockStructureId} />
207
200
  );
208
201
 
209
202
  const openButton = screen.getByRole("button");
@@ -223,15 +216,13 @@ describe("StructureNotesDownloadButton", () => {
223
216
  it("handles window location origin correctly", async () => {
224
217
  // Guardar y mockear window.location
225
218
  const originalLocation = window.location;
226
- Object.defineProperty(window, 'location', {
227
- value: { origin: 'http://localhost' },
228
- writable: true
219
+ Object.defineProperty(window, "location", {
220
+ value: { origin: "http://localhost" },
221
+ writable: true,
229
222
  });
230
223
 
231
224
  renderWithIntl(
232
- <StructureNotesDownloadButton
233
- structureId={mockStructureId}
234
- />
225
+ <StructureNotesDownloadButton structureId={mockStructureId} />
235
226
  );
236
227
 
237
228
  const openButton = screen.getByRole("button");
@@ -247,14 +238,14 @@ describe("StructureNotesDownloadButton", () => {
247
238
  lang: "en",
248
239
  structure_url_schema: "http://localhost/structures/:id",
249
240
  download_type: "editable",
250
- note_type: "published"
241
+ note_type: "published",
251
242
  });
252
243
  });
253
244
 
254
245
  // Restaurar window.location
255
- Object.defineProperty(window, 'location', {
246
+ Object.defineProperty(window, "location", {
256
247
  value: originalLocation,
257
- writable: true
248
+ writable: true,
258
249
  });
259
250
  });
260
- });
251
+ });
@@ -54,6 +54,7 @@ exports[`<StructureSummary /> matches the latest snapshot 1`] = `
54
54
  </button>
55
55
  <button
56
56
  class="ui icon button basic structureButton profile"
57
+ data-tooltip="structure.actions.downloadNotes.tooltip"
57
58
  >
58
59
  <i
59
60
  aria-hidden="true"
@@ -210,6 +211,7 @@ exports[`<StructureSummary /> matches the latest snapshot with alias 1`] = `
210
211
  </button>
211
212
  <button
212
213
  class="ui icon button basic structureButton profile"
214
+ data-tooltip="structure.actions.downloadNotes.tooltip"
213
215
  >
214
216
  <i
215
217
  aria-hidden="true"
@@ -43,12 +43,14 @@ export default {
43
43
  "filters.with_profiling.raw.true": "With profile",
44
44
  "grant.actions.markPendingRemoval.button": "Remove",
45
45
  "grant.actions.markPendingRemoval.confirmation.content":
46
- "Requesting this grant to be revoked. Are you sure?",
47
- "grant.actions.markPendingRemoval.confirmation.header": "Request grant removal",
46
+ "Requesting this grant to be revoked. Are you sure?",
47
+ "grant.actions.markPendingRemoval.confirmation.header":
48
+ "Request grant removal",
48
49
  "grant.actions.unmarkPendingRemoval.confirmation.content":
49
50
  "Cancelling grant removal. Are you sure?",
50
51
  "grant.actions.unmarkPendingRemoval.button": "Reactivate",
51
- "grant.actions.unmarkPendingRemoval.confirmation.header": "Cancel grant removal",
52
+ "grant.actions.unmarkPendingRemoval.confirmation.header":
53
+ "Cancel grant removal",
52
54
  "grant.actions.viewRequest.confirmation.header": "View detail",
53
55
  "grant.cell.direct_access": "Direct access",
54
56
  "grant.cell.end_date.null": "No expiration set",
@@ -290,6 +292,10 @@ export default {
290
292
  "structure.actions.delete.confirmation.content":
291
293
  "This structure and all its descendant structures will be deleted. Are you sure?",
292
294
  "structure.actions.delete.confirmation.header": "Delete Structure",
295
+ "structure.actions.downloadNotes.includeChildren":
296
+ "Include direct children notes",
297
+ "structure.actions.downloadNotes.modal.title": "Download Structure Notes",
298
+ "structure.actions.downloadNotes.tooltip": "Download structure notes",
293
299
  "structure.add.tag": "Add tag",
294
300
  "structure.classification.default": "unclassified",
295
301
  "structure.confidential": "Confidential",
@@ -300,6 +300,11 @@ export default {
300
300
  "structure.actions.delete.confirmation.content":
301
301
  "Se va a borrar esta estructura y todas las estructuras descendientes. ¿Está seguro?",
302
302
  "structure.actions.delete.confirmation.header": "Borrar Estructura",
303
+ "structure.actions.downloadNotes.includeChildren":
304
+ "Incluir notas de hijos directos",
305
+ "structure.actions.downloadNotes.modal.title":
306
+ "Descargar Notas de Estructura",
307
+ "structure.actions.downloadNotes.tooltip": "Descargar notas de estructura",
303
308
  "structure.add.tag": "Añadir etiqueta",
304
309
  "structure.classification.default": "sin clasificar",
305
310
  "structure.confidential": "Confidencial",