Skip to content

Commit 167251e

Browse files
committed
[INTERNAL] mvc.ControllerExtension: add support for the new "overrides"
Tests are adapted to the new name, but a copy of the main tests still checks the old property "override". Change-Id: I559c2f6aa79f8ef022052effc60d504f10127fa5
1 parent afa5f0b commit 167251e

16 files changed

Lines changed: 838 additions & 20 deletions

src/sap.ui.core/src/sap/ui/core/mvc/ControllerMetadata.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ sap.ui.define([
3737
ControllerMetadata.prototype.constructor = ControllerMetadata;
3838

3939
ControllerMetadata.prototype.applySettings = function(oClassInfo) {
40-
// property 'override' needs to be handled separately and must not be attached to the prototype
41-
if (oClassInfo.override) {
42-
this._override = oClassInfo.override;
40+
// property 'overrides' needs to be handled separately and must not be attached to the prototype
41+
if (oClassInfo.overrides || oClassInfo.override) { // also consider the deprecated 'override' property
42+
this._override = oClassInfo.overrides || oClassInfo.override; // ...but only when the new property is not set
4343
delete oClassInfo.override;
44+
delete oClassInfo.overrides;
4445
}
4546

4647
Metadata.prototype.applySettings.call(this, oClassInfo);

src/sap.ui.core/test/sap/ui/core/demokit/sample/ControllerExtension/OtherCustomerExtension.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ sap.ui.define([
3737
oMyOwnButtonFromExtension.setText(sText);
3838
},
3939

40-
override: {
40+
overrides: {
4141
//Override controller method; this is the second extension, so this override will win
4242
getToolbarTitle: function(){
4343
return "OtherExtension Table Operations:";

src/sap.ui.core/test/sap/ui/core/qunit/component/testdata/customizing/customer/Sub2ControllerExtension.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ sap.ui.define(['sap/ui/core/mvc/ControllerExtension'],
1313
customerAction: function() {
1414
customSub2ControllerCalled();
1515
},
16-
override: {
16+
overrides: {
1717
onInit: function() {
1818
aLifeCycleCalls.push("Sub2ControllerExtension Controller onInit()");
1919
},

src/sap.ui.core/test/sap/ui/core/qunit/component/testdata/customizing/customer/Sub6AnotherControllerExtension.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ sap.ui.define(['sap/ui/core/mvc/ControllerExtension'],
1212
}
1313
},
1414

15-
override: {
15+
overrides: {
1616
onInit: function() {
1717
oLifecycleSpy("Sub6AnotherControllerExtension Controller onInit()");
1818
},

src/sap.ui.core/test/sap/ui/core/qunit/component/testdata/customizing/customer/Sub6ControllerExtension.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ sap.ui.define(['sap/ui/core/mvc/ControllerExtension'],
1212
}
1313
},
1414

15-
override: {
15+
overrides: {
1616
onInit: function() {
1717
oLifecycleSpy("Sub6ControllerExtension Controller onInit()");
1818
},

src/sap.ui.core/test/sap/ui/core/qunit/component/testdata/customizing/customer/Sub6InstanceSpecificControllerExtension.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sap.ui.define(['sap/ui/core/mvc/ControllerExtension'],
1111
}
1212
},
1313

14-
override: {
14+
overrides: {
1515
onInit: function() {
1616
oLifecycleSpy("Sub6InstanceSpecificControllerExtension Controller onInit()");
1717
},

src/sap.ui.core/test/sap/ui/core/qunit/component/testdata/customizing/customersub/Sub2SubControllerExtension.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ sap.ui.define(['sap/ui/core/mvc/ControllerExtension'],
1212
}
1313
},
1414

15-
override: {
15+
overrides: {
1616

1717
onInit: function() {
1818
aLifeCycleCalls.push("Sub2SubControllerExtension Controller onInit()");

src/sap.ui.core/test/sap/ui/core/qunit/component/testdata/customizing_legacyAPIs/customer/Sub2ControllerExtension.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ sap.ui.define(['sap/ui/core/mvc/ControllerExtension'],
1313
customerAction: function() {
1414
customSub2ControllerCalled();
1515
},
16-
override: {
16+
overrides: {
1717
onInit: function() {
1818
aLifeCycleCalls.push("Sub2ControllerExtension Controller onInit()");
1919
},

src/sap.ui.core/test/sap/ui/core/qunit/component/testdata/customizing_legacyAPIs/customersub/Sub2SubControllerExtension.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ sap.ui.define(['sap/ui/core/mvc/ControllerExtension'],
1212
}
1313
},
1414

15-
override: {
15+
overrides: {
1616

1717
onInit: function() {
1818
aLifeCycleCalls.push("Sub2SubControllerExtension Controller onInit()");

src/sap.ui.core/test/sap/ui/core/qunit/mvc/extensions/Controllerextensions.qunit.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ sap.ui.define([
163163
myAfter: function() {
164164
this.base.overrideCalledAfter = true;
165165
},
166-
override: {
166+
overrides: {
167167
callbackMethod: function() {
168168
return "callbackOfControllerExt1";
169169
}
@@ -286,7 +286,7 @@ sap.ui.define([
286286
},
287287
myAfter: function() {
288288
},
289-
override: {
289+
overrides: {
290290
extHookLegacy: function() {
291291
return "extHookLegacy App implementation";
292292
},
@@ -360,7 +360,7 @@ sap.ui.define([
360360
},
361361
myAfter: function() {
362362
},
363-
override: {
363+
overrides: {
364364
extension: {
365365
"example.ProviderExt1": {
366366
publicMethodToOverride: function() {

0 commit comments

Comments
 (0)