We love using knockout, but need a quick way to "find" elements onscreen using capybara.
Knockout cleans up after itself so that the final rendered nodes have no data-bind attribute.
Is there some way we can get it to (maybe only in test mode config) set attributes on the nodes based on parsed bindings?
There are a million ways to skin this cat, but ultimately, given a page of several input boxes, it would be very handy
to be able to lookup fields in capybara using data we have already supplied in the data-bind attribute.
eg:
<div data-bind="bindme: foo, options: bar">
could render to
<div data-bind-bindme="foo" data-bind-options="bar">
For now I shimmed the value binding to do something similar, but it is hacky, and doesn't cover selects, checked, and any future bindings.
NB! It is no good to me to add a real JS hash to the element nodes. Capybara works on a very "browser" level of interaction, so a real attribute is the best
way forward.
Cheers!