@@ -61,10 +61,41 @@ describe("new EntireColumnsSelection()", () => {
6161 } ) ;
6262} ) ;
6363
64- describe ( "new EntireTableSelection() " , ( ) => {
64+ describe ( "EntireTableSelection" , ( ) => {
6565 test ( "creates entire table selection" , ( ) => {
6666 new EntireTableSelection ( ) ;
6767 } ) ;
68+ test ( "toRange() returns the range of entire table" , ( ) => {
69+ const selection = new EntireTableSelection ( ) ;
70+ expect ( selection . toRange ( EXAMPLE_DATA ) ) . toEqual (
71+ getMatrixRange ( EXAMPLE_DATA )
72+ ) ;
73+ } ) ;
74+ test ( "normalizeTo() returns the same object" , ( ) => {
75+ const selection = new EntireTableSelection ( ) ;
76+ expect ( selection . normalizeTo ( EXAMPLE_DATA ) ) . toEqual ( selection ) ;
77+ } ) ;
78+ test ( "hasEntireRow() returns true for any row" , ( ) => {
79+ const selection = new EntireTableSelection ( ) ;
80+ expect ( selection . hasEntireRow ( 0 ) ) . toBe ( true ) ;
81+ expect ( selection . hasEntireRow ( 1 ) ) . toBe ( true ) ;
82+ } ) ;
83+ test ( "hasEntireColumn() returns true for any column" , ( ) => {
84+ const selection = new EntireTableSelection ( ) ;
85+ expect ( selection . hasEntireColumn ( 0 ) ) . toBe ( true ) ;
86+ expect ( selection . hasEntireColumn ( 1 ) ) . toBe ( true ) ;
87+ } ) ;
88+ test ( "size() returns the size of entire table" , ( ) => {
89+ const selection = new EntireTableSelection ( ) ;
90+ expect ( selection . size ( EXAMPLE_DATA ) ) . toBe (
91+ EXAMPLE_DATA_ROWS_COUNT * EXAMPLE_DATA_COLUMNS_COUNT
92+ ) ;
93+ } ) ;
94+ test ( "has() returns true for any point" , ( ) => {
95+ const selection = new EntireTableSelection ( ) ;
96+ expect ( selection . has ( EXAMPLE_DATA , Point . ORIGIN ) ) . toBe ( true ) ;
97+ expect ( selection . has ( EXAMPLE_DATA , EXAMPLE_DATA_MAX_POINT ) ) . toBe ( true ) ;
98+ } ) ;
6899} ) ;
69100
70101describe ( "Selection.prototype.toRange()" , ( ) => {
@@ -263,12 +294,8 @@ describe("Selection.prototype.hasEntireColumn()", () => {
263294 1 ,
264295 false ,
265296 ] ,
266- [
267- "returns false for non-entire-columns selection" ,
268- new EmptySelection ( ) ,
269- 0 ,
270- false ,
271- ] ,
297+ [ "returns false for empty selection" , new EmptySelection ( ) , 0 , false ] ,
298+ [ "returns false for empty selection" , new EmptySelection ( ) , 0 , false ] ,
272299 ] ;
273300 test . each ( cases ) ( "%s" , ( name , selection , column , expected ) => {
274301 expect ( selection . hasEntireColumn ( column ) ) . toBe ( expected ) ;
0 commit comments