Skip to content

Commit

Permalink
feat(edit-content) change from dialog to sidebar #28764
Browse files Browse the repository at this point in the history
  • Loading branch information
oidacra committed Jun 26, 2024
1 parent 3b89971 commit 880abe7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@use "variables" as *;

.category-field__header {
height: 60px;
align-items: center;
flex-wrap: wrap;
gap: $spacing-0;
padding: $spacing-1 $spacing-4;
padding: 0 $spacing-4;
}

.category-field__header-title {
Expand Down Expand Up @@ -33,6 +34,7 @@
border: $field-border-size solid $color-palette-gray-400;
border-radius: $border-radius-md;
background-color: $white;

padding: $spacing-3;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { byTestId, createComponentFactory, mockProvider, Spectator } from '@ngneat/spectator/jest';

import { fakeAsync } from '@angular/core/testing';
import { expect, it } from '@jest/globals';
import { byTestId, createComponentFactory, Spectator } from '@ngneat/spectator';
import { mockProvider } from '@ngneat/spectator/jest';

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<DotEditContentCategoryFieldComponent>;
Expand Down Expand Up @@ -72,7 +71,7 @@ describe('DotEditContentCategoryFieldComponent', () => {
expect(spectator.query(DotEditContentCategoryFieldSidebarComponent)).not.toBeNull();
});

it('should remove DotEditContentCategoryFieldSidebarComponent when `closedSidebar` emit', fakeAsync(() => {
it('should remove DotEditContentCategoryFieldSidebarComponent when `closedSidebar` emit', async () => {
const selectBtn = spectator.query(byTestId('show-sidebar-btn')) as HTMLButtonElement;
expect(selectBtn).not.toBeNull();
spectator.click(selectBtn);
Expand All @@ -87,11 +86,12 @@ describe('DotEditContentCategoryFieldComponent', () => {
spectator.detectComponentChanges();

// Due to a delay in the pipe of the subscription
spectator.tick(CLOSE_SIDEBAR_CSS_DELAY_MS + 100);
await new Promise((resolve) => setTimeout(resolve, 400));

expect(spectator.query(DotEditContentCategoryFieldSidebarComponent)).toBeNull();

spectator.detectComponentChanges();
expect(selectBtn.disabled).toBe(false);
}));
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ 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';
import { CLOSE_SIDEBAR_CSS_DELAY_MS } from './dot-edit-content-category-field.const';

const CLOSE_SIDEBAR_CSS_DELAY_MS = 300;

/**
* Component for editing content category field.
Expand Down

0 comments on commit 880abe7

Please sign in to comment.