capybara-ui
capybara-ui copied to clipboard
Widgets in the top namespace should be visible to other widgets using #widget
They will be automatically scoped to the current widget
@david would that look something like this?
# in a role
widget ':top', '.top'
widget ':parent', '.parent', do
widget :child, '.child'
end
# in a Cuke step
widget(:parent).widget(:child).widget(:top).classes #=> ['top']
I think it was something like
class Widget1 < Dill::Widget
end
class Widget2 < Dill::Widget
widget :widget1, Dill::Widget1
end
But this should work, so I don't clearly remember why I added this.
I was working on implementing Capybara's drag_to, and I ran into a similar issue, maybe it had to do with that?
I wanted to implement:
widget :source, '.source'
widget :target, '.target'
widget(:source).drag_to(:target)
The issue I was running into was that because drag_to was a method on the source widget, and both were in the top namespace, I couldn't access the target widget from the source widget. Could that have something to do with it?
It's possible. I think we're resolving the constants with const_get, so maybe there's some setting that should be used to make it see more constants than it does now.