-
Bug
-
Resolution: Won't Fix
-
Normal
-
None
-
None
-
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.