@@ -24,11 +24,11 @@ describe('layout', () => {
2424 // Pages of 100px with a gap of 10px
2525 const getBounds = ( index : number ) => ( { top : index * 110 , height : 100 } ) ;
2626
27- it ( 'should return the pages that intersect the view with their visible height and ratio' , ( ) => {
27+ it ( 'should return the pages that intersect the view with their visible ratio' , ( ) => {
2828 expect ( getVisiblePages ( 10 , getBounds , 150 , 350 ) ) . to . deep . equal ( [
29- { index : 1 , height : 60 , ratio : 0.6 } ,
30- { index : 2 , height : 100 , ratio : 1 } ,
31- { index : 3 , height : 20 , ratio : 0.2 } ,
29+ { index : 1 , ratio : 0.6 } ,
30+ { index : 2 , ratio : 1 } ,
31+ { index : 3 , ratio : 0.2 } ,
3232 ] ) ;
3333 } ) ;
3434
@@ -38,8 +38,8 @@ describe('layout', () => {
3838 { top : 60 , height : 200 } ,
3939 ] ;
4040 expect ( getVisiblePages ( 2 , ( index ) => bounds [ index ] , 0 , 210 ) ) . to . deep . equal ( [
41- { index : 0 , height : 50 , ratio : 1 } ,
42- { index : 1 , height : 150 , ratio : 0.75 } ,
41+ { index : 0 , ratio : 1 } ,
42+ { index : 1 , ratio : 0.75 } ,
4343 ] ) ;
4444 } ) ;
4545
@@ -49,8 +49,8 @@ describe('layout', () => {
4949 { top : 1610 , height : 200 } ,
5050 ] ;
5151 expect ( getVisiblePages ( 2 , ( index ) => bounds [ index ] , 900 , 1700 ) ) . to . deep . equal ( [
52- { index : 0 , height : 700 , ratio : 0.875 } ,
53- { index : 1 , height : 90 , ratio : 0.45 } ,
52+ { index : 0 , ratio : 0.875 } ,
53+ { index : 1 , ratio : 0.45 } ,
5454 ] ) ;
5555 } ) ;
5656
@@ -60,13 +60,13 @@ describe('layout', () => {
6060 { top : 60 , height : 0 } ,
6161 ] ;
6262 expect ( getVisiblePages ( 2 , ( index ) => bounds [ index ] , 0 , 160 ) ) . to . deep . equal ( [
63- { index : 0 , height : 50 , ratio : 1 } ,
64- { index : 1 , height : 0 , ratio : 0 } ,
63+ { index : 0 , ratio : 1 } ,
64+ { index : 1 , ratio : 0 } ,
6565 ] ) ;
6666 } ) ;
6767
68- it ( 'should return the next page with height 0 when the view only shows a gap' , ( ) => {
69- expect ( getVisiblePages ( 10 , getBounds , 212 , 218 ) ) . to . deep . equal ( [ { index : 2 , height : 0 , ratio : 0 } ] ) ;
68+ it ( 'should return the next page with a ratio of 0 when the view only shows a gap' , ( ) => {
69+ expect ( getVisiblePages ( 10 , getBounds , 212 , 218 ) ) . to . deep . equal ( [ { index : 2 , ratio : 0 } ] ) ;
7070 } ) ;
7171
7272 it ( 'should only measure a few pages of a long document' , ( ) => {
@@ -80,18 +80,18 @@ describe('layout', () => {
8080 it ( 'should return the page with the largest visible part of its height' , ( ) => {
8181 expect (
8282 getMostVisibleIndex ( [
83- { index : 3 , height : 50 , ratio : 0.1 } ,
84- { index : 4 , height : 60 , ratio : 1 } ,
85- { index : 5 , height : 300 , ratio : 0.6 } ,
83+ { index : 3 , ratio : 0.1 } ,
84+ { index : 4 , ratio : 1 } ,
85+ { index : 5 , ratio : 0.6 } ,
8686 ] ) ,
8787 ) . to . equal ( 4 ) ;
8888 } ) ;
8989
9090 it ( 'should return the first page on a tie' , ( ) => {
9191 expect (
9292 getMostVisibleIndex ( [
93- { index : 3 , height : 100 , ratio : 1 } ,
94- { index : 4 , height : 200 , ratio : 1 } ,
93+ { index : 3 , ratio : 1 } ,
94+ { index : 4 , ratio : 1 } ,
9595 ] ) ,
9696 ) . to . equal ( 3 ) ;
9797 } ) ;
0 commit comments