Skip to content

Commit

Permalink
chore(dotcms-ui): Apply format #30249
Browse files Browse the repository at this point in the history
  • Loading branch information
nicobytes committed Oct 7, 2024
1 parent 32509a4 commit 3b4362f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
data-testId="autocomplete"
inputId="auto-complete-input"
appendTo="body"
dotSelectItem
/>
dotSelectItem />
@if (hasClasses) {
<ul data-testId="list">
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { DotMessagePipe, DotSelectItemDirective } from '@dotcms/ui';

import { JsonClassesService } from './services/json-classes.service';


@Component({
selector: 'dotcms-add-style-classes-dialog',
standalone: true,
Expand Down Expand Up @@ -46,7 +45,7 @@ export class AddStyleClassesDialogComponent implements OnInit {
* @memberof AddStyleClassesDialogComponent
*/
readonly #dialogRef = inject(DynamicDialogRef);
readonly #dynamicDialogConfig = inject(DynamicDialogConfig<{selectedClasses: string[]}>);
readonly #dynamicDialogConfig = inject(DynamicDialogConfig<{ selectedClasses: string[] }>);
/**
* Selected classes to be added
* @memberof AddStyleClassesDialogComponent
Expand Down Expand Up @@ -75,8 +74,6 @@ export class AddStyleClassesDialogComponent implements OnInit {

$hasClasses = computed(() => this.$classes().length > 0);



/**
* Set the selected classes
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ import { JsonClassesService, STYLE_CLASSES_FILE_URL } from './json-classes.servi
import { MOCK_STYLE_CLASSES_FILE } from '../../../utils/mocks';

describe('JsonClassesService', () => {
let spectator: SpectatorHttp<JsonClassesService>;
const createHttp = createHttpFactory(JsonClassesService);
let spectator: SpectatorHttp<JsonClassesService>;
const createHttp = createHttpFactory(JsonClassesService);

beforeEach(() => spectator = createHttp());
beforeEach(() => (spectator = createHttp()));

it('should be requested to the expected URL', () => {
spectator.service.getClasses().subscribe();
spectator.expectOne(STYLE_CLASSES_FILE_URL, HttpMethod.GET);
});
it('should be requested to the expected URL', () => {
spectator.service.getClasses().subscribe();
spectator.expectOne(STYLE_CLASSES_FILE_URL, HttpMethod.GET);
});

it('should return all classes', () => {
spectator.service.getClasses().subscribe();
it('should return all classes', () => {
spectator.service.getClasses().subscribe();

const req = spectator.expectOne(STYLE_CLASSES_FILE_URL, HttpMethod.GET);
expect(req.request.body).toEqual(MOCK_STYLE_CLASSES_FILE.classes);
const req = spectator.expectOne(STYLE_CLASSES_FILE_URL, HttpMethod.GET);
expect(req.request.body).toEqual(MOCK_STYLE_CLASSES_FILE.classes);

req.flush(MOCK_STYLE_CLASSES_FILE);
});
req.flush(MOCK_STYLE_CLASSES_FILE);
});

it('should return an empty array with a error', () => {
spectator.service.getClasses().subscribe();
it('should return an empty array with a error', () => {
spectator.service.getClasses().subscribe();

const req = spectator.expectOne(STYLE_CLASSES_FILE_URL, HttpMethod.GET);
expect(req.request.body).toEqual([]);
const req = spectator.expectOne(STYLE_CLASSES_FILE_URL, HttpMethod.GET);
expect(req.request.body).toEqual([]);

req.flush('', { status: 404 });
});
});
req.flush('', { status: 404 });
});
});

0 comments on commit 3b4362f

Please sign in to comment.