Skip to content

Allow for undefined target element #2186

@BennCon

Description

@BennCon

Undefined elements passed in as a target default to the root element, whilst null works as expected and does not; such that:

assert.dom(null).exists(); // False, "Element <not found> exists"
assert.dom(undefined).exists(); // True, "Element div#root-element exists"

For our usage, we might have an assertion like this:

assert.dom(findAll('.foo')[0]).exists()

Which will currently always return true, even if .foo does not exist (findAll returns [])

This has been raised previously and resolved for null and undefined, see #724, #736
However it looks like it regressed in #2107 for undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions