cypress-dragndrop-kit 1.0.5 → 1.0.7

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.
Files changed (2) hide show
  1. package/README.md +25 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -25,12 +25,25 @@ 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
+ | Command | Type | Description |
29
+ | --- | --- | --- |
30
+ | `dragTo(targetElementLocator, options)` | `Child command` | Custom child command for dragging and dropping a chained element to a specified element location |
31
+ | `dragAndDrop(sourceElementLocator, targetElementLocator, options)` | `Parent command` | Custom command for dragging and dropping from one element location to another |
32
+
33
+
34
+ <br/>
35
+
36
+ ### ⚙️ Command Options
37
+
38
+ The `options` input parameter is an optional object for handling specific cases related to the drag-and-drop functionality.
39
+
40
+ | Option | Type | Default | Description |
41
+ | --- | --- | --- | --- |
42
+ | `pressDelay` | `number` | `0` | Time delay (in milliseconds) after mouse down event, before initiating the dragging of the element. Useful for simulating long-press behavior |
30
43
 
31
44
  <br/>
32
45
 
33
- ### ⚙️ Examples
46
+ ### 📘 Examples
34
47
 
35
48
  ```typescript
36
49
  // Usage of "dragTo(target)"
@@ -48,10 +61,18 @@ it('should be able to drag and drop an item by using "dragAndDrop()"', () => {
48
61
  cy.get('[data-id="47"]').should('have.attr', 'data-index', 3);
49
62
  cy.get('[data-id="3"]').should('have.attr', 'data-index', 4);
50
63
  })
64
+
65
+ // Usage of "dragTo(target, { pressDelay })"
66
+ it('should be able to drag and drop an item after a 2 second delay by using "dragTo()"', () => {
67
+ cy.get('[data-id="47"]').dragTo('[data-id="3"]', { pressDelay: 2000 });
68
+
69
+ cy.get('[data-id="47"]').should('have.attr', 'data-index', 3);
70
+ cy.get('[data-id="3"]').should('have.attr', 'data-index', 4);
71
+ })
51
72
  ```
52
73
 
53
74
  <br/>
54
75
 
55
76
  ## 🤝 Contributing
56
77
 
57
- Contributions are welcome! If you have ideas, bugs, or feature requests—feel free to open an issue or submit a pull request.
78
+ Contributions are welcome! If you have ideas, bugs, or feature requests—feel free to open an issue or submit a pull request.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-dragndrop-kit",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Custom command meant for interacting with draggable elements in the UI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types.d.ts",