mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Fixed unit tests after rebase
This commit is contained in:
@@ -21,10 +21,9 @@ 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';
|
||||
|
@@ -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;
|
||||
|
@@ -63,16 +63,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" class="adf-property-field adf-dateitem-editable-controls" (click)="showDatePicker()">
|
||||
<input
|
||||
|
@@ -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 () => {
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -142,7 +142,7 @@ describe('Custom InfoDrawer', () => {
|
||||
fixture.detectChanges();
|
||||
const tab: any = fixture.debugElement.queryAll(By.css('.mdc-tab--active .mdc-tab__text-label'));
|
||||
expect(tab.length).toBe(1);
|
||||
expect(tab[0].nativeElement.innerText).toContain('TAB1');
|
||||
expect(tab[0].nativeElement.innerText).toContain('Tab1');
|
||||
});
|
||||
|
||||
it('should select the tab 2 (index 1)', () => {
|
||||
@@ -150,7 +150,7 @@ describe('Custom InfoDrawer', () => {
|
||||
fixture.detectChanges();
|
||||
const tab: any = fixture.debugElement.queryAll(By.css('.mdc-tab--active .mdc-tab__text-label'));
|
||||
expect(tab.length).toBe(1);
|
||||
expect(tab[0].nativeElement.innerText).toContain('TAB2');
|
||||
expect(tab[0].nativeElement.innerText).toContain('Tab2');
|
||||
});
|
||||
|
||||
it('should render a tab with icon', () => {
|
||||
|
Reference in New Issue
Block a user