Skip to content

Commit

Permalink
Merge pull request #10663 from qmonmert/fix/10660
Browse files Browse the repository at this point in the history
Fix: preset modules selected and deselected
  • Loading branch information
murdos authored Aug 24, 2024
2 parents 627b98a + c2e6ca6 commit b15920f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,12 @@ export default defineComponent({
return;
}

landscapeValue()
.selectedModules()
.forEach(module => {
landscape.value.loaded(landscapeValue().toggle(module));
});

preset.modules.forEach(module => {
landscape.value.loaded(landscapeValue().toggle(module));
});
Expand Down
8 changes: 8 additions & 0 deletions src/test/webapp/unit/module/domain/Modules.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ export const defaultPresets = (): Presets => ({
name: 'init-maven',
modules: [moduleSlug('init'), moduleSlug('maven')],
},
{
name: 'init-prettier',
modules: [moduleSlug('application-service-hexagonal-architecture-documentation'), moduleSlug('init'), moduleSlug('prettier')],
},
{
name: 'init-typescript',
modules: [moduleSlug('init'), moduleSlug('typescript'), moduleSlug('application-service-hexagonal-architecture-documentation')],
},
],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,22 @@ describe('Landscape', () => {
});
});

it('should select modules from selected preset when preset option is updated multiple times', async () => {
let { initModuleElement } = await setupAndSelectPreset('init-prettier');

let classes = initModuleElement.classes();
['-selected', '-compacted'].forEach(expectedClass => {
expect(classes).toContain(expectedClass);
});

({ initModuleElement } = await setupAndSelectPreset('init-typescript'));

classes = initModuleElement.classes();
['-selected', '-compacted'].forEach(expectedClass => {
expect(classes).toContain(expectedClass);
});
});

it('should retain module selection state when preset option is deselected', async () => {
const { presetComponent, initModuleElement } = await setupAndSelectPreset('init-maven');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@ const restPresets = (): Presets => ({
name: 'init-maven',
modules: [moduleSlug('init'), moduleSlug('maven')],
},
{
name: 'init-prettier',
modules: [moduleSlug('application-service-hexagonal-architecture-documentation'), moduleSlug('init'), moduleSlug('prettier')],
},
{
name: 'init-typescript',
modules: [moduleSlug('init'), moduleSlug('typescript'), moduleSlug('application-service-hexagonal-architecture-documentation')],
},
],
});

Expand Down

0 comments on commit b15920f

Please sign in to comment.