mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
test(collectionRepeat): fix faulty tests
This commit is contained in:
3
js/angular/directive/collectionRepeat.js
vendored
3
js/angular/directive/collectionRepeat.js
vendored
@@ -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));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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']);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user