You need to sign in to do that
Don't have an account?
MattMet86
VF - How do you test apex:selectList ?
How do you simulate the action of changing the value in a selectlist element for a test class?
<apex:pageBlockSectionItem > <apex:outputText value="Benefits Filter: " /> <apex:selectList value="{!benefitType}" size="1"> <apex:selectOptions value="{!benefitTypes}" /> <apex:actionSupport event="onchange" action="{!loadESBs}" rerender="Detail" status="status"/> </apex:selectList> </apex:pageBlockSectionItem>
You can directly assign value to benefitType variable and then call the loadESBs() method in test class.
Like:
Suppose your controller is ABC:
ABC obj = new ABC();
obj.benefitType = 'value 1'
obj. loadESBs();// for one value
obj.benefitType = 'value 2'
obj. loadESBs();// for another value
and so on.
Thanks,
Pankaj