mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Fixed unit tests after rebase
This commit is contained in:
parent
a8079104db
commit
7ea3b10fce
@ -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 { Category, CategoryPaging, ClassesApi, Node, Tag, TagBody, TagEntry, TagPaging, TagPagingList } from '@alfresco/js-api';
|
||||||
import { ContentMetadataComponent } from './content-metadata.component';
|
import { ContentMetadataComponent } from './content-metadata.component';
|
||||||
import { ContentMetadataService } from '../../services/content-metadata.service';
|
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 { NodesApiService } from '../../../common/services/nodes-api.service';
|
||||||
import { EMPTY, of, throwError } from 'rxjs';
|
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 { CardViewContentUpdateService } from '../../../common/services/card-view-content-update.service';
|
||||||
import { PropertyGroup } from '../../interfaces/property-group.interface';
|
import { PropertyGroup } from '../../interfaces/property-group.interface';
|
||||||
import { PropertyDescriptorsService } from '../../services/property-descriptors.service';
|
import { PropertyDescriptorsService } from '../../services/property-descriptors.service';
|
||||||
|
@ -36,10 +36,6 @@ export class CardViewBoolItemComponent extends BaseCardView<CardViewBoolItemMode
|
|||||||
@Input()
|
@Input()
|
||||||
editable: boolean;
|
editable: boolean;
|
||||||
|
|
||||||
isEditable() {
|
|
||||||
return this.editable && this.property.editable;
|
|
||||||
}
|
|
||||||
|
|
||||||
changed(change: MatCheckboxChange) {
|
changed(change: MatCheckboxChange) {
|
||||||
this.cardViewUpdateService.update({ ...this.property } as CardViewBoolItemModel, change.checked );
|
this.cardViewUpdateService.update({ ...this.property } as CardViewBoolItemModel, change.checked );
|
||||||
this.property.value = change.checked;
|
this.property.value = change.checked;
|
||||||
|
@ -76,16 +76,15 @@
|
|||||||
|
|
||||||
<div *ngIf="property.multivalued"
|
<div *ngIf="property.multivalued"
|
||||||
class="adf-property-field adf-dateitem-chip-list-container adf-dateitem-editable">
|
class="adf-property-field adf-dateitem-chip-list-container adf-dateitem-editable">
|
||||||
<mat-chip-listbox #chipList
|
<mat-chip-list #chipList class="adf-textitem-chip-list">
|
||||||
class="adf-textitem-chip-list">
|
<mat-chip
|
||||||
<mat-chip-option *ngFor="let propertyValue of property.displayValue; let idx = index"
|
*ngFor="let propertyValue of property.displayValue; let idx = index"
|
||||||
[removable]="isEditable()"
|
[removable]="isEditable"
|
||||||
(removed)="removeValueFromList(idx)">
|
(removed)="removeValueFromList(idx)">
|
||||||
{{ propertyValue }}
|
{{ propertyValue }}
|
||||||
<mat-icon *ngIf="isEditable()"
|
<mat-icon *ngIf="isEditable" matChipRemove>cancel</mat-icon>
|
||||||
matChipRemove>cancel</mat-icon>
|
</mat-chip>
|
||||||
</mat-chip-option>
|
</mat-chip-list>
|
||||||
</mat-chip-listbox>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
*ngIf="isEditable"
|
*ngIf="isEditable"
|
||||||
|
@ -29,7 +29,6 @@ import { MatDatetimepickerInputEvent } from '@mat-datetimepicker/core';
|
|||||||
import { HarnessLoader } from '@angular/cdk/testing';
|
import { HarnessLoader } from '@angular/cdk/testing';
|
||||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||||
import { MatChipHarness } from '@angular/material/chips/testing';
|
import { MatChipHarness } from '@angular/material/chips/testing';
|
||||||
import { addMinutes } from 'date-fns';
|
|
||||||
|
|
||||||
describe('CardViewDateItemComponent', () => {
|
describe('CardViewDateItemComponent', () => {
|
||||||
let loader: HarnessLoader;
|
let loader: HarnessLoader;
|
||||||
@ -195,7 +194,7 @@ describe('CardViewDateItemComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const property = { ...component.property };
|
const property = { ...component.property };
|
||||||
|
|
||||||
component.onDateChanged({ value: addMinutes(expectedDate, expectedDate.getTimezoneOffset()) } as MatDatetimepickerInputEvent<Date>);
|
component.onDateChanged({ value: expectedDate } as MatDatetimepickerInputEvent<Date>);
|
||||||
expect(itemUpdatedSpy).toHaveBeenCalledWith({
|
expect(itemUpdatedSpy).toHaveBeenCalledWith({
|
||||||
target: property,
|
target: property,
|
||||||
changed: {
|
changed: {
|
||||||
@ -211,7 +210,7 @@ describe('CardViewDateItemComponent', () => {
|
|||||||
const expectedDate = new Date('Jul 10 2017');
|
const expectedDate = new Date('Jul 10 2017');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
component.onDateChanged({ value: addMinutes(expectedDate, expectedDate.getTimezoneOffset()) } as MatDatetimepickerInputEvent<Date>);
|
component.onDateChanged({ value: expectedDate } as MatDatetimepickerInputEvent<Date>);
|
||||||
|
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
expect(component.property.value).toEqual(expectedDate);
|
expect(component.property.value).toEqual(expectedDate);
|
||||||
@ -325,7 +324,7 @@ describe('CardViewDateItemComponent', () => {
|
|||||||
component.property.default = 'Jul 10 2017 00:01:00';
|
component.property.default = 'Jul 10 2017 00:01:00';
|
||||||
component.property.key = 'fake-key';
|
component.property.key = 'fake-key';
|
||||||
component.property.value = new Date('Jul 10 2017 00:01:00');
|
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();
|
fixture.detectChanges();
|
||||||
|
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
@ -336,7 +335,7 @@ describe('CardViewDateItemComponent', () => {
|
|||||||
component.onDateChanged({ value: expectedDate } as MatDatetimepickerInputEvent<Date>);
|
component.onDateChanged({ value: expectedDate } as MatDatetimepickerInputEvent<Date>);
|
||||||
|
|
||||||
fixture.detectChanges();
|
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 () => {
|
it('should render chips for multivalue dates when chips are enabled', async () => {
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
&__add-btn.mat-mdc-button {
|
&__add-btn.mat-mdc-button {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
@ -34,15 +33,15 @@
|
|||||||
&__read-only {
|
&__read-only {
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
|
|
||||||
.mat-mdc-table {
|
.mat-mdc-table {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mat-mdc-header-row,
|
.mat-mdc-header-row,
|
||||||
.mat-mdc-row {
|
.mat-mdc-row {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user