capybara-ui icon indicating copy to clipboard operation
capybara-ui copied to clipboard

Widgets in the top namespace should be visible to other widgets using #widget

Open david opened this issue 12 years ago • 4 comments

They will be automatically scoped to the current widget

david avatar Sep 20 '13 10:09 david

@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']

adsteel avatar Dec 07 '15 14:12 adsteel

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.

david avatar Dec 07 '15 15:12 david

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?

adsteel avatar Dec 07 '15 15:12 adsteel

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.

david avatar Dec 07 '15 15:12 david