Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: FEST-Swing 1.2a1
-
Fix Version/s: FEST-Swing 1.2a4
-
Component/s: Swing
-
Labels:None
-
Number of attachments :
Description
From Jeanette:
It took me a while to register that implementations of selectItem actually simulate a mouse click - and a little while more that it's doing so only if the item/index is not yet selected. Which I think is doing too much: finer-grained "item-oriented" click API would come nice in cases where the differentiation of real-click and selection-by-click is needed.
An example: assume a combo with open popup, selected index and want to test correct action firing if user clicks into the already selected item:
// before finding selectItem: action fired listFixture.item(selectedIndex).click(MouseClickInfo.leftButton()); // after finding selectItem, assuming same-enough as click // unexpected - action not fired listFixture.selectItem(selectedIndex) // possible future with item-oriented click listFixture.clickItem(selectedIndex)
The api is already there (with additional parameters but anyway): public on the level of the driver and package private on the fixture itself. So it should be low-impact (as low as adding to an interface can be <g> ) to add on the ItemGroupFixture or at least on the concrete ListFixture.
JListFixture clickItem(int index) JListFixture clickItem(String text)
alternative could be to add a parameter to the selectItem variants
which controls if the click happens always or only if not yet
selected.
For now, I implemented clickItem in JListFixture only. I need to figure out if it would be useful to have this method in JComboBoxFixture