mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
Added some FE test for tab
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||
import { FormModel } from '../core/form.model';
|
||||
import { FormFieldModel } from '../core/form-field.model';
|
||||
import { fakeFormJson } from '../../../services/assets/widget-visibility.service.mock';
|
||||
import { TabsWidget } from './tabs.widget';
|
||||
import { TabModel } from '../core/tab.model';
|
||||
@@ -69,7 +70,7 @@ describe('TabsWidget', () => {
|
||||
});
|
||||
widget.tabChanged(field);
|
||||
});
|
||||
|
||||
|
||||
it('should remove invisible tabs', () => {
|
||||
let fakeTab = new TabModel(null, {id: 'fake-tab-id', title: 'fake-tab-title'});
|
||||
fakeTab.isVisible = false;
|
||||
@@ -95,6 +96,8 @@ describe('TabsWidget', () => {
|
||||
let tabWidgetComponent: TabsWidget;
|
||||
let fixture: ComponentFixture<TabsWidget>;
|
||||
let element: HTMLElement;
|
||||
let fakeTabVisible: TabModel;
|
||||
let fakeTabInvisible: TabModel;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@@ -107,9 +110,6 @@ describe('TabsWidget', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
let fakeTabVisible: TabModel;
|
||||
let fakeTabInvisible: TabModel;
|
||||
|
||||
beforeEach(() => {
|
||||
componentHandler = jasmine.createSpyObj('componentHandler', ['upgradeAllRegistered', 'upgradeElement']);
|
||||
window['componentHandler'] = componentHandler;
|
||||
@@ -127,6 +127,11 @@ describe('TabsWidget', () => {
|
||||
tabWidgetComponent.tabs.push(fakeTabInvisible);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
|
||||
it('should show only visible tabs', () => {
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable()
|
||||
@@ -166,5 +171,4 @@ describe('TabsWidget', () => {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user