fix random test failing part 2 (#3395)

* fix random failing test core search/comment/auth/user

* fix node delete directive

* fix lint issues

* node restore fix

* fix comment test

* remove fdescribe

* fix tests and tslint

* fix upload test

* unsubscribe success event task test

* copy comment object during test

* use the data pipe performance improvement and standard usage

* uncomment random test

* fix comment date random failing test

* disposable unsubscribe

* fix start process

* remove fdescribe

* change start process test and remove commented code

* fix error event check double click

* clone object form test

* refactor date time test

* fix service mock

* fix test dropdown and context

* git hook lint

* fix language test

* unsubscribe documentlist event test

* fix disposable error

* fix console log service error document list

* unusbscribe search test

* clear input field

* remove wrong test
This commit is contained in:
Eugenio Romano
2018-05-29 11:18:17 +02:00
committed by Denys Vuika
parent 22006395c7
commit eb0f91c5db
43 changed files with 4475 additions and 4332 deletions

View File

@@ -64,7 +64,7 @@ describe('CardViewBoolItemComponent', () => {
expect(value).not.toBeNull();
});
it('should NOT render the label and value if the property is NOT editable and doesn\'t have a proper boolean value set' , () => {
it('should NOT render the label and value if the property is NOT editable and doesn\'t have a proper boolean value set', () => {
component.editable = true;
component.property.value = undefined;
component.property.editable = false;
@@ -77,7 +77,7 @@ describe('CardViewBoolItemComponent', () => {
expect(value).toBeNull();
});
it('should render the label and value if the property is NOT editable but has a proper boolean value set' , () => {
it('should render the label and value if the property is NOT editable but has a proper boolean value set', () => {
component.editable = true;
component.property.value = false;
component.property.editable = false;
@@ -179,7 +179,7 @@ describe('CardViewBoolItemComponent', () => {
const cardViewUpdateService = TestBed.get(CardViewUpdateService);
spyOn(cardViewUpdateService, 'update');
component.changed(<MatCheckboxChange> {checked: true});
component.changed(<MatCheckboxChange> { checked: true });
expect(cardViewUpdateService.update).toHaveBeenCalledWith(component.property, true);
});
@@ -187,7 +187,7 @@ describe('CardViewBoolItemComponent', () => {
it('should update the property value after a changed', async(() => {
component.property.value = true;
component.changed(<MatCheckboxChange> {checked: false});
component.changed(<MatCheckboxChange> { checked: false });
fixture.whenStable().then(() => {
expect(component.property.value).toBe(false);
@@ -199,10 +199,11 @@ describe('CardViewBoolItemComponent', () => {
component.property.value = false;
fixture.detectChanges();
cardViewUpdateService.itemUpdated$.subscribe(
let disposableUpdate = cardViewUpdateService.itemUpdated$.subscribe(
(updateNotification) => {
expect(updateNotification.target).toBe(component.property);
expect(updateNotification.changed).toEqual({ boolkey: true });
disposableUpdate.unsubscribe();
done();
}
);

View File

@@ -63,7 +63,7 @@ describe('CardViewDateItemComponent', () => {
});
it('should NOT render the default as value if the value is empty, editable:false and displayEmpty is false', () => {
component.property = new CardViewDateItemModel ({
component.property = new CardViewDateItemModel({
label: 'Date label',
value: '',
key: 'datekey',
@@ -81,7 +81,7 @@ describe('CardViewDateItemComponent', () => {
});
it('should render the default as value if the value is empty, editable:false and displayEmpty is true', () => {
component.property = new CardViewDateItemModel ({
component.property = new CardViewDateItemModel({
label: 'Date label',
value: '',
key: 'datekey',
@@ -99,7 +99,7 @@ describe('CardViewDateItemComponent', () => {
});
it('should render the default as value if the value is empty and editable:true', () => {
component.property = new CardViewDateItemModel ({
component.property = new CardViewDateItemModel({
label: 'Date label',
value: '',
key: 'datekey',
@@ -176,15 +176,16 @@ describe('CardViewDateItemComponent', () => {
const expectedDate = moment('Jul 10 2017', 'MMM DD YY');
fixture.detectChanges();
cardViewUpdateService.itemUpdated$.subscribe(
let disposableUpdate = cardViewUpdateService.itemUpdated$.subscribe(
(updateNotification) => {
expect(updateNotification.target).toBe(component.property);
expect(updateNotification.changed).toEqual({datekey: expectedDate.toDate()});
expect(updateNotification.changed).toEqual({ datekey: expectedDate.toDate() });
disposableUpdate.unsubscribe();
done();
}
);
component.onDateChanged({value: expectedDate});
component.onDateChanged({ value: expectedDate });
});
it('should update the propery\'s value after a succesful update attempt', async(() => {
@@ -194,7 +195,7 @@ describe('CardViewDateItemComponent', () => {
const expectedDate = moment('Jul 10 2017', 'MMM DD YY');
fixture.detectChanges();
component.onDateChanged({value: expectedDate});
component.onDateChanged({ value: expectedDate });
fixture.whenStable().then(
(updateNotification) => {

View File

@@ -118,11 +118,12 @@ describe('CardViewMapItemComponent', () => {
fixture.detectChanges();
let value: any = element.querySelector('.adf-mapitem-clickable-value');
service.itemClicked$.subscribe((response) => {
let disposableUpdate = service.itemClicked$.subscribe((response) => {
expect(response.target).not.toBeNull();
expect(response.target.type).toEqual('map');
expect(response.target.clickable).toBeTruthy();
expect(response.target.displayValue).toEqual('fakeProcessName');
disposableUpdate.unsubscribe();
done();
});

View File

@@ -35,7 +35,7 @@ describe('CardViewTextItemComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(CardViewTextItemComponent);
component = fixture.componentInstance;
component.property = new CardViewTextItemModel ({
component.property = new CardViewTextItemModel({
label: 'Text label',
value: 'Lorem ipsum',
key: 'textkey',
@@ -63,7 +63,7 @@ describe('CardViewTextItemComponent', () => {
});
it('should NOT render the default as value if the value is empty, editable is false and displayEmpty is false', () => {
component.property = new CardViewTextItemModel ({
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
key: 'textkey',
@@ -79,7 +79,7 @@ describe('CardViewTextItemComponent', () => {
});
it('should render the default as value if the value is empty, editable is false and displayEmpty is true', () => {
component.property = new CardViewTextItemModel ({
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
key: 'textkey',
@@ -95,7 +95,7 @@ describe('CardViewTextItemComponent', () => {
});
it('should render the default as value if the value is empty and editable true', () => {
component.property = new CardViewTextItemModel ({
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
key: 'textkey',
@@ -111,7 +111,7 @@ describe('CardViewTextItemComponent', () => {
});
it('should NOT render the default as value if the value is empty, clickable is false and displayEmpty is false', () => {
component.property = new CardViewTextItemModel ({
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
key: 'textkey',
@@ -127,7 +127,7 @@ describe('CardViewTextItemComponent', () => {
});
it('should render the default as value if the value is empty, clickable is false and displayEmpty is true', () => {
component.property = new CardViewTextItemModel ({
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
key: 'textkey',
@@ -143,7 +143,7 @@ describe('CardViewTextItemComponent', () => {
});
it('should render the default as value if the value is empty and clickable true', () => {
component.property = new CardViewTextItemModel ({
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
key: 'textkey',
@@ -158,7 +158,7 @@ describe('CardViewTextItemComponent', () => {
});
it('should render the edit icon in case of clickable true and icon defined', () => {
component.property = new CardViewTextItemModel ({
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
key: 'textkey',
@@ -174,7 +174,7 @@ describe('CardViewTextItemComponent', () => {
});
it('should not render the edit icon in case of clickable true and icon undefined', () => {
component.property = new CardViewTextItemModel ({
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
key: 'textkey',
@@ -188,7 +188,7 @@ describe('CardViewTextItemComponent', () => {
});
it('should not render the edit icon in case of clickable false and icon defined', () => {
component.property = new CardViewTextItemModel ({
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
key: 'textkey',
@@ -314,10 +314,11 @@ describe('CardViewTextItemComponent', () => {
const expectedText = 'changed text';
fixture.detectChanges();
cardViewUpdateService.itemUpdated$.subscribe(
let disposableUpdate = cardViewUpdateService.itemUpdated$.subscribe(
(updateNotification) => {
expect(updateNotification.target).toBe(component.property);
expect(updateNotification.changed).toEqual({ textkey: expectedText });
disposableUpdate.unsubscribe();
done();
}
);

View File

@@ -41,7 +41,8 @@ export class CardViewTextItemComponent implements OnChanges {
editedValue: string;
errorMessages: string[];
constructor(private cardViewUpdateService: CardViewUpdateService) {}
constructor(private cardViewUpdateService: CardViewUpdateService) {
}
ngOnChanges(): void {
this.editedValue = this.property.value;
@@ -83,7 +84,7 @@ export class CardViewTextItemComponent implements OnChanges {
update(): void {
if (this.property.isValid(this.editedValue)) {
this.cardViewUpdateService.update(this.property, this.editedValue );
this.cardViewUpdateService.update(this.property, this.editedValue);
this.property.value = this.editedValue;
this.setEditMode(false);
} else {