mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
scrollview test hax
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user