@@ -986,6 +986,43 @@ describe('ListMetricsAggregator', () => {
986986 expect ( listMetrics . getContentLength ( ) ) . toBe ( 25 ) ;
987987 } ) ;
988988
989+ it ( 'invalidates content length when list orientation changes' , ( ) => {
990+ const listMetrics = new ListMetricsAggregator ( ) ;
991+ const verticalOrientation = { horizontal : false , rtl : false } ;
992+ const horizontalOrientation = { horizontal : true , rtl : false } ;
993+ const horizontalRtlOrientation = { horizontal : true , rtl : true } ;
994+ const cellLayout = { height : 50 , width : 100 , x : 0 , y : 0 } ;
995+
996+ listMetrics . notifyListContentLayout ( {
997+ layout : { height : 800 , width : 400 } ,
998+ orientation : verticalOrientation ,
999+ } ) ;
1000+ expect ( listMetrics . hasContentLength ( ) ) . toBe ( true ) ;
1001+
1002+ listMetrics . notifyCellLayout ( {
1003+ cellIndex : 0 ,
1004+ cellKey : '0' ,
1005+ orientation : horizontalOrientation ,
1006+ layout : cellLayout ,
1007+ } ) ;
1008+ expect ( listMetrics . hasContentLength ( ) ) . toBe ( false ) ;
1009+
1010+ expect ( ( ) =>
1011+ listMetrics . notifyCellLayout ( {
1012+ cellIndex : 0 ,
1013+ cellKey : '0' ,
1014+ orientation : horizontalRtlOrientation ,
1015+ layout : cellLayout ,
1016+ } ) ,
1017+ ) . toThrow ( ) ;
1018+
1019+ listMetrics . notifyListContentLayout ( {
1020+ layout : { height : 50 , width : 500 } ,
1021+ orientation : horizontalRtlOrientation ,
1022+ } ) ;
1023+ expect ( listMetrics . getContentLength ( ) ) . toBe ( 500 ) ;
1024+ } ) ;
1025+
9891026 it ( 'requires contentLength to resolve RTL metrics' , ( ) => {
9901027 const listMetrics = new ListMetricsAggregator ( ) ;
9911028 const orientation = { horizontal : true , rtl : true } ;
0 commit comments