Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

@if (showStyleEditorOption()) {
<p-button
(click)="selectContent.emit(context.contentlet)"
(click)="setSelectedContent()"
data-testId="palette-button"
styleClass="p-button-rounded p-button-raised"
icon="pi pi-palette" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ describe('DotUveContentletToolsComponent', () => {
spectator.click(paletteButton);

expect(hostComponent.onSelectContent).toHaveBeenCalledWith(
MOCK_CONTENTLET_AREA.payload.contentlet
MOCK_CONTENTLET_AREA.payload
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { TooltipModule } from 'primeng/tooltip';
import { DotMessageService } from '@dotcms/data-access';
import { DotMessagePipe } from '@dotcms/ui';

import { ActionPayload, ContentletPayload, VTLFile } from '../../../shared/models';
import { ActionPayload, VTLFile } from '../../../shared/models';
import { ContentletArea } from '../ema-page-dropzone/types';

/**
Expand Down Expand Up @@ -88,7 +88,7 @@ export class DotUveContentletToolsComponent {
/**
* Emitted when the contentlet is selected from the tools (for example, via a drag handle).
*/
readonly selectContent = output<ContentletPayload>();
readonly selectContent = output<ActionPayload>();
/**
* Opt-in flag indicating this drag source should use the custom drag image.
* Surfaced as `data-use-custom-drag-image` so the host editor can decide
Expand Down Expand Up @@ -238,4 +238,8 @@ export class DotUveContentletToolsComponent {
this.menu()?.hide();
this.menuVTL()?.hide();
}

setSelectedContent() {
this.selectContent.emit(this.contentletArea()?.payload);
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@testing-library/jest-dom';
import { SpectatorHost, createHostFactory } from '@ngneat/spectator';

import { Component } from '@angular/core';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,14 @@
font-size: $font-size-md;
}
}

// Form actions container
.form-actions {
display: flex;
justify-content: flex-end;
gap: $spacing-2;
padding: $spacing-3;
border-top: 1px solid $color-palette-gray-400;
margin-top: auto;
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { InferInputSignals } from '@ngneat/spectator';
import { createComponentFactory, Spectator } from '@ngneat/spectator/jest';
import { createComponentFactory, Spectator, mockProvider } from '@ngneat/spectator/jest';

import { HttpClient } from '@angular/common/http';
import { signal } from '@angular/core';
import { FormGroup } from '@angular/forms';

import { Accordion, AccordionModule } from 'primeng/accordion';
import { ButtonModule } from 'primeng/button';

import { DotWorkflowsActionsService } from '@dotcms/data-access';
import { StyleEditorFormSchema } from '@dotcms/uve';

import { DotUveStyleEditorFormComponent } from './dot-uve-style-editor-form.component';

import { DotPageApiService } from '../../../../../services/dot-page-api.service';
import { UVEStore } from '../../../../../store/dot-uve.store';

const createMockSchema = (): StyleEditorFormSchema => ({
contentType: 'test-content-type',
sections: [
Expand Down Expand Up @@ -79,7 +85,19 @@ describe('DotUveStyleEditorFormComponent', () => {

const createComponent = createComponentFactory({
component: DotUveStyleEditorFormComponent,
imports: [AccordionModule, ButtonModule]
imports: [AccordionModule, ButtonModule],
providers: [
// mockProvider(UVEStore),
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out code // mockProvider(UVEStore), should be removed. If the UVEStore mock provider is not needed, it should be deleted rather than left commented. Commented-out code reduces code clarity and maintainability.

Suggested change
// mockProvider(UVEStore),

Copilot uses AI. Check for mistakes.
mockProvider(DotWorkflowsActionsService),
mockProvider(DotPageApiService),
mockProvider(HttpClient),
{
provide: UVEStore,
useValue: {
currentIndex: signal(0)
}
}
]
});

beforeEach(() => {
Expand Down Expand Up @@ -210,7 +228,8 @@ describe('DotUveStyleEditorFormComponent', () => {
});
});

describe('schema changes', () => {
// TODO: Remove skip when we have the styleProperties in PageAPI response and remove the untracked in $reloadSchemaEffect.
xdescribe('schema changes', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment as a reminder

it('should rebuild form when schema changes', () => {
const initialForm = spectator.component.$form();

Expand Down
Loading
Loading