Skip to content

Commit

Permalink
Fix #25490 Unable to create, save, or edit advance templates in the T…
Browse files Browse the repository at this point in the history
…emplates portlet
  • Loading branch information
zJaaal committed Jul 18, 2023
1 parent ed0a202 commit a03909f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
[item]="vm.working"
(updateTemplate)="updateWorkingTemplate($event)"
(saveAndPublish)="saveAndPublishTemplate($event)"
(save)="saveTemplate($event)"
(cancel)="cancelTemplate()"
(custom)="onCustomEvent($event)"
></dot-template-builder>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,41 @@ describe('DotTemplateCreateEditComponent', () => {
});

describe('edit layout', () => {
it('should save', () => {
const builder = de.query(By.css('dot-template-builder'));
builder.triggerEventHandler('save', {
layout: {
title: '',
width: '',
footer: true,
header: false,
sidebar: {},
body: {
rows: []
}
},
themeId: '123'
});
expect(store.saveTemplate).toHaveBeenCalledWith({
type: 'design',
title: 'Some template',
layout: {
title: '',
width: '',
footer: true,
header: false,
sidebar: {},
body: {
rows: []
}
},
identifier: '123',
friendlyName: '',
theme: '123',
image: ''
});
});

it('should call updateWorkingTemplate from store when updateTemplate', () => {
const builder = de.query(By.css('dot-template-builder'));
builder.triggerEventHandler('updateTemplate', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,19 @@ export class DotTemplateCreateEditComponent implements OnInit, OnDestroy {
});
}

/**
* Save template to store
*
* @param DotTemplate template
* @memberof DotTemplateCreateEditComponent
*/
saveTemplate(template: DotTemplate): void {
this.store.saveTemplate({
...this.form.value,
...this.formatTemplateItem(template)
});
}

/**
* Handle cancel button from designer
*
Expand Down

0 comments on commit a03909f

Please sign in to comment.