xeqi / kerodon

interaction and testing library for html based ring apps.
304 stars 22 forks source link

Improve regex? example in README #28

Closed jayp closed 9 years ago

jayp commented 9 years ago

Add (?s) to regex to explicitly indicate to the users that it is needed to match multiline

strika commented 9 years ago

This is useful. As a side note, I find using regexes a bit tedious, coming from Capybara. It would be cool if you could do just:

(has (content? "world"))

that would try to find the content within whole page.

glenjamin commented 9 years ago

@strika (has (text? "world") should be equivalent to that.

Does regex? only do an exact whole-string match? that seems counter intuitive to me, perhaps the default should be changed to just verify that the regex can match any substring.

glenjamin commented 9 years ago

Ok, i've just read up on the other PR - I understand now.

I think it's preferable to get #19 merged and update the examples to use the -in? variants.

jayp commented 9 years ago

Hi @glenjamin - I am all for #19.

As for the request from @strika, I believe text-in? is equivalent to content?. I don't think text? is the same, as it does an exact match. So, double yes for #19.

jayp commented 9 years ago

And yes, regex? only does whole-string matches... as such it doesn't work for multi-line strings (a vast majority of pages!) because . doesn't match newlines by default.

strika commented 9 years ago

Yes, text-in? is what I had in mind.