Skip to content

Commit

Permalink
fix: multi-combo-box handling
Browse files Browse the repository at this point in the history
fixes #354 

Co-authored-by: dominik.feininger <[email protected]>
  • Loading branch information
dominikfeininger and dominikfeininger committed Oct 26, 2022
1 parent e0423ca commit 3432687
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
5 changes: 4 additions & 1 deletion client-side-js/injectUI5.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ async function clientSide_injectUI5(config, waitForUI5Timeout, browserInstance)
}
return aControls.map((element) => {
// just use the absolute ID of the control
if (controlType === "sap.m.ComboBox" && element.data("InputWithSuggestionsListItem")) {
if (
(controlType === "sap.m.ComboBox" || controlType === "sap.m.MultiComboBox") &&
element.data("InputWithSuggestionsListItem")
) {
return {
id: element.data("InputWithSuggestionsListItem").getId()
}
Expand Down
8 changes: 4 additions & 4 deletions docs/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ In VS Code, use a `jsconfig.json` at the root of your JavaScript-project, at the

See an example at `/examples/ui5-js-app/jsconfig.json` in the wdi5 repository.

## test a `sap.m.ComboBox`
## test a `sap.m.ComboBox` `sap.m.MultiComboBox`

A `sap.m.ComboBox`'s items will only be rendered when it's opened (once).
A `sap.m.ComboBox`'or `sap.m.MultiComboBox`s items will only be rendered when it's opened (once).
So for programmatically working and testing the control, its' `.open()`-method needs to be used:

```js
Expand Down Expand Up @@ -262,8 +262,8 @@ The `interaction` can be any one of: `root`, `focus`, `press`, `auto` (default),

Located element for each case:

- **`root`**: the root DOM element of the control
Use this with many controls having an `items` aggregation (such as `sap.m.List`) in order to select the List itself, not the first element of the control.
- **`root`**: the root DOM element of the control
Use this with many controls having an `items` aggregation (such as `sap.m.List`) in order to select the List itself, not the first element of the control.
See the `listSelector` in `examples/ui5-js-app/webapp/test/e2e/generated-methods.test.js` for an example:

```js
Expand Down
8 changes: 8 additions & 0 deletions examples/ui5-js-app/webapp/test/e2e/prop-array.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,12 @@ describe("ui5 property array test", () => {
const aSelectedKeys = await oMultiComboBox.getSelectedKeys()
expect(aSelectedKeys.length).toEqual(2)
})

it("get text from items list", async () => {
const oMultiComboBox = await browser.asControl(multiComboBoxSelector)
await oMultiComboBox.open()
const items = await oMultiComboBox.getItems()
const firstItemText = await items[2].getTitle()
expect(firstItemText).toEqual("Australia")
})
})

0 comments on commit 3432687

Please sign in to comment.