Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: default x y to 0 when not provided, accept 0 value #642

Merged

Conversation

amoshydra
Copy link
Contributor

@amoshydra amoshydra commented Feb 24, 2024

Note to maintainer: Feel free to modify on top of this PR

Summary

Accept 0 for x and y by checking if the value provided is falsey using == null.

   const position =
-    options.x && options.y
+    options.x == null && options.y == null
       ? { x: options.x, y: options.y }
       : options.touchPosition;

If either x or y is provided, prefill the undefined y or x with 0

   const position =
     options.x == null && options.y == null
-      ? { x: options.x, y: options.y }
+      ? { x: options.x || 0, y: options.y || 0 }
       : options.touchPosition;

This is necessary also as Position require both x and y to be defined:

https://github.com/amoshydra/cypress-real-events/blob/d2c3caa0b3ed73109db04b984d8257a0b653f3a1/src/getCypressElementCoordinates.ts#L1-L11

Related issue

This should resolve #641

Motivation

To allow realSwipe to start at x: 0, y: 0

dmtrKovalenko and others added 11 commits November 2, 2023 23:49
Release 1.11
Bumps [eslint-plugin-cypress](https://github.com/cypress-io/eslint-plugin-cypress) from 2.14.0 to 2.15.1.
- [Release notes](https://github.com/cypress-io/eslint-plugin-cypress/releases)
- [Commits](cypress-io/eslint-plugin-cypress@v2.14.0...v2.15.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-cypress
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [fs-extra](https://github.com/jprichardson/node-fs-extra) from 11.1.1 to 11.2.0.
- [Changelog](https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md)
- [Commits](jprichardson/node-fs-extra@11.1.1...11.2.0)

---
updated-dependencies:
- dependency-name: fs-extra
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
* chore(docs): fix a few typos and issues in realSwipe docs

* feat(realSwipe): add `touchMoveDelay` option

closes dmtrKovalenko#620
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.24.8 to 0.25.8.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](TypeStrong/typedoc@v0.24.8...v0.25.8)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [eslint](https://github.com/eslint/eslint) from 8.48.0 to 8.56.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](eslint/eslint@v8.48.0...v8.56.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…mtrKovalenko#587)

Bumps [typedoc-plugin-markdown](https://github.com/tgreyuk/typedoc-plugin-markdown/tree/HEAD/packages/typedoc-plugin-markdown) from 3.15.3 to 3.17.1.
- [Release notes](https://github.com/tgreyuk/typedoc-plugin-markdown/releases)
- [Changelog](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/packages/typedoc-plugin-markdown/CHANGELOG.md)
- [Commits](https://github.com/tgreyuk/typedoc-plugin-markdown/commits/[email protected]/packages/typedoc-plugin-markdown)

---
updated-dependencies:
- dependency-name: typedoc-plugin-markdown
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Copy link

what-the-diff bot commented Feb 24, 2024

PR Summary

  • Enhanced Handling for Position Variable in realSwipe Command
    In the realSwipe command, improvements have been made to accommodate scenarios where the x and y options are not assigned any value. This ensures the command performs consistently in varied use cases.

dmtrKovalenko and others added 10 commits June 15, 2024 14:55
…a/cypress-real-events into fix/issue-#641-check-x-y-falsey
Bumps [fs-extra](https://github.com/jprichardson/node-fs-extra) from 11.1.1 to 11.2.0.
- [Changelog](https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md)
- [Commits](jprichardson/node-fs-extra@11.1.1...11.2.0)

---
updated-dependencies:
- dependency-name: fs-extra
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [eslint](https://github.com/eslint/eslint) from 8.48.0 to 8.56.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](eslint/eslint@v8.48.0...v8.56.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…mtrKovalenko#587)

Bumps [typedoc-plugin-markdown](https://github.com/tgreyuk/typedoc-plugin-markdown/tree/HEAD/packages/typedoc-plugin-markdown) from 3.15.3 to 3.17.1.
- [Release notes](https://github.com/tgreyuk/typedoc-plugin-markdown/releases)
- [Changelog](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/packages/typedoc-plugin-markdown/CHANGELOG.md)
- [Commits](https://github.com/tgreyuk/typedoc-plugin-markdown/commits/[email protected]/packages/typedoc-plugin-markdown)

---
updated-dependencies:
- dependency-name: typedoc-plugin-markdown
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…a/cypress-real-events into fix/issue-#641-check-x-y-falsey
@dmtrKovalenko dmtrKovalenko merged commit beb4749 into dmtrKovalenko:develop Jun 15, 2024
1 of 2 checks passed
@dmtrKovalenko
Copy link
Owner

🎉 This PR is included in version 1.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@amoshydra amoshydra deleted the fix/issue-#641-check-x-y-falsey branch June 16, 2024 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

realSwipe - x: 0 or y: 0 is incorrectly rejected as being treated as falsey
5 participants