Skip to content

Commit af13f01

Browse files
committed
ignoring changes for nonsoure updated
1 parent 6725d38 commit af13f01

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

src/js/components/tasks/retrieveMetadata/changes.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ const ChangesForm = ({
155155
ignoredChanges,
156156
);
157157

158+
for (const groupName of Object.keys(metadatachanges)) {
159+
if (Object.keys(filteredmetadata).indexOf(groupName) === -1) {
160+
filteredmetadata[groupName] = [];
161+
}
162+
}
163+
158164
const { remaining: filteredchecked } = splitChangeset(
159165
filteredChanges,
160166
changesChecked,

test/js/components/tasks/retrieveMetadata/index.test.jsx

+32-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ const defaultChangeset = {
3434
const defaultComponents = {
3535
Alpha: ['Beta'],
3636
Gamma: ['Delta', 'Theta'],
37+
Zam: [],
3738
};
3839

3940
const defaultIgnored = {
4041
Bang: ['Bazinga'],
42+
Zam: ['Garnish'],
4143
};
4244

4345
const defaultDirs = { config: ['foo/bar'], pre: ['buz/baz'] };
@@ -291,6 +293,7 @@ describe('<RetrieveMetadataModal/>', () => {
291293
getByLabelText('Baz'),
292294
getByLabelText('Bing'),
293295
getByLabelText('Bazinga'),
296+
getByLabelText('Garnish'),
294297
getByLabelText('Beta'),
295298
];
296299
});
@@ -304,22 +307,25 @@ describe('<RetrieveMetadataModal/>', () => {
304307
expect(inputs[2].checked).toBe(true);
305308
expect(inputs[3].checked).toBe(false);
306309
expect(inputs[4].checked).toBe(false);
310+
expect(inputs[5].checked).toBe(false);
307311

308312
fireEvent.click(selectAllIgnored);
309313

310314
expect(inputs[0].checked).toBe(true);
311315
expect(inputs[1].checked).toBe(true);
312316
expect(inputs[2].checked).toBe(true);
313317
expect(inputs[3].checked).toBe(true);
314-
expect(inputs[4].checked).toBe(false);
318+
expect(inputs[4].checked).toBe(true);
319+
expect(inputs[5].checked).toBe(false);
315320

316321
fireEvent.click(selectAll);
317322

318323
expect(inputs[0].checked).toBe(false);
319324
expect(inputs[1].checked).toBe(false);
320325
expect(inputs[2].checked).toBe(false);
321326
expect(inputs[3].checked).toBe(true);
322-
expect(inputs[4].checked).toBe(false);
327+
expect(inputs[4].checked).toBe(true);
328+
expect(inputs[5].checked).toBe(false);
323329

324330
fireEvent.click(selectAllIgnored);
325331

@@ -328,6 +334,7 @@ describe('<RetrieveMetadataModal/>', () => {
328334
expect(inputs[2].checked).toBe(false);
329335
expect(inputs[3].checked).toBe(false);
330336
expect(inputs[4].checked).toBe(false);
337+
expect(inputs[5].checked).toBe(false);
331338
});
332339
});
333340

@@ -340,6 +347,7 @@ describe('<RetrieveMetadataModal/>', () => {
340347
expect(inputs[2].checked).toBe(true);
341348
expect(inputs[3].checked).toBe(false);
342349
expect(inputs[4].checked).toBe(false);
350+
expect(inputs[5].checked).toBe(false);
343351

344352
fireEvent.click(group2);
345353

@@ -348,6 +356,7 @@ describe('<RetrieveMetadataModal/>', () => {
348356
expect(inputs[2].checked).toBe(true);
349357
expect(inputs[3].checked).toBe(true);
350358
expect(inputs[4].checked).toBe(false);
359+
expect(inputs[5].checked).toBe(false);
351360

352361
fireEvent.click(group1);
353362

@@ -356,6 +365,7 @@ describe('<RetrieveMetadataModal/>', () => {
356365
expect(inputs[2].checked).toBe(false);
357366
expect(inputs[3].checked).toBe(true);
358367
expect(inputs[4].checked).toBe(false);
368+
expect(inputs[5].checked).toBe(false);
359369

360370
fireEvent.click(group2);
361371

@@ -364,13 +374,15 @@ describe('<RetrieveMetadataModal/>', () => {
364374
expect(inputs[2].checked).toBe(false);
365375
expect(inputs[3].checked).toBe(false);
366376
expect(inputs[4].checked).toBe(false);
377+
expect(inputs[5].checked).toBe(false);
367378

368379
fireEvent.click(group3);
369380
expect(inputs[0].checked).toBe(false);
370381
expect(inputs[1].checked).toBe(false);
371382
expect(inputs[2].checked).toBe(false);
372383
expect(inputs[3].checked).toBe(false);
373-
expect(inputs[4].checked).toBe(true);
384+
expect(inputs[4].checked).toBe(false);
385+
expect(inputs[5].checked).toBe(true);
374386
});
375387
});
376388

@@ -468,14 +480,16 @@ describe('<RetrieveMetadataModal/>', () => {
468480
expect(panels[1]).toHaveAttribute('aria-hidden', 'true');
469481
expect(panels[2]).toHaveAttribute('aria-hidden', 'false');
470482
expect(panels[3]).toHaveAttribute('aria-hidden', 'false');
471-
expect(panels[4]).toHaveAttribute('aria-hidden', 'false');
483+
expect(panels[4]).toHaveAttribute('aria-hidden', 'true');
484+
expect(panels[5]).toHaveAttribute('aria-hidden', 'false');
472485

473486
fireEvent.click(getByTitle('Alpha'));
474487
expect(panels[0]).toHaveAttribute('aria-hidden', 'false');
475488
expect(panels[1]).toHaveAttribute('aria-hidden', 'true');
476489
expect(panels[2]).toHaveAttribute('aria-hidden', 'false');
477490
expect(panels[3]).toHaveAttribute('aria-hidden', 'false');
478491
expect(panels[4]).toHaveAttribute('aria-hidden', 'true');
492+
expect(panels[5]).toHaveAttribute('aria-hidden', 'true');
479493
});
480494
});
481495
});
@@ -495,6 +509,20 @@ describe('<RetrieveMetadataModal/>', () => {
495509
expect(nonSourceTrackableElement).not.toBeNull();
496510
});
497511

512+
test('ignore changes for non-source-trackable', () => {
513+
const { getByText, rerender, store } = setup();
514+
fireEvent.click(getByText('Save & Next'));
515+
setup({
516+
org: {
517+
...defaultOrg,
518+
ignored_changes: { Alpha: ['Beta'] },
519+
non_source_changes: { Gamma: ['Delta'] },
520+
},
521+
store,
522+
rerender,
523+
});
524+
});
525+
498526
describe('commit message', () => {
499527
let getters;
500528

0 commit comments

Comments
 (0)