diff --git a/core-web/.husky/pre-commit b/core-web/.husky/pre-commit index b59bea585e3e..4a6fbda85c6c 100755 --- a/core-web/.husky/pre-commit +++ b/core-web/.husky/pre-commit @@ -12,9 +12,9 @@ perform_fixes() { local add_to_index=$2 # Should be 'true' or 'false' local file # Declare file variable for use in loop - if ! npx nx format:write; then - error_occurred=true - fi +# if ! npx nx format:write; then +# error_occurred=true +# fi if ! npx nx affected -t lint --exclude='tag:skip:lint' --fix=true; then error_occurred=true diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/components/dot-edit-content-category-field-sidebar/dot-edit-content-category-field-sidebar.component.scss b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/components/dot-edit-content-category-field-sidebar/dot-edit-content-category-field-sidebar.component.scss index 0c6023307745..d11c4756ddc2 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/components/dot-edit-content-category-field-sidebar/dot-edit-content-category-field-sidebar.component.scss +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/components/dot-edit-content-category-field-sidebar/dot-edit-content-category-field-sidebar.component.scss @@ -1,11 +1,10 @@ @use "variables" as *; .category-field__header { - height: 60px; align-items: center; flex-wrap: wrap; gap: $spacing-0; - padding: 0 $spacing-4; + padding: $spacing-2 $spacing-4; } .category-field__header-title { diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/dot-edit-content-category-field.component.spec.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/dot-edit-content-category-field.component.spec.ts index 62dcda1cebf0..718afe8267cd 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/dot-edit-content-category-field.component.spec.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/dot-edit-content-category-field.component.spec.ts @@ -1,11 +1,12 @@ -import { expect, it } from '@jest/globals'; -import { byTestId, createComponentFactory, Spectator } from '@ngneat/spectator'; -import { mockProvider } from '@ngneat/spectator/jest'; +import { byTestId, createComponentFactory, mockProvider, Spectator } from '@ngneat/spectator/jest'; + +import { fakeAsync } from '@angular/core/testing'; import { DotMessageService } from '@dotcms/data-access'; import { DotEditContentCategoryFieldSidebarComponent } from './components/dot-edit-content-category-field-sidebar/dot-edit-content-category-field-sidebar.component'; import { DotEditContentCategoryFieldComponent } from './dot-edit-content-category-field.component'; +import { CLOSE_SIDEBAR_CSS_DELAY_MS } from './dot-edit-content-category-field.const'; describe('DotEditContentCategoryFieldComponent', () => { let spectator: Spectator; @@ -71,7 +72,7 @@ describe('DotEditContentCategoryFieldComponent', () => { expect(spectator.query(DotEditContentCategoryFieldSidebarComponent)).not.toBeNull(); }); - it('should remove DotEditContentCategoryFieldSidebarComponent when `closedSidebar` emit', async () => { + it('should remove DotEditContentCategoryFieldSidebarComponent when `closedSidebar` emit', fakeAsync(() => { const selectBtn = spectator.query(byTestId('show-sidebar-btn')) as HTMLButtonElement; expect(selectBtn).not.toBeNull(); spectator.click(selectBtn); @@ -86,12 +87,11 @@ describe('DotEditContentCategoryFieldComponent', () => { spectator.detectComponentChanges(); // Due to a delay in the pipe of the subscription - await new Promise((resolve) => setTimeout(resolve, 400)); + spectator.tick(CLOSE_SIDEBAR_CSS_DELAY_MS + 100); expect(spectator.query(DotEditContentCategoryFieldSidebarComponent)).toBeNull(); - spectator.detectComponentChanges(); expect(selectBtn.disabled).toBe(false); - }); + })); }); }); diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/dot-edit-content-category-field.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/dot-edit-content-category-field.component.ts index a2ce3380e897..70ab22043ef7 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/dot-edit-content-category-field.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/dot-edit-content-category-field.component.ts @@ -23,8 +23,7 @@ import { DotCMSContentTypeField } from '@dotcms/dotcms-models'; import { DotDynamicDirective, DotMessagePipe } from '@dotcms/ui'; import { DotEditContentCategoryFieldSidebarComponent } from './components/dot-edit-content-category-field-sidebar/dot-edit-content-category-field-sidebar.component'; - -const CLOSE_SIDEBAR_CSS_DELAY_MS = 300; +import { CLOSE_SIDEBAR_CSS_DELAY_MS } from './dot-edit-content-category-field.const'; /** * Component for editing content category field.