removed unused code from autocomplete spec and fixed a broken test from drop-down
This commit is contained in:
parent
1a1f861205
commit
d77faf8e47
|
@ -121,7 +121,6 @@ describe('Component vnAutocomplete', () => {
|
|||
|
||||
it(`should perform a query if the item id isn't present in the controller.items property`, () => {
|
||||
controller.url = 'test.com';
|
||||
$httpBackend.whenGET(`${controller.url}?filter={"fields":{"id":true,"name":true},"where":{"id":3}}`).respond();
|
||||
$httpBackend.expectGET(`${controller.url}?filter={"fields":{"id":true,"name":true},"where":{"id":3}}`);
|
||||
controller.items = [{id: 1, name: 'test1'}, {id: 2, name: 'Bruce Wayne'}];
|
||||
controller.field = 3;
|
||||
|
@ -137,7 +136,6 @@ describe('Component vnAutocomplete', () => {
|
|||
|
||||
it(`should set field performing a query as the item id isn't present in the controller.items property`, () => {
|
||||
controller.url = 'test.com';
|
||||
$httpBackend.whenGET(`${controller.url}?filter={"fields":{"id":true,"name":true},"where":{"id":3}}`).respond();
|
||||
$httpBackend.expectGET(`${controller.url}?filter={"fields":{"id":true,"name":true},"where":{"id":3}}`);
|
||||
controller.items = [{id: 1, name: 'test1'}, {id: 2, name: 'Bruce Wayne'}];
|
||||
controller.field = 3;
|
||||
|
|
|
@ -259,19 +259,22 @@ describe('Component vnDropDown', () => {
|
|||
});
|
||||
});
|
||||
|
||||
// describe('setScrollPosition()', () => {
|
||||
// it(`should call child.scrollIntoView if defined `, () => {
|
||||
// $element[0].firstChild.setAttribute('class', 'dropdown');
|
||||
// let child = $element[0].firstChild.firstChild;
|
||||
describe('setScrollPosition()', () => {
|
||||
it(`should call child.scrollIntoView if defined `, () => {
|
||||
$element[0].firstChild.setAttribute('class', 'dropdown');
|
||||
$element[0].firstChild.firstChild.setAttribute('class', 'active');
|
||||
let child = $element[0].firstChild.firstChild;
|
||||
spyOn(child, 'getBoundingClientRect').and.returnValue({top: 100});
|
||||
let container = $element[0].firstChild;
|
||||
spyOn(container, 'getBoundingClientRect').and.returnValue({top: 10, height: 70});
|
||||
child.scrollIntoView = () => {};
|
||||
spyOn(child, 'scrollIntoView');
|
||||
controller._activeOption = 0;
|
||||
controller.setScrollPosition();
|
||||
|
||||
// child.scrollIntoView = () => {};
|
||||
// spyOn(child, 'scrollIntoView');
|
||||
// controller._activeOption = 0;
|
||||
// controller.setScrollPosition();
|
||||
|
||||
// expect(child.scrollIntoView).toHaveBeenCalledWith();
|
||||
// });
|
||||
// });
|
||||
expect(child.scrollIntoView).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('selectItem()', () => {
|
||||
it(`should pass item to selected and set controller._show to false`, () => {
|
||||
|
|
Loading…
Reference in New Issue