Skip to content

Commit

Permalink
Merge "[FIX] sap.ui.model.base.ManagedObjectModel" into rel-1.56
Browse files Browse the repository at this point in the history
  • Loading branch information
Silkinator authored and Gerrit Code Review committed Jul 3, 2018
2 parents 70c96e0 + cdc3bb5 commit 87690a7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,11 @@ sap.ui.define([

var sPart = aParts[0];

//handling of # for byId case of view
if (oNode.getMetadata().isInstanceOf("sap.ui.core.IDScope") && sPart.indexOf("#") === 0) {
oNode = oNode.byId(sPart.substring(1));
sPart = aParts[1];
}
if (oNode instanceof ManagedObject) {
var oNodeMetadata = oNode.getMetadata(), oProperty = oNodeMetadata.getProperty(sPart);
if (oProperty) {
Expand Down
23 changes: 23 additions & 0 deletions src/sap.ui.core/test/sap/ui/core/qunit/ManagedObjectModel.qunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,5 +750,28 @@ QUnit.test("ManagedObjectModel - Marker interface sap.ui.core.IDScope handling",

assert.ok(oPanel, "There is a panel");
assert.equal(oPanel.getId(),sIdPrefix + "panel","We get the correct panel");

//Check whether observer works on property bindings with ids
var oPropertyBinding = oManagedObjectModel.bindProperty("/#button2/text");
var iPropertyChangeCount = 0;
oPropertyBinding.attachChange(function() {
iPropertyChangeCount++;
});
oButton2.setText("Changed");
assert.equal(iPropertyChangeCount, 1, "Button text property binding change was fired");
assert.equal("Changed", oButton2.getText(), "Button Text was updated");

//Check whether observer works on list bindings with ids
var oListBinding = oManagedObjectModel.bindList("/#panel/content");
var iListChangeCount = 0;
oListBinding.attachChange(function() {
iListChangeCount++;
});
oPanel.removeContent(oButton2);
assert.equal(iListChangeCount, 1, "content list binding change was fired");
oPanel.addContent(oButton2);
assert.equal(iListChangeCount, 2, "content list binding change was fired");


});

0 comments on commit 87690a7

Please sign in to comment.