mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Unit test fixes
This commit is contained in:
@@ -73,11 +73,15 @@ describe('AlfrescoSearchControlComponent', () => {
|
|||||||
|
|
||||||
it('should display a text input field by default',
|
it('should display a text input field by default',
|
||||||
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||||
return tcb.createAsync(AlfrescoSearchControlComponent).then((componentFixture) => {
|
return tcb
|
||||||
const element = componentFixture.nativeElement;
|
.createAsync(AlfrescoSearchControlComponent)
|
||||||
expect(element.querySelectorAll('input[type="text"]').length).toBe(1);
|
.then((componentFixture) => {
|
||||||
});
|
const element = componentFixture.nativeElement;
|
||||||
}));
|
componentFixture.detectChanges();
|
||||||
|
expect(element.querySelectorAll('input[type="text"]').length).toBe(1);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
it('should display a search input field when specified',
|
it('should display a search input field when specified',
|
||||||
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||||
@@ -91,12 +95,16 @@ describe('AlfrescoSearchControlComponent', () => {
|
|||||||
|
|
||||||
it('should set browser autocomplete to off by default',
|
it('should set browser autocomplete to off by default',
|
||||||
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||||
return tcb.createAsync(AlfrescoSearchControlComponent).then((componentFixture) => {
|
return tcb
|
||||||
const element = componentFixture.nativeElement;
|
.createAsync(AlfrescoSearchControlComponent)
|
||||||
expect(element.querySelectorAll('input[type="text"]')[0].getAttribute('autocomplete'))
|
.then((componentFixture) => {
|
||||||
.toBe('off');
|
const element = componentFixture.nativeElement;
|
||||||
|
componentFixture.detectChanges();
|
||||||
|
let attr = element.querySelectorAll('input[type="text"]')[0].getAttribute('autocomplete');
|
||||||
|
expect(attr).toBe('off');
|
||||||
});
|
});
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
|
|
||||||
it('should set browser autocomplete to on when configured',
|
it('should set browser autocomplete to on when configured',
|
||||||
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||||
@@ -111,22 +119,29 @@ describe('AlfrescoSearchControlComponent', () => {
|
|||||||
|
|
||||||
it('should show an expanding control by default',
|
it('should show an expanding control by default',
|
||||||
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||||
return tcb.createAsync(AlfrescoSearchControlComponent).then((componentFixture) => {
|
return tcb
|
||||||
const element = componentFixture.nativeElement;
|
.createAsync(AlfrescoSearchControlComponent)
|
||||||
expect(element.querySelectorAll('div.mdl-textfield--expandable').length).toBe(1);
|
.then((componentFixture) => {
|
||||||
expect(element.querySelectorAll('div.mdl-textfield__expandable-holder').length).toBe(1);
|
const element = componentFixture.nativeElement;
|
||||||
|
componentFixture.detectChanges();
|
||||||
|
expect(element.querySelectorAll('div.mdl-textfield--expandable').length).toBe(1);
|
||||||
|
expect(element.querySelectorAll('div.mdl-textfield__expandable-holder').length).toBe(1);
|
||||||
});
|
});
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
|
|
||||||
it('should show a normal non-expanding control when configured',
|
it('should show a normal non-expanding control when configured',
|
||||||
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||||
return tcb.createAsync(AlfrescoSearchControlComponent).then((componentFixture) => {
|
return tcb
|
||||||
const element = componentFixture.nativeElement;
|
.createAsync(AlfrescoSearchControlComponent)
|
||||||
componentFixture.componentInstance.expandable = true;
|
.then((componentFixture) => {
|
||||||
componentFixture.detectChanges();
|
const element = componentFixture.nativeElement;
|
||||||
expect(element.querySelectorAll('div.mdl-textfield--expandable').length).toBe(0);
|
componentFixture.componentInstance.expandable = true;
|
||||||
expect(element.querySelectorAll('div.mdl-textfield__expandable-holder').length).toBe(0);
|
componentFixture.detectChanges();
|
||||||
|
expect(element.querySelectorAll('div.mdl-textfield--expandable').length).toBe(0);
|
||||||
|
expect(element.querySelectorAll('div.mdl-textfield__expandable-holder').length).toBe(0);
|
||||||
});
|
});
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user