scrollview test hax

This commit is contained in:
Tim Lancina
2014-05-12 14:55:10 -05:00
parent 61c9c4571b
commit 057e02e420

View File

@@ -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);
});
});