@openui5/sap.ui.rta 1.120.6 → 1.121.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/.reuse/dep5 +23 -21
  2. package/THIRDPARTY.txt +6 -43
  3. package/package.json +6 -6
  4. package/src/sap/ui/rta/.library +1 -1
  5. package/src/sap/ui/rta/Client.js +1 -1
  6. package/src/sap/ui/rta/RuntimeAuthoring.js +507 -759
  7. package/src/sap/ui/rta/Utils.js +1 -146
  8. package/src/sap/ui/rta/appVariant/AppVariantDialog.js +1 -1
  9. package/src/sap/ui/rta/appVariant/AppVariantManager.js +1 -1
  10. package/src/sap/ui/rta/appVariant/AppVariantUtils.js +3 -3
  11. package/src/sap/ui/rta/appVariant/Utils.js +3 -3
  12. package/src/sap/ui/rta/appVariant/manageApps/webapp/controller/ManageApps.controller.js +5 -3
  13. package/src/sap/ui/rta/appVariant/manageApps/webapp/i18n/i18n_bg.properties +1 -1
  14. package/src/sap/ui/rta/appVariant/manageApps/webapp/i18n/i18n_en_US_saprigi.properties +27 -27
  15. package/src/sap/ui/rta/appVariant/manageApps/webapp/i18n/i18n_et.properties +1 -1
  16. package/src/sap/ui/rta/appVariant/manageApps/webapp/i18n/i18n_fi.properties +1 -1
  17. package/src/sap/ui/rta/appVariant/manageApps/webapp/i18n/i18n_fr.properties +1 -1
  18. package/src/sap/ui/rta/appVariant/manageApps/webapp/i18n/i18n_kk.properties +1 -1
  19. package/src/sap/ui/rta/appVariant/manageApps/webapp/i18n/i18n_lv.properties +1 -1
  20. package/src/sap/ui/rta/appVariant/manageApps/webapp/i18n/i18n_mk.properties +1 -1
  21. package/src/sap/ui/rta/appVariant/manageApps/webapp/i18n/i18n_ru.properties +1 -1
  22. package/src/sap/ui/rta/appVariant/manageApps/webapp/i18n/i18n_th.properties +1 -1
  23. package/src/sap/ui/rta/command/AddIFrame.js +1 -1
  24. package/src/sap/ui/rta/command/AddProperty.js +1 -1
  25. package/src/sap/ui/rta/command/AddXML.js +1 -1
  26. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +3 -3
  27. package/src/sap/ui/rta/command/AppDescriptorCommand.js +1 -1
  28. package/src/sap/ui/rta/command/BaseCommand.js +1 -1
  29. package/src/sap/ui/rta/command/BindProperty.js +1 -1
  30. package/src/sap/ui/rta/command/Combine.js +1 -1
  31. package/src/sap/ui/rta/command/CommandFactory.js +1 -1
  32. package/src/sap/ui/rta/command/CompositeCommand.js +1 -1
  33. package/src/sap/ui/rta/command/ControlVariantConfigure.js +1 -1
  34. package/src/sap/ui/rta/command/ControlVariantSave.js +1 -1
  35. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +7 -5
  36. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +1 -1
  37. package/src/sap/ui/rta/command/ControlVariantSwitch.js +10 -4
  38. package/src/sap/ui/rta/command/CreateContainer.js +1 -1
  39. package/src/sap/ui/rta/command/CustomAdd.js +1 -1
  40. package/src/sap/ui/rta/command/FlexCommand.js +1 -1
  41. package/src/sap/ui/rta/command/LREPSerializer.js +4 -3
  42. package/src/sap/ui/rta/command/LocalReset.js +1 -1
  43. package/src/sap/ui/rta/command/Move.js +1 -1
  44. package/src/sap/ui/rta/command/Property.js +1 -1
  45. package/src/sap/ui/rta/command/Remove.js +1 -1
  46. package/src/sap/ui/rta/command/Rename.js +1 -1
  47. package/src/sap/ui/rta/command/Resize.js +1 -1
  48. package/src/sap/ui/rta/command/Reveal.js +1 -1
  49. package/src/sap/ui/rta/command/Settings.js +1 -1
  50. package/src/sap/ui/rta/command/Split.js +1 -1
  51. package/src/sap/ui/rta/command/Stack.js +23 -1
  52. package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +1 -1
  53. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +1 -1
  54. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +1 -1
  55. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +1 -1
  56. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +1 -1
  57. package/src/sap/ui/rta/enablement/elementActionTest.js +180 -258
  58. package/src/sap/ui/rta/library.js +3 -2
  59. package/src/sap/ui/rta/messagebundle.properties +8 -0
  60. package/src/sap/ui/rta/messagebundle_ar.properties +4 -0
  61. package/src/sap/ui/rta/messagebundle_bg.properties +5 -1
  62. package/src/sap/ui/rta/messagebundle_ca.properties +4 -0
  63. package/src/sap/ui/rta/messagebundle_cnr.properties +5 -1
  64. package/src/sap/ui/rta/messagebundle_cs.properties +4 -0
  65. package/src/sap/ui/rta/messagebundle_cy.properties +8 -4
  66. package/src/sap/ui/rta/messagebundle_da.properties +4 -0
  67. package/src/sap/ui/rta/messagebundle_de.properties +5 -1
  68. package/src/sap/ui/rta/messagebundle_el.properties +4 -0
  69. package/src/sap/ui/rta/messagebundle_en.properties +4 -0
  70. package/src/sap/ui/rta/messagebundle_en_GB.properties +4 -0
  71. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +322 -318
  72. package/src/sap/ui/rta/messagebundle_es.properties +4 -0
  73. package/src/sap/ui/rta/messagebundle_es_MX.properties +5 -1
  74. package/src/sap/ui/rta/messagebundle_et.properties +6 -2
  75. package/src/sap/ui/rta/messagebundle_fi.properties +4 -0
  76. package/src/sap/ui/rta/messagebundle_fr.properties +5 -1
  77. package/src/sap/ui/rta/messagebundle_fr_CA.properties +4 -0
  78. package/src/sap/ui/rta/messagebundle_hi.properties +4 -0
  79. package/src/sap/ui/rta/messagebundle_hr.properties +6 -2
  80. package/src/sap/ui/rta/messagebundle_hu.properties +4 -0
  81. package/src/sap/ui/rta/messagebundle_id.properties +5 -1
  82. package/src/sap/ui/rta/messagebundle_it.properties +10 -6
  83. package/src/sap/ui/rta/messagebundle_iw.properties +9 -5
  84. package/src/sap/ui/rta/messagebundle_ja.properties +4 -0
  85. package/src/sap/ui/rta/messagebundle_kk.properties +4 -0
  86. package/src/sap/ui/rta/messagebundle_ko.properties +4 -0
  87. package/src/sap/ui/rta/messagebundle_lt.properties +5 -1
  88. package/src/sap/ui/rta/messagebundle_lv.properties +11 -7
  89. package/src/sap/ui/rta/messagebundle_mk.properties +15 -11
  90. package/src/sap/ui/rta/messagebundle_ms.properties +5 -1
  91. package/src/sap/ui/rta/messagebundle_nl.properties +4 -0
  92. package/src/sap/ui/rta/messagebundle_no.properties +4 -0
  93. package/src/sap/ui/rta/messagebundle_pl.properties +5 -1
  94. package/src/sap/ui/rta/messagebundle_pt.properties +4 -0
  95. package/src/sap/ui/rta/messagebundle_pt_PT.properties +4 -0
  96. package/src/sap/ui/rta/messagebundle_ro.properties +8 -4
  97. package/src/sap/ui/rta/messagebundle_ru.properties +5 -1
  98. package/src/sap/ui/rta/messagebundle_sh.properties +5 -1
  99. package/src/sap/ui/rta/messagebundle_sk.properties +4 -0
  100. package/src/sap/ui/rta/messagebundle_sl.properties +7 -3
  101. package/src/sap/ui/rta/messagebundle_sr.properties +6 -2
  102. package/src/sap/ui/rta/messagebundle_sv.properties +4 -0
  103. package/src/sap/ui/rta/messagebundle_th.properties +9 -5
  104. package/src/sap/ui/rta/messagebundle_tr.properties +7 -3
  105. package/src/sap/ui/rta/messagebundle_uk.properties +5 -1
  106. package/src/sap/ui/rta/messagebundle_vi.properties +4 -0
  107. package/src/sap/ui/rta/messagebundle_zh_CN.properties +5 -1
  108. package/src/sap/ui/rta/messagebundle_zh_TW.properties +6 -2
  109. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +16 -11
  110. package/src/sap/ui/rta/plugin/BaseCreate.js +1 -1
  111. package/src/sap/ui/rta/plugin/Combine.js +1 -1
  112. package/src/sap/ui/rta/plugin/CompVariant.js +43 -1
  113. package/src/sap/ui/rta/plugin/ControlVariant.js +3 -2
  114. package/src/sap/ui/rta/plugin/CreateContainer.js +1 -1
  115. package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
  116. package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
  117. package/src/sap/ui/rta/plugin/EasyAdd.js +2 -2
  118. package/src/sap/ui/rta/plugin/EasyRemove.js +1 -1
  119. package/src/sap/ui/rta/plugin/LocalReset.js +1 -1
  120. package/src/sap/ui/rta/plugin/Plugin.js +18 -10
  121. package/src/sap/ui/rta/plugin/RTAElementMover.js +1 -1
  122. package/src/sap/ui/rta/plugin/Remove.js +1 -1
  123. package/src/sap/ui/rta/plugin/Rename.js +1 -1
  124. package/src/sap/ui/rta/plugin/RenameHandler.js +2 -2
  125. package/src/sap/ui/rta/plugin/Resize.js +1 -1
  126. package/src/sap/ui/rta/plugin/Selection.js +24 -9
  127. package/src/sap/ui/rta/plugin/Settings.js +17 -15
  128. package/src/sap/ui/rta/plugin/Split.js +1 -1
  129. package/src/sap/ui/rta/plugin/Stretch.js +14 -13
  130. package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +1 -1
  131. package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +1 -1
  132. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +134 -67
  133. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
  134. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +6 -2
  135. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +2 -2
  136. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.fragment.xml +57 -47
  137. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +21 -8
  138. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialogController.js +56 -41
  139. package/src/sap/ui/rta/service/Action.js +1 -1
  140. package/src/sap/ui/rta/service/ControllerExtension.js +1 -1
  141. package/src/sap/ui/rta/service/Outline.js +22 -18
  142. package/src/sap/ui/rta/service/Property.js +1 -1
  143. package/src/sap/ui/rta/service/Selection.js +1 -1
  144. package/src/sap/ui/rta/service/SupportTools.js +23 -19
  145. package/src/sap/ui/rta/toolbar/Adaptation.js +16 -18
  146. package/src/sap/ui/rta/toolbar/Base.js +1 -1
  147. package/src/sap/ui/rta/toolbar/Fiori.js +1 -1
  148. package/src/sap/ui/rta/toolbar/FioriLike.js +1 -1
  149. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
  150. package/src/sap/ui/rta/toolbar/Personalization.js +1 -1
  151. package/src/sap/ui/rta/toolbar/Standalone.js +1 -1
  152. package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptation.js +1 -1
  153. package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -1
  154. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +12 -5
  155. package/src/sap/ui/rta/util/PluginManager.js +1 -1
  156. package/src/sap/ui/rta/util/PopupManager.js +1 -1
  157. package/src/sap/ui/rta/util/ReloadManager.js +19 -59
  158. package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
  159. package/src/sap/ui/rta/util/ServiceManager.js +193 -0
  160. package/src/sap/ui/rta/util/adaptationStarter.js +1 -1
  161. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +90 -45
  162. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +32 -25
  163. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +98 -132
  164. package/LICENSES/BSD-2-Clause.txt +0 -22
@@ -6,40 +6,42 @@
6
6
  */
7
7
 
8
8
  sap.ui.define([
9
- "sap/ui/core/UIComponent",
10
- "sap/ui/core/ComponentContainer",
11
- "sap/ui/core/Core",
12
9
  "sap/ui/core/mvc/XMLView",
13
- "sap/ui/rta/command/CommandFactory",
14
- "sap/ui/rta/util/changeVisualization/ChangeCategories",
15
- "sap/ui/rta/util/changeVisualization/ChangeVisualization",
10
+ "sap/ui/core/ComponentContainer",
11
+ "sap/ui/core/UIComponent",
16
12
  "sap/ui/dt/DesignTime",
17
13
  "sap/ui/dt/DesignTimeStatus",
18
14
  "sap/ui/dt/OverlayRegistry",
19
- "sap/ui/fl/ChangePersistence",
20
- "sap/ui/model/Model",
21
15
  "sap/ui/fl/registry/Settings",
22
16
  "sap/ui/fl/write/api/PersistenceWriteAPI",
23
17
  "sap/ui/fl/Layer",
18
+ "sap/ui/model/Model",
19
+ "sap/ui/rta/command/CommandFactory",
20
+ "sap/ui/rta/util/changeVisualization/ChangeCategories",
21
+ "sap/ui/rta/util/changeVisualization/ChangeVisualization",
22
+ "sap/ui/qunit/utils/nextUIUpdate",
24
23
  "sap/ui/thirdparty/sinon-4",
24
+ "test-resources/sap/ui/fl/api/FlexTestAPI",
25
+ "test-resources/sap/ui/fl/qunit/FlQUnitUtils",
25
26
  "sap/ui/fl/library" // we have to ensure to load fl, so that change handler gets registered
26
27
  ], function(
27
- UIComponent,
28
- ComponentContainer,
29
- Core,
30
28
  XMLView,
31
- CommandFactory,
32
- ChangeCategories,
33
- ChangeVisualization,
29
+ ComponentContainer,
30
+ UIComponent,
34
31
  DesignTime,
35
32
  DesignTimeStatus,
36
33
  OverlayRegistry,
37
- ChangePersistence,
38
- Model,
39
34
  Settings,
40
35
  PersistenceWriteAPI,
41
36
  Layer,
42
- sinon
37
+ Model,
38
+ CommandFactory,
39
+ ChangeCategories,
40
+ ChangeVisualization,
41
+ nextUIUpdate,
42
+ sinon,
43
+ FlexTestAPI,
44
+ FlQUnitUtils
43
45
  ) {
44
46
  "use strict";
45
47
 
@@ -55,7 +57,7 @@ sap.ui.define([
55
57
  * E.g. <code>elementActionTest.only("Remove");</code>
56
58
  *
57
59
  * @author SAP SE
58
- * @version 1.120.6
60
+ * @version 1.121.0
59
61
  *
60
62
  * @static
61
63
  * @since 1.42
@@ -100,7 +102,7 @@ sap.ui.define([
100
102
  viewContent: mOptions.xmlView
101
103
  };
102
104
  }
103
- var sandbox = sinon.createSandbox();
105
+ const sandbox = sinon.createSandbox();
104
106
 
105
107
  mOptions.before ||= function() {};
106
108
  mOptions.after ||= function() {};
@@ -117,7 +119,7 @@ sap.ui.define([
117
119
  assert.ok(mOptions.xmlView,
118
120
  "then you provide an XML view to test on: See the.xmlView parameter.");
119
121
 
120
- var oXmlView = new DOMParser().parseFromString(mOptions.xmlView.viewContent, "application/xml").documentElement;
122
+ const oXmlView = new DOMParser().parseFromString(mOptions.xmlView.viewContent, "application/xml").documentElement;
121
123
  assert.ok(oXmlView.tagName.match("View$"), "then you use the sap.ui.core.mvc View tag as the first tag in your view");
122
124
 
123
125
  assert.ok(mOptions.action, "then you provide an action: See the action parameter.");
@@ -127,10 +129,10 @@ sap.ui.define([
127
129
  });
128
130
  });
129
131
 
130
- var UI_COMPONENT_NAME = "sap.ui.rta.control.enabling.comp";
131
- var SYNC = false;
132
- var ASYNC = true;
133
- var Comp = UIComponent.extend(UI_COMPONENT_NAME, {
132
+ const UI_COMPONENT_NAME = "sap.ui.rta.control.enabling.comp";
133
+ const SYNC = false;
134
+ const ASYNC = true;
135
+ const Comp = UIComponent.extend(UI_COMPONENT_NAME, {
134
136
  metadata: {
135
137
  interfaces: ["sap.ui.core.IAsyncContentCreation"],
136
138
  manifest: {
@@ -141,7 +143,7 @@ sap.ui.define([
141
143
  }
142
144
  },
143
145
  createContent() {
144
- var mViewSettings = Object.assign({}, mOptions.xmlView);
146
+ const mViewSettings = Object.assign({}, mOptions.xmlView);
145
147
  mViewSettings.id = this.createId("view");
146
148
 
147
149
  if (mViewSettings.async === undefined) {
@@ -163,7 +165,7 @@ sap.ui.define([
163
165
  async: bAsync
164
166
  }
165
167
  });
166
- return this.oUiComponent.oViewPromise.then(function() {
168
+ return this.oUiComponent.oViewPromise.then(async function() {
167
169
  // Place component in container and display
168
170
  this.oUiComponentContainer = new ComponentContainer({
169
171
  component: this.oUiComponent,
@@ -177,18 +179,18 @@ sap.ui.define([
177
179
  this.oView.setModel(mOptions.model);
178
180
  }
179
181
 
180
- Core.applyChanges();
182
+ await nextUIUpdate();
181
183
 
182
184
  return mOptions.model && mOptions.model.getMetaModel() && mOptions.model.getMetaModel().loaded();
183
185
  }.bind(this));
184
186
  }
185
187
 
186
188
  function buildAndExecuteCommands(assert) {
187
- var aActions = [].concat(
189
+ const aActions = [].concat(
188
190
  mOptions.previousActions || [],
189
191
  mOptions.action
190
192
  );
191
- var aCommands = [];
193
+ const aCommands = [];
192
194
 
193
195
  return aActions.reduce(function(oLastPromise, oAction) {
194
196
  return oLastPromise
@@ -256,7 +258,7 @@ sap.ui.define([
256
258
  oAggregationDesignTimeMetadata
257
259
  ) {
258
260
  if (Array.isArray(oAction.name)) {
259
- var oAddAction = oElementDesignTimeMetadata.getAction(
261
+ const oAddAction = oElementDesignTimeMetadata.getAction(
260
262
  oAction.name[0],
261
263
  oControl,
262
264
  oAction.name[1]
@@ -276,31 +278,19 @@ sap.ui.define([
276
278
  }
277
279
  }
278
280
 
279
- function buildCommand(assert, oAction) {
280
- var oTargetControl;
281
- var oControlWithDesigntimeActionDefinition;
282
- var mParameter;
283
- var oElementDesignTimeMetadata;
284
- var oAggregationDesignTimeMetadata;
285
- var sCommandName = oAction.name;
286
- var oMovedElement;
287
- return Promise.resolve()
288
- .then(getControlFromActionMap.bind(this, oAction))
289
-
290
- .then(function(oRetrievedControl) {
291
- oTargetControl = oRetrievedControl;
292
- mParameter = getParameterMap.call(this, oAction.parameter);
293
- return getDesigntimeActionControl.call(this, oAction);
294
- }.bind(this))
295
-
296
- .then(function(oRetrievedControl) {
297
- oControlWithDesigntimeActionDefinition = oRetrievedControl;
298
- return startDesigntime.call(this);
299
- }.bind(this))
300
-
301
- // gather data for the designtime check and the command factory
302
- .then(function() {
303
- var oControlOverlay = OverlayRegistry.getOverlay(oControlWithDesigntimeActionDefinition || oTargetControl);
281
+ async function buildCommand(assert, oAction) {
282
+ try {
283
+ let sCommandName = oAction.name;
284
+ let oAggregationDesignTimeMetadata;
285
+ let oMovedElement;
286
+ let oTargetControl = await getControlFromActionMap.call(this, oAction);
287
+ const mParameter = getParameterMap.call(this, oAction.parameter);
288
+ const oControlWithDesigntimeActionDefinition = await getDesigntimeActionControl.call(this, oAction);
289
+
290
+ await startDesigntime.call(this);
291
+
292
+ // gather data for the designtime check and the command factory
293
+ let oControlOverlay = OverlayRegistry.getOverlay(oControlWithDesigntimeActionDefinition || oTargetControl);
304
294
  if (!oControlOverlay) {
305
295
  throw new Error(
306
296
  `The provided control ${oTargetControl.getId()}does not have any overlay existing during test execution. `
@@ -310,9 +300,8 @@ sap.ui.define([
310
300
  + `the designtime metadata definition for this check.`
311
301
  );
312
302
  }
313
- oElementDesignTimeMetadata = oControlOverlay.getDesignTimeMetadata();
314
- var oResponsibleElement = oElementDesignTimeMetadata.getResponsibleElement(oTargetControl);
315
- var oAggregationOverlay;
303
+ let oElementDesignTimeMetadata = oControlOverlay.getDesignTimeMetadata();
304
+ const oResponsibleElement = oElementDesignTimeMetadata.getResponsibleElement(oTargetControl);
316
305
  if (mOptions.label) {
317
306
  assert.strictEqual(
318
307
  oElementDesignTimeMetadata.getLabel(oTargetControl),
@@ -322,26 +311,26 @@ sap.ui.define([
322
311
  }
323
312
  if (oAction.name === "move") {
324
313
  oMovedElement = mParameter.movedElements[0].element || mParameter.movedElements[0].id;
325
- var oElementOverlay = OverlayRegistry.getOverlay(oMovedElement);
326
- var oRelevantContainer = oElementOverlay.getRelevantContainer();
314
+ const oElementOverlay = OverlayRegistry.getOverlay(oMovedElement);
315
+ const oRelevantContainer = oElementOverlay.getRelevantContainer();
327
316
  oTargetControl = oRelevantContainer;
328
317
  oElementDesignTimeMetadata = oElementOverlay.getParentAggregationOverlay().getDesignTimeMetadata();
329
318
  } else if (Array.isArray(oAction.name)) {
330
- var aAddActions = oElementDesignTimeMetadata.getActionDataFromAggregations(
319
+ const aAddActions = oElementDesignTimeMetadata.getActionDataFromAggregations(
331
320
  oAction.name[0],
332
321
  oTargetControl,
333
322
  undefined,
334
323
  oAction.name[1]
335
324
  );
336
- oAggregationOverlay = oControlOverlay.getAggregationOverlay(aAddActions[0].aggregation);
325
+ const oAggregationOverlay = oControlOverlay.getAggregationOverlay(aAddActions[0].aggregation);
337
326
  oElementDesignTimeMetadata = oAggregationOverlay.getDesignTimeMetadata();
338
327
  sCommandName = "addDelegateProperty";
339
328
  } else if (oAction.name === "createContainer" || oAction.name === "addIFrame") {
340
- var aCreateContainerActions = oElementDesignTimeMetadata.getActionDataFromAggregations(
329
+ const aCreateContainerActions = oElementDesignTimeMetadata.getActionDataFromAggregations(
341
330
  oAction.name,
342
331
  oControlWithDesigntimeActionDefinition || oTargetControl
343
332
  );
344
- oAggregationOverlay = oControlOverlay.getAggregationOverlay(aCreateContainerActions[0].aggregation);
333
+ const oAggregationOverlay = oControlOverlay.getAggregationOverlay(aCreateContainerActions[0].aggregation);
345
334
  oAggregationDesignTimeMetadata = oAggregationOverlay.getDesignTimeMetadata();
346
335
  } else if (oResponsibleElement) {
347
336
  if (oAction.name === "reveal") {
@@ -349,7 +338,7 @@ sap.ui.define([
349
338
  oControlOverlay = OverlayRegistry.getOverlay(oAction.revealedElement(this.oView));
350
339
  oElementDesignTimeMetadata = oControlOverlay.getDesignTimeMetadata();
351
340
  if (oAction.label) {
352
- var oRevealAction = oElementDesignTimeMetadata.getAction("reveal");
341
+ const oRevealAction = oElementDesignTimeMetadata.getAction("reveal");
353
342
  assert.strictEqual(oRevealAction.getLabel(oTargetControl), oAction.label,
354
343
  "then the control label is correct");
355
344
  }
@@ -360,13 +349,10 @@ sap.ui.define([
360
349
  oTargetControl.getMetadata().loadDesignTime(oTargetControl);
361
350
  }
362
351
  }
363
- }.bind(this))
364
352
 
365
- .then(function() {
366
353
  // additional check if the required action definition exists
367
354
  // into the responsible control designtime metadata
368
- return checkDesigntimeMetadata.call(
369
- this,
355
+ checkDesigntimeMetadata(
370
356
  assert,
371
357
  oAction,
372
358
  oTargetControl,
@@ -374,34 +360,28 @@ sap.ui.define([
374
360
  oElementDesignTimeMetadata,
375
361
  oAggregationDesignTimeMetadata
376
362
  );
377
- }.bind(this))
378
363
 
379
- .then(function() {
380
- var oCommandFactory = new CommandFactory({
364
+ const oCommandFactory = new CommandFactory({
381
365
  flexSettings: {
382
366
  layer: mOptions.layer || Layer.CUSTOMER
383
367
  }
384
368
  });
385
- return oCommandFactory.getCommandFor(
369
+ const oCommand = await oCommandFactory.getCommandFor(
386
370
  oTargetControl,
387
371
  sCommandName,
388
372
  mParameter,
389
373
  oElementDesignTimeMetadata
390
374
  );
391
- })
392
375
 
393
- .then(function(oCommand) {
394
376
  assert.ok(
395
377
  oCommand,
396
378
  `then the registration for action to change type, the registration for change and ` +
397
379
  `control type to change handler is available and ${mOptions.action.name} is a valid action`
398
380
  );
399
381
  return oCommand;
400
- })
401
-
402
- .catch(function(oMessage) {
382
+ } catch (oMessage) {
403
383
  throw new Error(oMessage);
404
- });
384
+ }
405
385
  }
406
386
 
407
387
  function executeCommands(aCommands) {
@@ -412,7 +392,7 @@ sap.ui.define([
412
392
  }
413
393
 
414
394
  function undoCommands(aCommands) {
415
- var aUndoCommands = aCommands.slice().reverse();
395
+ const aUndoCommands = aCommands.slice().reverse();
416
396
  return aUndoCommands.reduce(function(oLastPromise, oCommand) {
417
397
  return oLastPromise
418
398
  .then(oCommand.undo.bind(oCommand));
@@ -420,13 +400,13 @@ sap.ui.define([
420
400
  }
421
401
 
422
402
  function destroyCommands(aCommands) {
423
- aCommands.forEach(function(oCommand) {
403
+ aCommands.forEach((oCommand) => {
424
404
  oCommand.destroy();
425
405
  });
426
406
  }
427
407
 
428
- function condenseCommands(oView, aCommands, assert) {
429
- var oReturn = {
408
+ async function condenseCommands(oView, aCommands, assert) {
409
+ const oReturn = {
430
410
  remainingCommands: [],
431
411
  deletedCommands: []
432
412
  };
@@ -437,96 +417,85 @@ sap.ui.define([
437
417
  return Promise.resolve(oReturn);
438
418
  }
439
419
 
440
- var aChanges = aCommands.map(function(oCommand) {
441
- return oCommand.getPreparedChange();
442
- });
443
- return PersistenceWriteAPI._condense({
420
+ const aChanges = aCommands.map((oCommand) => oCommand.getPreparedChange());
421
+ const aCondensedChanges = await PersistenceWriteAPI._condense({
444
422
  selector: oView,
445
423
  changes: aChanges
446
- }).then(function(aCondensedChanges) {
447
- if (mOptions.changesAfterCondensing !== undefined) {
448
- assert.equal(
449
- aCondensedChanges.length,
450
- mOptions.changesAfterCondensing,
451
- "after condensing the amount of changes is correct"
452
- );
424
+ });
425
+ if (mOptions.changesAfterCondensing !== undefined) {
426
+ assert.equal(
427
+ aCondensedChanges.length,
428
+ mOptions.changesAfterCondensing,
429
+ "after condensing the amount of changes is correct"
430
+ );
431
+ }
432
+ const aChangeIds = aCondensedChanges.map((oChange) => oChange.getId());
433
+ aCommands.forEach((oCommand) => {
434
+ if (aChangeIds.indexOf(oCommand.getPreparedChange().getId()) > -1) {
435
+ oReturn.remainingCommands.push(oCommand);
436
+ } else {
437
+ oReturn.deletedCommands.push(oCommand);
453
438
  }
454
- var aChangeIds = aCondensedChanges.map(function(oChange) {return oChange.getId();});
455
- aCommands.forEach(function(oCommand) {
456
- if (aChangeIds.indexOf(oCommand.getPreparedChange().getId()) > -1) {
457
- oReturn.remainingCommands.push(oCommand);
458
- } else {
459
- oReturn.deletedCommands.push(oCommand);
460
- }
461
- });
462
- return oReturn;
463
439
  });
440
+ return oReturn;
464
441
  }
465
442
 
466
- function checkChangeVisualization(oView, aCommands, assert) {
443
+ async function checkChangeVisualization(oView, aCommands, assert) {
467
444
  if (!mOptions.changeVisualization) {
468
- return Promise.resolve();
445
+ return;
469
446
  }
470
447
 
471
- var oChangeVisualizationInput;
448
+ let oChangeVisualizationInput;
472
449
  if (typeof mOptions.changeVisualization === "function") {
473
450
  oChangeVisualizationInput = mOptions.changeVisualization(oView);
474
451
  } else {
475
452
  oChangeVisualizationInput = mOptions.changeVisualization;
476
453
  }
477
454
 
478
- var oChangeVisualization = new ChangeVisualization({
455
+ const oChangeVisualization = new ChangeVisualization({
479
456
  rootControlId: oView.getId(),
480
457
  isActive: true
481
458
  });
482
459
 
483
460
  sandbox.stub(oChangeVisualization, "_updateChangeIndicators");
484
- var aChanges = aCommands.map(function(oCommand) {
485
- return oCommand.getPreparedChange();
486
- });
461
+ const aChanges = aCommands.map((oCommand) => oCommand.getPreparedChange());
487
462
  sandbox.stub(oChangeVisualization, "_collectChanges").resolves(aChanges);
488
463
 
489
- return oChangeVisualization._updateChangeRegistry()
490
- .then(function() {
491
- return oChangeVisualization._selectChangeCategory(ChangeCategories.ALL);
492
- })
493
- .then(function() {
494
- var oChangeIndicatorRegistry = oChangeVisualization._oChangeIndicatorRegistry;
495
- var oData = oChangeIndicatorRegistry.getSelectorsWithRegisteredChanges();
496
- var sDisplayElementId = oChangeVisualizationInput.displayElementId;
497
- var sSelector = sDisplayElementId ? oView.createId(sDisplayElementId) : oView.getId();
498
- assert.ok(oData[sSelector] && oData[sSelector].length, "there is a change indicator at the correct element");
499
- var oRegisteredChange = oChangeIndicatorRegistry.getAllRegisteredChanges()[0];
500
- var mVisualizationInfo = oChangeVisualizationInput.info;
501
-
502
- function mapIds(aIds) {
503
- return aIds.map(function(sId) {
504
- return oView.createId(sId);
505
- });
506
- }
464
+ await oChangeVisualization._updateChangeRegistry();
465
+ await oChangeVisualization._selectChangeCategory(ChangeCategories.ALL);
466
+ const oChangeIndicatorRegistry = oChangeVisualization._oChangeIndicatorRegistry;
467
+ const oData = oChangeIndicatorRegistry.getSelectorsWithRegisteredChanges();
468
+ const sDisplayElementId = oChangeVisualizationInput.displayElementId;
469
+ const sSelector = sDisplayElementId ? oView.createId(sDisplayElementId) : oView.getId();
470
+ assert.ok(oData[sSelector] && oData[sSelector].length, "there is a change indicator at the correct element");
471
+ const oRegisteredChange = oChangeIndicatorRegistry.getAllRegisteredChanges()[0];
472
+ const mVisualizationInfo = oChangeVisualizationInput.info;
473
+
474
+ function mapIds(aIds) {
475
+ return aIds.map((sId) => oView.createId(sId));
476
+ }
507
477
 
508
- if (mVisualizationInfo) {
509
- if (mVisualizationInfo.affectedControls) {
510
- var aAffectedControlIds = mapIds(mVisualizationInfo.affectedControls);
511
- assert.deepEqual(aAffectedControlIds, oRegisteredChange.visualizationInfo.affectedElementIds,
512
- "then the affected control ids are correct");
513
- }
514
- if (mVisualizationInfo.dependentControls) {
515
- var aDependentControlIds = mapIds(mVisualizationInfo.dependentControls);
516
- assert.deepEqual(aDependentControlIds, oRegisteredChange.visualizationInfo.dependentElementIds,
517
- "then the dependent control ids are correct");
518
- }
519
- if (mVisualizationInfo.displayControls) {
520
- var aDisplayControlIds = mapIds(mVisualizationInfo.displayControls);
521
- assert.deepEqual(aDisplayControlIds, oRegisteredChange.visualizationInfo.displayElementIds,
522
- "then the display control ids are correct");
523
- }
524
- if (mVisualizationInfo.descriptionPayload) {
525
- assert.deepEqual(mVisualizationInfo.descriptionPayload, oRegisteredChange.visualizationInfo.descriptionPayload,
526
- "then the descriptionPayload is correct");
527
- }
478
+ if (mVisualizationInfo) {
479
+ if (mVisualizationInfo.affectedControls) {
480
+ const aAffectedControlIds = mapIds(mVisualizationInfo.affectedControls);
481
+ assert.deepEqual(aAffectedControlIds, oRegisteredChange.visualizationInfo.affectedElementIds,
482
+ "then the affected control ids are correct");
528
483
  }
529
- });
484
+ if (mVisualizationInfo.dependentControls) {
485
+ const aDependentControlIds = mapIds(mVisualizationInfo.dependentControls);
486
+ assert.deepEqual(aDependentControlIds, oRegisteredChange.visualizationInfo.dependentElementIds,
487
+ "then the dependent control ids are correct");
488
+ }
489
+ if (mVisualizationInfo.displayControls) {
490
+ const aDisplayControlIds = mapIds(mVisualizationInfo.displayControls);
491
+ assert.deepEqual(aDisplayControlIds, oRegisteredChange.visualizationInfo.displayElementIds,
492
+ "then the display control ids are correct");
493
+ }
494
+ if (mVisualizationInfo.descriptionPayload) {
495
+ assert.deepEqual(mVisualizationInfo.descriptionPayload, oRegisteredChange.visualizationInfo.descriptionPayload,
496
+ "then the descriptionPayload is correct");
497
+ }
498
+ }
530
499
  }
531
500
 
532
501
  /**
@@ -538,9 +507,9 @@ sap.ui.define([
538
507
  * @return {Promise} resolves when cleanup after undo is done
539
508
  */
540
509
  function cleanUpAfterUndo(aCommands) {
541
- var aPromises = [];
510
+ const aPromises = [];
542
511
  aCommands.forEach(function(oCommand) {
543
- var oChange = oCommand.getPreparedChange();
512
+ const oChange = oCommand.getPreparedChange();
544
513
  if (oCommand.getAppComponent) {
545
514
  aPromises.push(PersistenceWriteAPI.remove({change: oChange, selector: oCommand.getAppComponent()}));
546
515
  }
@@ -548,38 +517,38 @@ sap.ui.define([
548
517
  return Promise.all(aPromises);
549
518
  }
550
519
 
551
- function applyChangeOnXML(assert) {
552
- // Stub LREP access to have the command as UI change (needs the view to build the correct ids)
553
- var aChanges = [];
554
- sandbox.stub(ChangePersistence.prototype, "getChangesForView").resolves(aChanges);
555
-
556
- return createViewInComponent.call(this, SYNC)
557
- .then(buildCommandsAndApplyChangesOnXML.bind(this, assert, aChanges));
520
+ async function applyChangeOnXML(assert) {
521
+ await createViewInComponent.call(this, SYNC);
522
+ await buildCommandsAndApplyChangesOnXML.call(this, assert);
558
523
  }
559
524
 
560
- function buildCommandsAndApplyChangesOnXML(assert, aChanges) {
561
- var aActions = [].concat(
525
+ function buildCommandsAndApplyChangesOnXML(assert) {
526
+ const aActions = [].concat(
562
527
  mOptions.previousActions || [],
563
528
  mOptions.action
564
529
  );
565
- var aCommands = [];
530
+ const aCommands = [];
531
+ let oAppComponent;
566
532
 
567
533
  return aActions.reduce(function(oLastPromise, oAction) {
568
534
  return oLastPromise
569
535
  .then(buildCommand.bind(this, assert, oAction))
570
536
  .then(function(oCommand) {
571
537
  aCommands.push(oCommand);
572
- aChanges.push(oCommand.getPreparedChange());
538
+ oAppComponent = oCommand.getAppComponent();
573
539
 
574
540
  // Destroy and recreate component and view to get the changes applied
575
541
  // Wait for each change to be applied individually to allow dependencies
576
542
  // between changes of different actions
577
543
  this.oUiComponentContainer.destroy();
544
+ PersistenceWriteAPI.add({change: oCommand.getPreparedChange(), selector: oAppComponent});
578
545
  return createViewInComponent.call(this, ASYNC);
579
546
  }.bind(this));
580
547
  }.bind(this), Promise.resolve())
581
548
  .then(function() {
582
549
  this.aCommands = aCommands;
550
+ const aChanges = aCommands.map((oCommand) => oCommand.getPreparedChange());
551
+ return PersistenceWriteAPI.remove({flexObjects: aChanges, selector: oAppComponent});
583
552
  }.bind(this));
584
553
  }
585
554
 
@@ -593,73 +562,45 @@ sap.ui.define([
593
562
  after(assert) {
594
563
  return mOptions.after.call(this.hookContext, assert);
595
564
  },
596
- beforeEach() {
565
+ async beforeEach() {
566
+ await FlQUnitUtils.initializeFlexStateWithData(sandbox, UI_COMPONENT_NAME, {changes: []});
597
567
  sandbox.stub(Settings, "getInstance").resolves({_oSettings: {}});
598
568
  },
599
569
  afterEach() {
600
570
  this.oUiComponentContainer.destroy();
601
571
  this.oDesignTime.destroy();
602
572
  destroyCommands(this.aCommands);
573
+ FlexTestAPI.reset();
603
574
  sandbox.restore();
604
575
  }
605
576
  }, function() {
606
- QUnit.test("When applying the change directly on the XMLView", function(assert) {
607
- return applyChangeOnXML.call(this, assert)
608
-
609
- .then(function() {
610
- return checkChangeVisualization(this.oView, this.aCommands, assert);
611
- }.bind(this))
612
-
613
- .then(function() {
614
- // Verify that UI change has been applied on XML view
615
- return mOptions.afterAction(this.oUiComponent, this.oView, assert);
616
- }.bind(this));
577
+ QUnit.test("When applying the change directly on the XMLView", async function(assert) {
578
+ await applyChangeOnXML.call(this, assert);
579
+ await checkChangeVisualization(this.oView, this.aCommands, assert);
580
+ // Verify that UI change has been applied on XML view
581
+ await mOptions.afterAction(this.oUiComponent, this.oView, assert);
617
582
  });
618
583
 
619
- QUnit.test("When executing on XML and reverting the change in JS (e.g. variant switch)", function(assert) {
620
- return applyChangeOnXML.call(this, assert)
621
-
622
- .then(function() {
623
- return undoCommands(this.aCommands);
624
- }.bind(this))
625
-
626
- .then(function() {
627
- return cleanUpAfterUndo(this.aCommands);
628
- }.bind(this))
629
-
630
- .then(function() {
631
- Core.applyChanges();
632
- mOptions.afterUndo(this.oUiComponent, this.oView, assert);
633
- }.bind(this));
584
+ QUnit.test("When executing on XML and reverting the change in JS (e.g. variant switch)", async function(assert) {
585
+ await applyChangeOnXML.call(this, assert);
586
+ await undoCommands(this.aCommands);
587
+ await cleanUpAfterUndo(this.aCommands);
588
+ await nextUIUpdate();
589
+ await mOptions.afterUndo(this.oUiComponent, this.oView, assert);
634
590
  });
635
591
 
636
- QUnit.test("When executing on XML, reverting the change in JS (e.g. variant switch) and applying again", function(assert) {
637
- return applyChangeOnXML.call(this, assert)
638
-
639
- .then(function() {
640
- // condensing has to be done before the changes are reverted
641
- return condenseCommands(this.oView, this.aCommands, assert);
642
- }.bind(this))
643
-
644
- .then(function(mCommands) {
645
- this.aRemainingCommands = mCommands.remainingCommands;
646
-
647
- return undoCommands(this.aCommands);
648
- }.bind(this))
649
-
650
- .then(function() {
651
- return cleanUpAfterUndo(this.aCommands);
652
- }.bind(this))
653
-
654
- .then(function() {
655
- // this should have the same effect as executing all the commands
656
- return executeCommands(this.aRemainingCommands);
657
- }.bind(this))
592
+ QUnit.test("When executing on XML, reverting the change in JS (e.g. variant switch) and applying again", async function(assert) {
593
+ await applyChangeOnXML.call(this, assert);
594
+ // condensing has to be done before the changes are reverted
595
+ const mCommands = await condenseCommands(this.oView, this.aCommands, assert);
596
+ this.aRemainingCommands = mCommands.remainingCommands;
658
597
 
659
- .then(function() {
660
- Core.applyChanges();
661
- mOptions.afterRedo(this.oUiComponent, this.oView, assert);
662
- }.bind(this));
598
+ await undoCommands(this.aCommands);
599
+ await cleanUpAfterUndo(this.aCommands);
600
+ // this should have the same effect as executing all the commands
601
+ await executeCommands(this.aRemainingCommands);
602
+ await nextUIUpdate();
603
+ await mOptions.afterRedo(this.oUiComponent, this.oView, assert);
663
604
  });
664
605
  });
665
606
  }
@@ -681,9 +622,8 @@ sap.ui.define([
681
622
  after(assert) {
682
623
  return mOptions.after.call(this.hookContext, assert);
683
624
  },
684
- beforeEach(assert) {
685
- // no LREP response needed
686
- sandbox.stub(ChangePersistence.prototype, "getChangesForComponent").returns(Promise.resolve([]));
625
+ async beforeEach(assert) {
626
+ await FlQUnitUtils.initializeFlexStateWithData(sandbox, UI_COMPONENT_NAME, {changes: []});
687
627
  sandbox.stub(Settings, "getInstance").returns(Promise.resolve({_oSettings: {}}));
688
628
 
689
629
  return createViewInComponent.call(this, SYNC)
@@ -696,58 +636,40 @@ sap.ui.define([
696
636
  this.oDesignTime.destroy();
697
637
  this.oUiComponentContainer.destroy();
698
638
  destroyCommands(this.aCommands);
639
+ FlexTestAPI.reset();
699
640
  sandbox.restore();
700
641
  }
701
642
  }, function() {
702
- QUnit.test("When executing the underlying command on the control at runtime", function(assert) {
703
- return waitForDtSync(this.oDesignTime)
704
-
705
- .then(function() {
706
- return checkChangeVisualization(this.oView, this.aCommands, assert);
707
- }.bind(this))
708
-
709
- .then(function() {
710
- Core.applyChanges();
711
- return mOptions.afterAction(this.oUiComponent, this.oView, assert);
712
- }.bind(this));
643
+ QUnit.test("When executing the underlying command on the control at runtime", async function(assert) {
644
+ await waitForDtSync(this.oDesignTime);
645
+ await checkChangeVisualization(this.oView, this.aCommands, assert);
646
+ await nextUIUpdate();
647
+ await mOptions.afterAction(this.oUiComponent, this.oView, assert);
713
648
  });
714
649
 
715
- QUnit.test("When executing and undoing the command", function(assert) {
716
- return waitForDtSync(this.oDesignTime)
717
-
718
- .then(undoCommands.bind(null, this.aCommands))
719
-
720
- .then(cleanUpAfterUndo.bind(null, this.aCommands))
721
-
722
- .then(function() {
723
- Core.applyChanges();
724
- return mOptions.afterUndo(this.oUiComponent, this.oView, assert);
725
- }.bind(this));
650
+ QUnit.test("When executing and undoing the command", async function(assert) {
651
+ await waitForDtSync(this.oDesignTime);
652
+ await undoCommands(this.aCommands);
653
+ await cleanUpAfterUndo(this.aCommands);
654
+ await nextUIUpdate();
655
+ await mOptions.afterUndo(this.oUiComponent, this.oView, assert);
726
656
  });
727
657
 
728
- QUnit.test("When executing, undoing and redoing the command", function(assert) {
729
- return waitForDtSync(this.oDesignTime)
658
+ QUnit.test("When executing, undoing and redoing the command", async function(assert) {
659
+ await waitForDtSync(this.oDesignTime);
730
660
 
731
661
  // condensing has to be done before the changes are reverted
732
- .then(condenseCommands.bind(this, this.oView, this.aCommands, assert))
662
+ const mCommands = await condenseCommands(this.oView, this.aCommands, assert);
663
+ this.aRemainingCommands = mCommands.remainingCommands;
733
664
 
734
- .then(function(mCommands) {
735
- this.aRemainingCommands = mCommands.remainingCommands;
736
-
737
- return undoCommands(this.aCommands);
738
- }.bind(this))
665
+ await undoCommands(this.aCommands);
666
+ await cleanUpAfterUndo(this.aCommands);
739
667
 
740
- .then(cleanUpAfterUndo.bind(null, this.aCommands))
668
+ // this should have the same effect as executing all the commands
669
+ await executeCommands(this.aRemainingCommands);
741
670
 
742
- .then(function() {
743
- // this should have the same effect as executing all the commands
744
- return executeCommands(this.aRemainingCommands);
745
- }.bind(this))
746
-
747
- .then(function() {
748
- Core.applyChanges();
749
- return mOptions.afterRedo(this.oUiComponent, this.oView, assert);
750
- }.bind(this));
671
+ await nextUIUpdate();
672
+ await mOptions.afterRedo(this.oUiComponent, this.oView, assert);
751
673
  });
752
674
  });
753
675
  }