Fixed unit tests after rebase

This commit is contained in:
Vito Albano 2023-12-22 12:04:17 +00:00 committed by VitoAlbano
parent a8079104db
commit 7ea3b10fce
5 changed files with 21 additions and 28 deletions

View File

@ -21,10 +21,10 @@ import { By } from '@angular/platform-browser';
import { Category, CategoryPaging, ClassesApi, Node, Tag, TagBody, TagEntry, TagPaging, TagPagingList } from '@alfresco/js-api';
import { ContentMetadataComponent } from './content-metadata.component';
import { ContentMetadataService } from '../../services/content-metadata.service';
import { AppConfigService, CardViewBaseItemModel, CardViewComponent, NotificationService, UpdateNotification } from '@alfresco/adf-core';
import { AppConfigService, AuthModule, CardViewBaseItemModel, CardViewComponent, NotificationService, PipeModule, TranslationMock, TranslationService, UpdateNotification } from '@alfresco/adf-core';
import { NodesApiService } from '../../../common/services/nodes-api.service';
import { EMPTY, of, throwError } from 'rxjs';
import { ContentTestingModule } from '../../../testing/content.testing.module';
import { TranslateModule } from '@ngx-translate/core';
import { CardViewContentUpdateService } from '../../../common/services/card-view-content-update.service';
import { PropertyGroup } from '../../interfaces/property-group.interface';
import { PropertyDescriptorsService } from '../../services/property-descriptors.service';

View File

@ -36,10 +36,6 @@ export class CardViewBoolItemComponent extends BaseCardView<CardViewBoolItemMode
@Input()
editable: boolean;
isEditable() {
return this.editable && this.property.editable;
}
changed(change: MatCheckboxChange) {
this.cardViewUpdateService.update({ ...this.property } as CardViewBoolItemModel, change.checked );
this.property.value = change.checked;

View File

@ -76,16 +76,15 @@
<div *ngIf="property.multivalued"
class="adf-property-field adf-dateitem-chip-list-container adf-dateitem-editable">
<mat-chip-listbox #chipList
class="adf-textitem-chip-list">
<mat-chip-option *ngFor="let propertyValue of property.displayValue; let idx = index"
[removable]="isEditable()"
(removed)="removeValueFromList(idx)">
<mat-chip-list #chipList class="adf-textitem-chip-list">
<mat-chip
*ngFor="let propertyValue of property.displayValue; let idx = index"
[removable]="isEditable"
(removed)="removeValueFromList(idx)">
{{ propertyValue }}
<mat-icon *ngIf="isEditable()"
matChipRemove>cancel</mat-icon>
</mat-chip-option>
</mat-chip-listbox>
<mat-icon *ngIf="isEditable" matChipRemove>cancel</mat-icon>
</mat-chip>
</mat-chip-list>
<div
*ngIf="isEditable"

View File

@ -29,7 +29,6 @@ import { MatDatetimepickerInputEvent } from '@mat-datetimepicker/core';
import { HarnessLoader } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { MatChipHarness } from '@angular/material/chips/testing';
import { addMinutes } from 'date-fns';
describe('CardViewDateItemComponent', () => {
let loader: HarnessLoader;
@ -195,7 +194,7 @@ describe('CardViewDateItemComponent', () => {
fixture.detectChanges();
const property = { ...component.property };
component.onDateChanged({ value: addMinutes(expectedDate, expectedDate.getTimezoneOffset()) } as MatDatetimepickerInputEvent<Date>);
component.onDateChanged({ value: expectedDate } as MatDatetimepickerInputEvent<Date>);
expect(itemUpdatedSpy).toHaveBeenCalledWith({
target: property,
changed: {
@ -211,7 +210,7 @@ describe('CardViewDateItemComponent', () => {
const expectedDate = new Date('Jul 10 2017');
fixture.detectChanges();
component.onDateChanged({ value: addMinutes(expectedDate, expectedDate.getTimezoneOffset()) } as MatDatetimepickerInputEvent<Date>);
component.onDateChanged({ value: expectedDate } as MatDatetimepickerInputEvent<Date>);
await fixture.whenStable();
expect(component.property.value).toEqual(expectedDate);
@ -325,7 +324,7 @@ describe('CardViewDateItemComponent', () => {
component.property.default = 'Jul 10 2017 00:01:00';
component.property.key = 'fake-key';
component.property.value = new Date('Jul 10 2017 00:01:00');
const expectedDate = new Date('Jul 10 2018 00:01:00');
const expectedDate = new Date('Jul 10 2018');
fixture.detectChanges();
await fixture.whenStable();
@ -336,7 +335,7 @@ describe('CardViewDateItemComponent', () => {
component.onDateChanged({ value: expectedDate } as MatDatetimepickerInputEvent<Date>);
fixture.detectChanges();
expect(addMinutes(component.property.value, component.property.value.getTimezoneOffset())).toEqual(expectedDate);
expect(component.property.value).toEqual(expectedDate);
});
it('should render chips for multivalue dates when chips are enabled', async () => {

View File

@ -26,7 +26,6 @@
justify-content: center;
}
&__add-btn.mat-mdc-button {
margin-bottom: 20px;
}
@ -34,15 +33,15 @@
&__read-only {
padding-bottom: 20px;
.mat-mdc-table {
box-shadow: none;
}
.mat-mdc-table {
box-shadow: none;
}
.mat-mdc-header-row,
.mat-mdc-row {
padding: 0;
.mat-mdc-header-row,
.mat-mdc-row {
padding: 0;
}
}
}
}
}