@@ -7,22 +7,57 @@ describe('copy paste', () => {
7
7
cy . visit ( 'http://localhost:8082' ) ;
8
8
} ) ;
9
9
10
- it ( 'can do BE roundtrip on cell modification ' , ( ) => {
10
+ it ( 'can copy multiple rows ' , ( ) => {
11
11
DashTable . getCell ( 0 , 0 ) . click ( ) ;
12
- DOM . focused . type ( `10${ Key . Enter } ` ) ;
13
-
14
- DashTable
15
- . getCell ( 0 , 0 )
16
- . within ( ( ) => cy . get ( '.cell-value' ) . should ( 'have.html' , '10' ) )
17
- . then ( ( ) => {
18
- DashTable . getCell ( 0 , 1 )
19
- . within ( ( ) => cy . get ( '.cell-value' ) . should ( 'have.html' , 'MODIFIED' ) ) ;
20
- } ) ;
12
+ DOM . focused . type ( Key . Shift , { release : false } ) ;
13
+ DashTable . getCell ( 2 , 0 ) . click ( ) ;
14
+
15
+ DOM . focused . type ( `${ Key . Meta } c` ) ;
16
+ DashTable . getCell ( 3 , 0 ) . click ( ) ;
17
+ DOM . focused . type ( `${ Key . Meta } v` ) ;
18
+ DashTable . getCell ( 0 , 0 ) . click ( ) ;
19
+
20
+ for ( let row = 0 ; row <= 2 ; ++ row ) {
21
+ DashTable . getCell ( row + 3 , 0 ) . within ( ( ) => cy . get ( '.cell-value' ) . should ( 'have.html' , `${ row } ` ) ) ;
22
+ }
23
+ } ) ;
24
+
25
+ it ( 'can copy multiple rows and columns' , ( ) => {
26
+ DashTable . getCell ( 0 , 1 ) . click ( ) ;
27
+ DOM . focused . type ( Key . Shift , { release : false } ) ;
28
+ DashTable . getCell ( 2 , 2 ) . click ( ) ;
29
+
30
+ DOM . focused . type ( `${ Key . Meta } c` ) ;
31
+ DashTable . getCell ( 3 , 1 ) . click ( ) ;
32
+ DOM . focused . type ( `${ Key . Meta } v` ) ;
33
+ DashTable . getCell ( 0 , 0 ) . click ( ) ;
34
+
35
+ for ( let row = 0 ; row <= 2 ; ++ row ) {
36
+ for ( let column = 1 ; column <= 2 ; ++ column ) {
37
+ let initialValue : string ;
38
+
39
+ DashTable . getCell ( row , column ) . within ( ( ) => cy . get ( '.cell-value' ) . then ( $cells => initialValue = $cells [ 0 ] . innerHTML ) ) ;
40
+ DashTable . getCell ( row + 3 , column ) . within ( ( ) => cy . get ( '.cell-value' ) . should ( 'have.html' , initialValue ) ) ;
41
+ }
42
+ }
21
43
} ) ;
22
44
23
45
// Commenting this test as Cypress team is having issues with the copy/paste scenario
24
46
// LINK: https://github.com/cypress-io/cypress/issues/2386
25
47
describe ( 'BE roundtrip on copy-paste' , ( ) => {
48
+ it ( 'on cell modification' , ( ) => {
49
+ DashTable . getCell ( 0 , 0 ) . click ( ) ;
50
+ DOM . focused . type ( `10${ Key . Enter } ` ) ;
51
+
52
+ DashTable
53
+ . getCell ( 0 , 0 )
54
+ . within ( ( ) => cy . get ( '.cell-value' ) . should ( 'have.html' , '10' ) )
55
+ . then ( ( ) => {
56
+ DashTable . getCell ( 0 , 1 )
57
+ . within ( ( ) => cy . get ( '.cell-value' ) . should ( 'have.html' , 'MODIFIED' ) ) ;
58
+ } ) ;
59
+ } ) ;
60
+
26
61
it ( 'with unsorted, unfiltered data' , ( ) => {
27
62
DashTable . getCell ( 0 , 0 ) . click ( ) ;
28
63
DOM . focused . type ( `${ Key . Meta } c` ) ;
0 commit comments