Skip to content

Commit c0cf16b

Browse files
authored
Merge pull request #5075 from marcellamaki/descendants-by-default
Make 'updateDescendants' true by default
2 parents 76ae31b + 8311bde commit c0cf16b

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditBooleanMapModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
},
9696
data() {
9797
return {
98-
updateDescendants: false,
98+
updateDescendants: true,
9999
error: '',
100100
/**
101101
* selectedValues is an object with the following structure:

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditLanguageModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
return {
9393
selectedLanguage: '',
9494
searchQuery: '',
95-
updateDescendants: false,
95+
updateDescendants: true,
9696
isMultipleNodeLanguages: false,
9797
changed: false,
9898
};

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/__tests__/EditBooleanMapModal.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,11 @@ describe('EditBooleanMapModal', () => {
275275
expect(wrapper.find('[data-test="update-descendants-checkbox"]').exists()).toBeFalsy();
276276
});
277277

278-
test('should call updateContentNode on success submit if the user does not check the update descendants checkbox', async () => {
278+
test('should call updateContentNode on success submit if the user uncheck the update descendants checkbox', async () => {
279279
nodes['node1'].kind = ContentKindsNames.TOPIC;
280280

281281
const wrapper = makeWrapper({ nodeIds: ['node1'], isDescendantsUpdatable: true });
282+
wrapper.find('[data-test="update-descendants-checkbox"]').element.click();
282283
await wrapper.vm.handleSave();
283284

284285
expect(contentNodeActions.updateContentNode).toHaveBeenCalledWith(expect.anything(), {
@@ -287,11 +288,10 @@ describe('EditBooleanMapModal', () => {
287288
});
288289
});
289290

290-
test('should call updateContentNodeDescendants on success submit if the user checks the descendants checkbox', async () => {
291+
test('should call updateContentNodeDescendants on success submit if the user does not uncheck the update descendants checkbox', async () => {
291292
nodes['node1'].kind = ContentKindsNames.TOPIC;
292293

293294
const wrapper = makeWrapper({ nodeIds: ['node1'], isDescendantsUpdatable: true });
294-
wrapper.find('[data-test="update-descendants-checkbox"]').element.click();
295295
await wrapper.vm.handleSave();
296296

297297
expect(contentNodeActions.updateContentNodeDescendants).toHaveBeenCalledWith(

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/__tests__/EditLanguageModal.spec.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ describe('EditLanguageModal', () => {
220220
});
221221

222222
describe('topic nodes present', () => {
223-
it('should display the checkbox to apply change to descendants if a topic is present', () => {
224-
[wrapper] = makeWrapper(['test-en-topic', 'test-en-res']);
223+
test('should display a selected checkbox to apply change to descendants if a topic is present', () => {
224+
const [wrapper] = makeWrapper(['test-en-topic', 'test-en-res']);
225225

226226
expect(
227227
wrapper.findComponent('[data-test="update-descendants-checkbox"]').exists(),
@@ -236,30 +236,33 @@ describe('EditLanguageModal', () => {
236236
).toBeFalsy();
237237
});
238238

239-
it('should call updateContentNode with the right language on success submit if the user does not check the checkbox', async () => {
240-
[wrapper, mocks] = makeWrapper(['test-en-topic', 'test-en-res']);
239+
test('should call updateContentNodeDescendants with the right language on success submit by default', async () => {
240+
const [wrapper, mocks] = makeWrapper(['test-en-topic', 'test-en-res']);
241241

242242
await chooseLanguage(wrapper, 'es');
243243
await wrapper.vm.handleSave();
244-
await wrapper.vm.$nextTick();
245244

246-
expect(mocks.updateContentNode).toHaveBeenCalledWith({
245+
expect(mocks.updateContentNodeDescendants).toHaveBeenCalledWith({
247246
id: 'test-en-topic',
248247
language: 'es',
249248
});
250249
});
251250

252-
it('should call updateContentNodeDescendants with the right language on success submit if the user checks the checkbox', async () => {
253-
[wrapper, mocks] = makeWrapper(['test-en-topic', 'test-en-res']);
251+
test('should call updateContentNode with the right language on success submit if the user unchecks check the checkbox', async () => {
252+
const [wrapper, mocks] = makeWrapper(['test-en-topic', 'test-en-res']);
254253

255254
await chooseLanguage(wrapper, 'es');
256-
wrapper.findComponent('[data-test="update-descendants-checkbox"]').vm.$emit('change', true);
255+
256+
// Uncheck the descendants checkbox
257+
const descendantsCheckbox = wrapper.findComponent(
258+
'[data-test="update-descendants-checkbox"]',
259+
);
260+
descendantsCheckbox.vm.$emit('change', false);
257261
await wrapper.vm.$nextTick();
258-
expect(wrapper.vm.updateDescendants).toBe(true);
262+
259263
await wrapper.vm.handleSave();
260-
await wrapper.vm.$nextTick();
261264

262-
expect(mocks.updateContentNodeDescendants).toHaveBeenCalledWith({
265+
expect(mocks.updateContentNode).toHaveBeenCalledWith({
263266
id: 'test-en-topic',
264267
language: 'es',
265268
});

0 commit comments

Comments
 (0)