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

bug: mock-doc Node.contains is not inclusive #3149

Closed
3 tasks done
kevinleedrum opened this issue Nov 19, 2021 · 1 comment
Closed
3 tasks done

bug: mock-doc Node.contains is not inclusive #3149

kevinleedrum opened this issue Nov 19, 2021 · 1 comment

Comments

@kevinleedrum
Copy link
Contributor

Prerequisites

Stencil Version

2.10.0

Current Behavior

In unit tests, myNode.contains(myNode) is returning false.

Expected Behavior

myNode.contains(myNode) should return true.

Steps to Reproduce

Create a simple unit test like this:

const el = document.createElement('div');
expect(el.contains(el)).toBe(true);

The test will fail, but it should pass. The spec says that the passed node should be checked against "inclusive descendants". The "inclusive" part means that it should include the object (the parent node) itself when comparing.

You can see the correct behavior in the console:
image

Code Reproduction URL

https://codesandbox.io/s/stencil-mock-node-contains-test-kcwn2?file=/src/nodeContains.spec.ts

Additional Information

I can probably submit a PR for this shortly. I don't see any tests for the mock Node implementation, by the way, or I would update the test.

@ionitron-bot ionitron-bot bot added the triage label Nov 19, 2021
@ionitron-bot ionitron-bot bot removed triage labels Dec 2, 2021
@rwaskiewicz rwaskiewicz added Bug: Validated This PR or Issue is verified to be a bug within Stencil and removed Bug: Needs Validation labels Dec 6, 2021
@rwaskiewicz rwaskiewicz added Resolution: Shipped and removed Bug: Validated This PR or Issue is verified to be a bug within Stencil labels Dec 13, 2021
@rwaskiewicz
Copy link
Contributor

This fix has been included in the v2.12.0 release. I'm going to close this issue, however if the problem reappears, please feel free to open a new issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants