[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, AS IS
- Webrat::Link#text uses @element.inner_html
TO BE
- 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 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.
Cheers,
-Bryan
-
MOROHASHI Kyosuke November 17th, 2008 @ 08:51 PM
Hi. I wrote another patch.
It uses both @element.text as text and @element.inner_html as HTML.
As you say, I also think it better way to leave inner_html API for matching with tag (ex.img). It's difficult to desin good API to match image link, but i tryed plain and straight way in my spec("should match img link"). I'd like it to be hint to you.
Thanks.
-
Bryan Helmkamp November 18th, 2008 @ 08:40 PM
- → State changed from awaiting-patch to resolved
Thanks for the well done (and well tested) patch. I've merged it in.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
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
