test(collectionRepeat): fix faulty tests

This commit is contained in:
Andrew
2015-02-25 10:21:01 -07:00
parent 27298e9209
commit e87449440e
2 changed files with 9 additions and 9 deletions

View File

@@ -202,7 +202,6 @@ function CollectionRepeatDirective($ionicCollectionManager, $parse, $window, $$r
}
}
function refreshDimensions() {
console.log('refreshDimensions', validateResize.height, validateResize.width);
if (heightData.computed || widthData.computed) {
computeStyleDimensions();
}
@@ -450,7 +449,7 @@ function RepeatManagerFactory($rootScope, $window, $$rAF) {
isDataReady = true;
if (isLayoutReady && isDataReady) {
forceRerender();
setTimeout(scrollView.resize.bind(scrollView));
setTimeout(angular.bind(scrollView, scrollView.resize));
}
};

View File

@@ -28,7 +28,8 @@ describe('collectionRepeat', function() {
options: {
scrollingY: true
},
__callback: function(){},
__callback: angular.noop,
resize: angular.noop,
}, scrollViewData || {});
var scrollCtrl = {
scrollView: scrollView,
@@ -173,9 +174,9 @@ describe('collectionRepeat', function() {
scrollView.__clientHeight = 40;
angular.element($window).triggerHandler('resize');
expect(activeItems().length).toBe(3);
expect(activeItemContents()).toEqual(['2','3','4'])
expect(activeItemIds()).toEqual(['item_2','item_0','item_1']);
expect(activeItems().length).toBe(2);
expect(activeItemContents()).toEqual(['2','3'])
expect(activeItemIds()).toEqual(['item_2','item_0']);
}));
});
@@ -229,9 +230,9 @@ describe('collectionRepeat', function() {
scrollView.__clientHeight = 40;
angular.element($window).triggerHandler('resize');
expect(activeItems().length).toBe(5);
expect(activeItemContents()).toEqual(['2','3','4','5','6'])
expect(activeItemIds()).toEqual(['item_2','item_3','item_4','item_0','item_1']);
expect(activeItems().length).toBe(2);
expect(activeItemContents()).toEqual(['2','3'])
expect(activeItemIds()).toEqual(['item_2','item_3']);
}));
});