@@ -61,10 +61,41 @@ describe("new EntireColumnsSelection()", () => {
61
61
} ) ;
62
62
} ) ;
63
63
64
- describe ( "new EntireTableSelection() " , ( ) => {
64
+ describe ( "EntireTableSelection" , ( ) => {
65
65
test ( "creates entire table selection" , ( ) => {
66
66
new EntireTableSelection ( ) ;
67
67
} ) ;
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
+ } ) ;
68
99
} ) ;
69
100
70
101
describe ( "Selection.prototype.toRange()" , ( ) => {
@@ -263,12 +294,8 @@ describe("Selection.prototype.hasEntireColumn()", () => {
263
294
1 ,
264
295
false ,
265
296
] ,
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 ] ,
272
299
] ;
273
300
test . each ( cases ) ( "%s" , ( name , selection , column , expected ) => {
274
301
expect ( selection . hasEntireColumn ( column ) ) . toBe ( expected ) ;
0 commit comments