0

in our program we have a directive that occurs multiple times with an input field. Our code looks something like this

<li>
    <label>AMI</label>
    <div class="searchbox" searchbox="" filter="search.ami">
        <form ng-submit="doFilter()" class="ng-pristine ng-valid">
            <input class="span12 ng-pristine ng-valid" type="text" placeholder="" ng-model="filter">        
        </form>    
    </div>
</li>

<li>
    <label>Username</label>
    <div class="searchbox" searchbox="" filter="search.username">
            <form ng-submit="doFilter()" class="ng-pristine ng-valid">
               <input class="span12 ng-pristine ng-valid" type="text" placeholder="" ng-model="filter">    
            </form>    
    </div>
</li>

now using the angular e2e test it says use the "input(name).enter(value)" to input, where the name is the ng-model. If i do this and say "input('filter').enter('foo')" both input fields will get inputted. I can't figure out how to just input one field at a time. How would you do so.

  • That's correct, because even you type manually, when you type in one input, the other input also be populated. Can you try that? It looks they are in the same scope. – zs2020 Aug 15 '13 at 20:56
  • Each form is in it's own directive which has it's own scope. So typing in one will not type in another – Scott Price Aug 15 '13 at 21:24
  • Oh i see, I didn't see the `form` ... – zs2020 Aug 15 '13 at 21:26
  • I figured it out. i need to use using to focus the scope. example using('div[filter="search.username"]').input("filter").enter("foo"); using('div[filter="search.ami"]').input("filter").enter("bar") – Scott Price Aug 15 '13 at 23:18
  • Awesome, please post it as an answer and mark it as the correct answer. – zs2020 Aug 15 '13 at 23:27

1 Answers1

1

I figured it out. i need to use using to focus the scope. example

using('div[filter="search.username"]').input("filter").enter("foo"); using('div[filter="search.ami"]').input("filter").enter("bar")