Base property for moduleList nested in a module

29 views
Skip to first unread message

Samuel Rossinovic

unread,
Aug 16, 2017, 5:58:04 AM8/16/17
to Geb User Mailing List
Given this hierarchy:

class ConfirmDialog extends Module{
 
//...}



class CheckboxItem extends Module {
 
static content = {
 label
{ $(".tree-title").text() }
 checkbox
{ $(".tree-checkbox")}
 isChecked
{ $(".tree-checkbox1")}
 
}
}


class CheckboxList extends ConfirmDialog {
 
static content = {
 items
{ moduleList(CheckboxItem)}
 
}
}

I instantiate CheckboxList like so:

def someSelExpr = /* some selector */

$
(someSelExpr).module(CheckboxList)



I want the base for the moduleList to be the same as CheckboxList's (I.E. that the $() selectors in CheckboxItem shall be confined to the subtree rooted at someSelExpr)

Is that how this will work? If not, how do I bend it so that it does?

Thanks!

Marcin Erdmann

unread,
Aug 17, 2017, 2:50:25 AM8/17/17
to geb-...@googlegroups.com
As long as someSelExpr returns a single element navigator the bases for CheckboxItem and CheckboxList will be exactly the same. I suspect it is not the case and someSelExpr returns multiple element navigator (why would you use moduleList otherwise?). In that case the base for CheckboxList will be a multi element navigator and bases for CheckboxItems will be single element navigators that together constitute the elements of CheckboxList base. CheckboxItems will be therefore confined to one of subtrees rooted at someSelExpr.

Does that answer your question?
--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/510f1298-3ab2-4a19-aa45-1de797abb234%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Samuel Rossinovic

unread,
Aug 17, 2017, 7:01:27 AM8/17/17
to Geb User Mailing List
Thanks.
Yes. It answers well. I wanted to make sure I understand this correctly, that CheckBoxItem's content is searched starting from its parent's base downwards.
Indeed my example has an error. CheckboxList will have a content looking more like:

items { $("li").moduleList(CheckboxItem) }

someSelExpr will then be fashioned to return a single-element navigator (e.g. a ul).

Much appreciated!
Reply all
Reply to author
Forward
0 new messages