diff --git a/client/core/src/autocomplete/autocomplete.spec.js b/client/core/src/autocomplete/autocomplete.spec.js index c7e75448c..3425a84f2 100644 --- a/client/core/src/autocomplete/autocomplete.spec.js +++ b/client/core/src/autocomplete/autocomplete.spec.js @@ -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; diff --git a/client/core/src/drop-down/drop-down.spec.js b/client/core/src/drop-down/drop-down.spec.js index 57ee2e6f0..13facff6b 100644 --- a/client/core/src/drop-down/drop-down.spec.js +++ b/client/core/src/drop-down/drop-down.spec.js @@ -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`, () => {