Skip to content

Commit

Permalink
chore(edit-content): fix error #30215
Browse files Browse the repository at this point in the history
  • Loading branch information
nicobytes committed Nov 20, 2024
1 parent 0c74bb3 commit b0e7dc1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
3 changes: 1 addition & 2 deletions core-web/libs/edit-content/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ export default {
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment'
],
testEnvironment: '@happy-dom/jest-environment'
]
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<i [ngClass]="uiMessage.icon" data-testId="ui-message-icon" class="icon"></i>
</div>
<div class="text">
<span
<div
[innerHTML]="uiMessage.message | dm: uiMessage?.args"
data-testId="ui-message-span"></span>
data-testId="ui-message-span"> </div>
<ng-content></ng-content>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Spectator, byTestId, createComponentFactory } from '@ngneat/spectator/jest';

import { CommonModule } from '@angular/common';

import { DotMessageService } from '@dotcms/data-access';
import { DotMessagePipe } from '@dotcms/ui';
import { MockDotMessageService } from '@dotcms/utils-testing';
Expand All @@ -14,7 +16,7 @@ describe('DotFileFieldUiMessageComponent', () => {
const createComponent = createComponentFactory({
component: DotFileFieldUiMessageComponent,
detectChanges: false,
imports: [DotMessagePipe],
imports: [DotMessagePipe, CommonModule],
providers: [
{
provide: DotMessageService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { filter, map } from 'rxjs/operators';

import { DotAiService, DotMessageService } from '@dotcms/data-access';
import { DotCMSContentTypeField, DotGeneratedAIImage } from '@dotcms/dotcms-models';
import { INPUT_TYPES, UploadedFile } from '@dotcms/edit-content/models/dot-edit-content-file.model';
import { INPUT_TYPE, UploadedFile } from '@dotcms/edit-content/models/dot-edit-content-file.model';
import {
DotDropZoneComponent,
DotMessagePipe,
Expand Down Expand Up @@ -162,7 +162,7 @@ export class DotEditContentFileFieldComponent implements ControlValueAccessor, O

this.store.initLoad({
fieldVariable: field.variable,
inputType: field.fieldType as INPUT_TYPES
inputType: field.fieldType as INPUT_TYPE
});
}

Expand Down
10 changes: 10 additions & 0 deletions core-web/libs/edit-content/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
import 'jest-preset-angular/setup-jest';

// Workaround for the following issue:
// https://github.com/jsdom/jsdom/issues/2177#issuecomment-1724971596
const originalConsoleError = console.error;
const jsDomCssError = 'Error: Could not parse CSS stylesheet';
console.error = (...params) => {
if (!params.find((p) => p.toString().includes(jsDomCssError))) {
originalConsoleError(...params);
}
};

0 comments on commit b0e7dc1

Please sign in to comment.