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

Unexpected behavior with HTML entities #1341

Closed
amccloud opened this issue Jun 19, 2014 · 1 comment
Closed

Unexpected behavior with HTML entities #1341

amccloud opened this issue Jun 19, 2014 · 1 comment

Comments

@amccloud
Copy link

en:
  intro: "This is just an example to show unexpected results"
<h1><%= I18n.t('intro').html_safe %></h1>
expect(page).to have_content I18n.t('intro').html_safe
Failure/Error: expect(page).to have_content I18n.t('intro').html_safe
  expected to find text "This is just an example&nbsp;to show unexpected results"
  in "This is just an example to show unexpected results"

Should have_content, have_text, and anything that deals with a text node decode or strip HTML entities?

@twalpole
Copy link
Member

Nope -- The documentation from has_text? which have_text is a matcher based on states -

Checks if the page or current node has the given text content,

ignoring any HTML tags and normalizing whitespace.

This is referring to stripping the tags and normalizing whitespace of the page contents,
and is behaving exactly as designed, and is designed to match what the user would actually see on the page.

carols10cents added a commit to carols10cents/rstat.us that referenced this issue Oct 7, 2014
This way, we're getting text as the user would see it.
See: teamcapybara/capybara#1341
carols10cents added a commit to carols10cents/rstat.us that referenced this issue Oct 8, 2014
This way, we're getting text as the user would see it.
See: teamcapybara/capybara#1341
@lock lock bot locked and limited conversation to collaborators Aug 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants