Skip to content

Fix method text to work with other types then strings - #111

Open
pkuczynski wants to merge 1 commit into
chaijs:masterfrom
pkuczynski:patch-1
Open

Fix method text to work with other types then strings#111
pkuczynski wants to merge 1 commit into
chaijs:masterfrom
pkuczynski:patch-1

Conversation

@pkuczynski

@pkuczynski pkuczynski commented Nov 13, 2019

Copy link
Copy Markdown

For the following HTML structure:

<div id="el">123</div>

Such formulated expectation, when called with a number and not a string, will fail because of strict comparison ===

expect($('#el')).to.have.text(123)

My fix ensures that any param for the text() method is converted into a string before comparing it with element text.

@pkuczynski

Copy link
Copy Markdown
Author

@keithamus and @meeber what you think?

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

Successfully merging this pull request may close these issues.

1 participant