Uploaded image for project: 'ZATS'
  1. ZATS
  2. ZATS-30

clicking via agent should ensure blur and focus events are fired accordingly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Normal Normal
    • None
    • None
    • Mimic
    • None

      We wanted to test focus and blur events that happen when user clicks in the input elements.

      Test.java
       // given:
              DesktopAgent desktop =  navigate("/focus.zul");
      
              // when:
              ComponentAgent comboAgent = desktop.query("combobox[id='combo']");
              Combobox combobox = comboAgent.as(Combobox.class);
              comboAgent.click();
      
              ComponentAgent textAgent = desktop.query("textbox[id='text']");
              Textbox textbox = comboAgent.as(Textbox.class);
              textAgent.click();
      
      focus.zul
      <idspace apply="org.zkoss.bind.BindComposer"
                   viewModel="@id('vm') @init('net.nfon.portal.component.FocusComponentsVM')"
                   binder="@init(queueScope='group')">
              <combobox id="combo" onFocus="@command('focus')" onBlur="@command('blur')"/>
              <textbox id="text"  onFocus="@command('focus')" onBlur="@command('blur')"/>
          </idspace>
      
      FocusComponentsVM.java
       @Command
          public void focus(@ContextParam(ContextType.TRIGGER_EVENT) Event event) {
              System.out.println("focus");
          }
      
          @Command
          public void blur(@ContextParam(ContextType.TRIGGER_EVENT) Event event) {
              System.out.println("blur");
          }
      

      If I call .focus() on ZATS agent - This event is transported but I don't want to manually decide where focus goes.

            Unassigned Unassigned
            kretes kretes
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: