mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
Merge pull request #924 from Alfresco/dev-valbano-test-fix
Fixed test to detect fail correctly
This commit is contained in:
+8
-7
@@ -176,9 +176,9 @@ describe('ContainerWidget', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should hide header when it becomes not visible', () => {
|
it('should hide header when it becomes not visible', async(() => {
|
||||||
containerWidgetComponent.content = fakeContainerVisible;
|
containerWidgetComponent.content = fakeContainerVisible;
|
||||||
containerWidgetComponent.fieldChanged(null);
|
fixture.detectChanges();
|
||||||
containerWidgetComponent.formValueChanged.subscribe((res) => {
|
containerWidgetComponent.formValueChanged.subscribe((res) => {
|
||||||
containerWidgetComponent.content.isVisible = false;
|
containerWidgetComponent.content.isVisible = false;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -188,11 +188,11 @@ describe('ContainerWidget', () => {
|
|||||||
expect(element.querySelector('#container-header-label')).toBeNull();
|
expect(element.querySelector('#container-header-label')).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('should show header when it becomes visible', () => {
|
|
||||||
containerWidgetComponent.content = fakeContainerInvisible;
|
|
||||||
containerWidgetComponent.fieldChanged(null);
|
containerWidgetComponent.fieldChanged(null);
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should show header when it becomes visible', async(() => {
|
||||||
|
containerWidgetComponent.content = fakeContainerInvisible;
|
||||||
containerWidgetComponent.formValueChanged.subscribe((res) => {
|
containerWidgetComponent.formValueChanged.subscribe((res) => {
|
||||||
containerWidgetComponent.content.isVisible = true;
|
containerWidgetComponent.content.isVisible = true;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -204,7 +204,8 @@ describe('ContainerWidget', () => {
|
|||||||
expect(element.querySelector('#container-header-label').innerHTML).toContain('fake-cont-2-name');
|
expect(element.querySelector('#container-header-label').innerHTML).toContain('fake-cont-2-name');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
containerWidgetComponent.fieldChanged(null);
|
||||||
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+11
-10
@@ -138,6 +138,7 @@ describe('RadioButtonsWidget', () => {
|
|||||||
});
|
});
|
||||||
radioButtonWidget.field.options = [{id: 'opt-1', name: 'opt-name-1'}, {id: 'opt-2', name: 'opt-name-2'}];
|
radioButtonWidget.field.options = [{id: 'opt-1', name: 'opt-name-1'}, {id: 'opt-2', name: 'opt-name-2'}];
|
||||||
radioButtonWidget.field.isVisible = true;
|
radioButtonWidget.field.isVisible = true;
|
||||||
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -145,7 +146,7 @@ describe('RadioButtonsWidget', () => {
|
|||||||
TestBed.resetTestingModule();
|
TestBed.resetTestingModule();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show visible radio buttons', () => {
|
it('should show visible radio buttons', async(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable()
|
fixture.whenStable()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -155,9 +156,9 @@ describe('RadioButtonsWidget', () => {
|
|||||||
expect(element.querySelector('#opt-2')).toBeDefined();
|
expect(element.querySelector('#opt-2')).toBeDefined();
|
||||||
expect(element.querySelector('#radio-id-opt-2')).toBeDefined();
|
expect(element.querySelector('#radio-id-opt-2')).toBeDefined();
|
||||||
});
|
});
|
||||||
});
|
}));
|
||||||
|
|
||||||
it('should not show invisible radio buttons', () => {
|
it('should not show invisible radio buttons', async(() => {
|
||||||
radioButtonWidget.field.isVisible = false;
|
radioButtonWidget.field.isVisible = false;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable()
|
fixture.whenStable()
|
||||||
@@ -166,10 +167,9 @@ describe('RadioButtonsWidget', () => {
|
|||||||
expect(element.querySelector('#opt-1')).toBeNull();
|
expect(element.querySelector('#opt-1')).toBeNull();
|
||||||
expect(element.querySelector('#opt-2')).toBeNull();
|
expect(element.querySelector('#opt-2')).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
}));
|
||||||
|
|
||||||
it('should hide radio button when it becomes not visible', () => {
|
it('should hide radio button when it becomes not visible', async(() => {
|
||||||
radioButtonWidget.checkVisibility(null);
|
|
||||||
radioButtonWidget.fieldChanged.subscribe((res) => {
|
radioButtonWidget.fieldChanged.subscribe((res) => {
|
||||||
radioButtonWidget.field.isVisible = false;
|
radioButtonWidget.field.isVisible = false;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -180,12 +180,12 @@ describe('RadioButtonsWidget', () => {
|
|||||||
expect(element.querySelector('#opt-2')).toBeNull();
|
expect(element.querySelector('#opt-2')).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
radioButtonWidget.checkVisibility(null);
|
||||||
|
}));
|
||||||
|
|
||||||
it('should show radio button when it becomes visible', () => {
|
it('should show radio button when it becomes visible', async(() => {
|
||||||
radioButtonWidget.field.isVisible = false;
|
radioButtonWidget.field.isVisible = false;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
radioButtonWidget.checkVisibility(null);
|
|
||||||
radioButtonWidget.fieldChanged.subscribe((res) => {
|
radioButtonWidget.fieldChanged.subscribe((res) => {
|
||||||
radioButtonWidget.field.isVisible = true;
|
radioButtonWidget.field.isVisible = true;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -198,7 +198,8 @@ describe('RadioButtonsWidget', () => {
|
|||||||
expect(element.querySelector('#radio-id-opt-2')).toBeDefined();
|
expect(element.querySelector('#radio-id-opt-2')).toBeDefined();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
radioButtonWidget.checkVisibility(null);
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ describe('TabsWidget', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
componentHandler = jasmine.createSpyObj('componentHandler', ['upgradeAllRegistered', 'upgradeElement']);
|
componentHandler = jasmine.createSpyObj('componentHandler',
|
||||||
|
['upgradeAllRegistered', 'upgradeElement', 'downgradeElements']);
|
||||||
window['componentHandler'] = componentHandler;
|
window['componentHandler'] = componentHandler;
|
||||||
fakeTabVisible = new TabModel(new FormModel(fakeFormJson), {
|
fakeTabVisible = new TabModel(new FormModel(fakeFormJson), {
|
||||||
id: 'tab-id-visible',
|
id: 'tab-id-visible',
|
||||||
@@ -144,8 +145,8 @@ describe('TabsWidget', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show tab when it became visible', () => {
|
it('should show tab when it became visible', async(() => {
|
||||||
tabWidgetComponent.tabChanged(null);
|
fixture.detectChanges();
|
||||||
tabWidgetComponent.formTabChanged.subscribe((res) => {
|
tabWidgetComponent.formTabChanged.subscribe((res) => {
|
||||||
tabWidgetComponent.tabs[1].isVisible = true;
|
tabWidgetComponent.tabs[1].isVisible = true;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -155,10 +156,11 @@ describe('TabsWidget', () => {
|
|||||||
expect(element.querySelector('#title-tab-id-invisible').innerHTML).toContain('tab-title-invisible');
|
expect(element.querySelector('#title-tab-id-invisible').innerHTML).toContain('tab-title-invisible');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('should hide tab when it became not visible', () => {
|
|
||||||
tabWidgetComponent.tabChanged(null);
|
tabWidgetComponent.tabChanged(null);
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should hide tab when it became not visible', async(() => {
|
||||||
|
fixture.detectChanges();
|
||||||
tabWidgetComponent.formTabChanged.subscribe((res) => {
|
tabWidgetComponent.formTabChanged.subscribe((res) => {
|
||||||
tabWidgetComponent.tabs[0].isVisible = false;
|
tabWidgetComponent.tabs[0].isVisible = false;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -168,7 +170,8 @@ describe('TabsWidget', () => {
|
|||||||
expect(element.querySelector('#title-tab-id-visible')).toBeNull();
|
expect(element.querySelector('#title-tab-id-visible')).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
tabWidgetComponent.tabChanged(null);
|
||||||
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user