cypress-dragndrop-kit 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -4
- package/package.json +1 -1
package/README.md
CHANGED
@@ -25,12 +25,22 @@ import 'cypress-dragndrop-kit';
|
|
25
25
|
|
26
26
|
### ✨ Available commands
|
27
27
|
|
28
|
-
- `dragTo(targetElementLocator)`: Custom child command for dragging and dropping a chained element to a specified element location
|
29
|
-
- `dragAndDrop(sourceElementLocator, targetElementLocator)`: Custom command for dragging and dropping from one element location to another
|
28
|
+
- `dragTo(targetElementLocator, options)`: Custom child command for dragging and dropping a chained element to a specified element location
|
29
|
+
- `dragAndDrop(sourceElementLocator, targetElementLocator, options)`: Custom command for dragging and dropping from one element location to another
|
30
30
|
|
31
31
|
<br/>
|
32
32
|
|
33
|
-
### ⚙️
|
33
|
+
### ⚙️ Command Options
|
34
|
+
|
35
|
+
The `options` input parameter is an optional object for handling specific cases related to the drag-and-drop functionality.
|
36
|
+
|
37
|
+
| Option | Type | Default | Description |
|
38
|
+
| --- | --- | --- | --- |
|
39
|
+
| `pressDelay` | `number` | `0` | Time delay (in milliseconds) after mouse down event, before initiating the dragging of the element. Useful for simulating long-press behavior |
|
40
|
+
|
41
|
+
<br/>
|
42
|
+
|
43
|
+
### 📘 Examples
|
34
44
|
|
35
45
|
```typescript
|
36
46
|
// Usage of "dragTo(target)"
|
@@ -48,10 +58,18 @@ it('should be able to drag and drop an item by using "dragAndDrop()"', () => {
|
|
48
58
|
cy.get('[data-id="47"]').should('have.attr', 'data-index', 3);
|
49
59
|
cy.get('[data-id="3"]').should('have.attr', 'data-index', 4);
|
50
60
|
})
|
61
|
+
|
62
|
+
// Usage of "dragTo(target, { pressDelay })"
|
63
|
+
it('should be able to drag and drop an item after a 2 second delay by using "dragTo()"', () => {
|
64
|
+
cy.get('[data-id="47"]').dragTo('[data-id="3"]', { pressDelay: 2000 });
|
65
|
+
|
66
|
+
cy.get('[data-id="47"]').should('have.attr', 'data-index', 3);
|
67
|
+
cy.get('[data-id="3"]').should('have.attr', 'data-index', 4);
|
68
|
+
})
|
51
69
|
```
|
52
70
|
|
53
71
|
<br/>
|
54
72
|
|
55
73
|
## 🤝 Contributing
|
56
74
|
|
57
|
-
Contributions are welcome! If you have ideas, bugs, or feature requests—feel free to open an issue or submit a pull request.
|
75
|
+
Contributions are welcome! If you have ideas, bugs, or feature requests—feel free to open an issue or submit a pull request.
|