You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by David Roberts <dl...@ukonline.co.uk> on 2008/06/03 11:09:38 UTC

PageTester and Select Component

Hi,

I'm having problems instantiating values into a select component when 
testing forms.  This is my form:

    <t:form t:id="searchForm">
           <t:errors/>
           <t:select id="searchOptions" value="searchType" 
model="searchTypes" validate="required"/>
           <t:textfield t:id="searchString" t:value="searchString"  
validate="required"/>
           <input type="submit" value="Search"/>
    </t:form>

.... and this is the test:

        doc = this.pageTester.renderPage("Search");
        form = doc.getElementById("searchForm");
        fieldValues = new HashMap<String, String>();
        fieldValues.put("searchOptions", "TEL_NO");
        fieldValues.put("searchString", "+443739182931");
        doc = pageTester.submitForm(form, fieldValues);

Basically, the select component value is left as null.   The select is 
backed by an EnumSelectModel:

    public enum SearchType {
        NAME,
        TEL_NO
    }

Any ideas?  thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: PageTester and Select Component

Posted by David Roberts <dl...@ukonline.co.uk>.
Replying to myself again!  Probably a bad sign:

  the problem was this:          id="searchOptions"
  should have been this:        t:id="searchOptions"

funny that it worked in the web page but failed the test.   Anyway, I 
guess that's what the test is for.


David Roberts wrote:
> Hi,
>
> I'm having problems instantiating values into a select component when 
> testing forms.  This is my form:
>
>    <t:form t:id="searchForm">
>           <t:errors/>
>           <t:select id="searchOptions" value="searchType" 
> model="searchTypes" validate="required"/>
>           <t:textfield t:id="searchString" t:value="searchString"  
> validate="required"/>
>           <input type="submit" value="Search"/>
>    </t:form>
>
> .... and this is the test:
>
>        doc = this.pageTester.renderPage("Search");
>        form = doc.getElementById("searchForm");
>        fieldValues = new HashMap<String, String>();
>        fieldValues.put("searchOptions", "TEL_NO");
>        fieldValues.put("searchString", "+443739182931");
>        doc = pageTester.submitForm(form, fieldValues);
>
> Basically, the select component value is left as null.   The select is 
> backed by an EnumSelectModel:
>
>    public enum SearchType {
>        NAME,
>        TEL_NO
>    }
>
> Any ideas?  thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org