Skip to content

Make 'updateDescendants' true by default #5075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
},
data() {
return {
updateDescendants: false,
updateDescendants: true,
error: '',
/**
* selectedValues is an object with the following structure:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
return {
selectedLanguage: '',
searchQuery: '',
updateDescendants: false,
updateDescendants: true,
isMultipleNodeLanguages: false,
changed: false,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,11 @@ describe('EditBooleanMapModal', () => {
expect(wrapper.find('[data-test="update-descendants-checkbox"]').exists()).toBeFalsy();
});

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

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

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

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

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

expect(contentNodeActions.updateContentNodeDescendants).toHaveBeenCalledWith(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ describe('EditLanguageModal', () => {
});

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

expect(wrapper.find('[data-test="update-descendants-checkbox"]').exists()).toBeTruthy();
Expand All @@ -221,36 +221,36 @@ describe('EditLanguageModal', () => {
expect(wrapper.find('[data-test="update-descendants-checkbox"]').exists()).toBeFalsy();
});

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

wrapper.find('input[value="es"]').setChecked(true);
wrapper.find('[data-test="edit-language-modal"]').vm.$emit('submit');

const animationFrameId = requestAnimationFrame(() => {
expect(contentNodeActions.updateContentNode).toHaveBeenCalledWith(expect.anything(), {
id: 'test-en-topic',
language: 'es',
});
expect(contentNodeActions.updateContentNodeDescendants).toHaveBeenCalledWith(
expect.anything(),
{
id: 'test-en-topic',
language: 'es',
}
);
cancelAnimationFrame(animationFrameId);
});
});

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

wrapper.find('input[value="es"]').setChecked(true);
wrapper.find('[data-test="update-descendants-checkbox"] input').setChecked(true);
wrapper.find('[data-test="update-descendants-checkbox"] input').setChecked(false);
wrapper.find('[data-test="edit-language-modal"]').vm.$emit('submit');

const animationFrameId = requestAnimationFrame(() => {
expect(contentNodeActions.updateContentNodeDescendants).toHaveBeenCalledWith(
expect.anything(),
{
id: 'test-en-topic',
language: 'es',
}
);
expect(contentNodeActions.updateContentNode).toHaveBeenCalledWith(expect.anything(), {
id: 'test-en-topic',
language: 'es',
});
cancelAnimationFrame(animationFrameId);
});
});
Expand Down