Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Version Checks #200

Merged
merged 3 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions client-side-js/_navTo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@ async function clientSide__navTo(sComponentId, sName, oParameters, oComponentTar
window.wdi5.Log.info(`[browser wdi5] navigation to ${sName} triggered`)

const router = sap.ui.getCore().getComponent(sComponentId).getRouter()
const hashChanger =
parseFloat(sap.ui.version) < 1.75
? sap.ui.core.routing.HashChanger.getInstance()
: router.getHashChanger()
const hashChanger = window.compareVersions.compare("1.75.0", sap.ui.version, ">")
? sap.ui.core.routing.HashChanger.getInstance()
: router.getHashChanger()

// on success result is the router
hashChanger.attachEvent("hashChanged", (oEvent) => {
done(["success", parseFloat(sap.ui.version) < 1.75 ? hashChanger.getHash() : hashChanger.hash])
done([
"success",
window.compareVersions.compare("1.75.0", sap.ui.version, ">")
? hashChanger.getHash()
: hashChanger.hash
])
})

// get component and trigger router
// sName, oParameters?, oComponentTargetInfo?, bReplace?
router.navTo(sName, oParameters, oComponentTargetInfo, bReplace)
return parseFloat(sap.ui.version) < 1.75 ? hashChanger.getHash() : hashChanger.hash
return window.compareVersions.compare("1.75.0", sap.ui.version, ">")
? hashChanger.getHash()
: hashChanger.hash
})
},
sComponentId,
Expand Down
6 changes: 5 additions & 1 deletion client-side-js/injectUI5.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ async function clientSide_injectUI5(config, waitForUI5Timeout) {
const isRootProperty =
oSelector.bindingPath.propertyPath &&
oSelector.bindingPath.propertyPath.charAt(0) === "/"
if (hasNamedModel && isRootProperty && parseFloat(sap.ui.version) < 1.81) {
if (
hasNamedModel &&
isRootProperty &&
window.compareVersions.compare("1.81.0", sap.ui.version, ">")
) {
// attach the double leading /
// for UI5 < 1.81
oSelector.bindingPath.propertyPath = `/${oSelector.bindingPath.propertyPath}`
Expand Down
11 changes: 1 addition & 10 deletions client-side-js/interactWithControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,7 @@ async function clientSide_interactWithControl(oOptions) {
.then(() => {
window.wdi5.Log.info("[browser wdi5] locating controlSelector")
oOptions.selector = window.wdi5.createMatcher(oOptions.selector)
if (parseFloat(sap.ui.version) <= 1.6) {
// implementing legacy api < 1.60
window.bridge.findDOMElementByControlSelector(oOptions).then((control, arg) => {
const ui5Control = window.wdi5.getUI5CtlForWebObj(control)
oOptions.control = ui5Control
return window.bridge.interactWithControl(oOptions)
})
} else {
return window.bridge.interactWithControl(oOptions)
}
return window.bridge.interactWithControl(oOptions)
})
.then((result) => {
window.wdi5.Log.info("[browser wdi5] interaction complete! - Message: " + result)
Expand Down