diff --git a/test/unit/views/scrollView.unit.js b/test/unit/views/scrollView.unit.js index 00d751dca3..4d39cbe783 100644 --- a/test/unit/views/scrollView.unit.js +++ b/test/unit/views/scrollView.unit.js @@ -49,6 +49,14 @@ describe('Scroll View', function() { sc.style.height = scHeight + "px"; sc.style.display = "block"; + var viewportHeight = 480; + var scBottom = 460; + + //hack to get this to work + sc.getBoundingClientRect = function(){ + return { bottom: scBottom }; + }; + var keyboardHeight = 200; details = { contentHeight: 260, @@ -58,13 +66,16 @@ describe('Scroll View', function() { keyboardHeight: keyboardHeight, keyboardTopOffset: 40, target: element, + viewportHeight: viewportHeight }; + var scOffsetToBottom = viewportHeight - scBottom; + expect( sv.isScrolledIntoView ).toBeFalsy(); ionic.trigger('scrollChildIntoView', details, true); expect( sv.isScrolledIntoView ).toEqual(true); - expect( sc.style.height ).toEqual(scHeight - keyboardHeight + "px"); - expect( sc.clientHeight ).toEqual(scHeight - keyboardHeight); + expect( sc.style.height ).toEqual(scHeight - keyboardHeight + scOffsetToBottom + "px"); + expect( sc.clientHeight ).toEqual(scHeight - keyboardHeight + scOffsetToBottom); }); });