openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

`sap.ui.qunit.utils.nextUIUpdate` and `waitForThemeApplied` recommended as replacements, but not exposed

Open LukasHeimann opened this issue 1 year ago • 1 comments

Prior to UI5 2.0, a couple of methods were deprecated. The jsdoc in OpenUI5, and thus TypeScript types as well as the UI5 linter expose the deprecation notices with hints to replace with alternatives from sap.ui.qunit.utils, i.e.

  • https://github.com/SAP/openui5/blob/4950f1d7fe76e02604ba165c47ce65c72f60b2b2/src/sap.ui.core/src/sap/ui/core/Core.js#L2309-L2310 Core.applyChanges() suggests nextUIUpdate
  • https://github.com/SAP/openui5/blob/4950f1d7fe76e02604ba165c47ce65c72f60b2b2/src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js#L122 QUtils.delayTestStart() suggests waitForThemeApplied

Indeed, those two methods are really useful when writing tests for custom controls. However, these methods are not exposed properly. nextUIUpdate is marked as @public, but waitForThemeApplied is not. Both are not shown on https://ui5.sap.com, and don't appear in the generated types, presumably due to deliberate exclusion at https://github.com/SAP/openui5/blob/4950f1d7fe76e02604ba165c47ce65c72f60b2b2/src/sap.ui.core/src/sap/ui/core/.library#L125

This discussion started at https://github.com/SAP/ui5-typescript/issues/459, but I was redirected here as the types are generated correctly, but the issue is the JSDoc and library configuration. Also, it was noted there that (until now) the two functions were deliberately not released (yet).

  • As a developer, I want to use the recommended replacements for deprecated public functionality in a compliant manner, and thus would like to have the recommended replacements publicly released and documented.
  • As a developer of custom controls, I'd like to use simple promise-based methods to wait for the execution environment to be in the right state -- this especially includes waiting for UI rerendering and themes being applied.

Thus, please consider properly exposing the two methods to end users, both in JSDoc as well as in TypeScript and https://ui5.sap.com.

Thank you very much for your support! Lukas

LukasHeimann avatar Jun 21 '24 11:06 LukasHeimann

Thanks a lot @LukasHeimann for reporting this issue. I have created an internal incident DINC0193814 and the respective team will update the status of the issue here in GitHub.

flovogt avatar Jun 26 '24 13:06 flovogt

Thank you for the fix, looking forward to updating to 1.127 in August!

LukasHeimann avatar Jul 09 '24 15:07 LukasHeimann