#56 ✓resolved

[PATCH] Link#matches_text?() use @element.text

Reported by MOROHASHI Kyosuke | November 17th, 2008 @ 03:25 AM

Hi. Thanx for good library.
I start to use webrat with Cucumber onto my rails project.

I mainly speak Japanese and I have a trouble that Webrat::Link.matches_text?() do'nt recognize Japanese anchor text.

So I wrote a patche to use @element.text that decodes character reference in @element.inner_html.

And I think it's better to be replace,

  • Webrat::Link#text uses @element.inner_html


  • Webrat::Link#text uses @element.text
  • Webrat::Link#inner_html uses @element.inner_html
  • Webrat::Link#matches_text? users both text and inner_html

How do you think? If I get your agree, I'd like to write another patch.

Comments and changes to this ticket

  • Bryan Helmkamp

    Bryan Helmkamp November 17th, 2008 @ 10:18 AM

    • State changed from “new” to “awaiting-patch”

    Thanks for the patch. I agree with your suggestion. I'll set this ticket to "awaiting patch" for now.

    I'm wondering if Link#matches_text? should use inner_html at all, or simply look at the decoded text only. Making that switch would mean another approach is needed to click an image link, for example. Will spend some time thinking about that more over the next couple days. We can worry about that later though.



  • Bryan Helmkamp

    Bryan Helmkamp November 18th, 2008 @ 08:39 PM

    • State changed from “awaiting-patch” to “resolved”

    Thanks for the well done (and well tested) patch. I've merged it in.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket

Referenced by