diff --git a/src/sap.uxap/src/sap/uxap/ObjectPageSubSection.js b/src/sap.uxap/src/sap/uxap/ObjectPageSubSection.js index c55b32389863..8bd48f3534bc 100644 --- a/src/sap.uxap/src/sap/uxap/ObjectPageSubSection.js +++ b/src/sap.uxap/src/sap/uxap/ObjectPageSubSection.js @@ -660,6 +660,7 @@ sap.ui.define([ containerHeight = Math.ceil(parseFloat(defaultSectionHeight)); oDom.style.height = (contentHeight > containerHeight) ? "" : defaultSectionHeight; + this._height = oDom.style.height; } }; diff --git a/src/sap.uxap/test/sap/uxap/qunit/ObjectPageSubSection.qunit.js b/src/sap.uxap/test/sap/uxap/qunit/ObjectPageSubSection.qunit.js index 6454d7e758f8..77a449b123fa 100644 --- a/src/sap.uxap/test/sap/uxap/qunit/ObjectPageSubSection.qunit.js +++ b/src/sap.uxap/test/sap/uxap/qunit/ObjectPageSubSection.qunit.js @@ -19,8 +19,9 @@ sap.ui.define([ "sap/m/Label", "sap/m/Panel", "sap/m/Text", + "sap/m/Title", "sap/ui/core/HTML"], -function($, Core, Control, coreLibrary, XMLView, Log, Lib, ObjectPageDynamicHeaderTitle, ObjectPageSection, ObjectPageSectionBase, ObjectPageSubSectionClass, BlockBase, ObjectPageLayout, library, App, Button, Label, Panel, Text, HTML) { +function($, Core, Control, coreLibrary, XMLView, Log, Lib, ObjectPageDynamicHeaderTitle, ObjectPageSection, ObjectPageSectionBase, ObjectPageSubSectionClass, BlockBase, ObjectPageLayout, library, App, Button, Label, Panel, Text, Title, HTML) { "use strict"; var TitleLevel = coreLibrary.TitleLevel; @@ -980,6 +981,7 @@ function($, Core, Control, coreLibrary, XMLView, Log, Lib, ObjectPageDynamicHead }) ] }), + oApp = new App({pages: [opl]}), oSpy = this.spy(Log, "error"), oSetParentSpy, done = assert.async(); @@ -1000,11 +1002,11 @@ function($, Core, Control, coreLibrary, XMLView, Log, Lib, ObjectPageDynamicHead assert.strictEqual(oSubSection.getBlocks().length, 2, "ObjectPageSubSection has two controls in 'blocks' aggregation"); done(); oSubSection.removeAllDependents(); - opl.destroy(); + oApp.destroy(); } }); - new App({pages: [opl]}).placeAt("qunit-fixture"); + oApp.placeAt("qunit-fixture"); Core.applyChanges(); }); @@ -1605,6 +1607,42 @@ function($, Core, Control, coreLibrary, XMLView, Log, Lib, ObjectPageDynamicHead }, this); }); + QUnit.test("height of single subSection with sapUxAPObjectPageSubSectionFitContainer adjusts with headerTitle adjusments", function(assert) { + var oPage = this.oObjectPage, + oSection = this.oObjectPage.getSections()[0], + oSubSection = oSection.getSubSections()[0], + oBlock = oSubSection.getBlocks()[0], + done = assert.async(); + + assert.expect(2); + + //act + oBlock.setHeight("845px"); + oPage.setHeaderTitle(new ObjectPageDynamicHeaderTitle({ + heading: new Title({ text: "Title" }) + })); + Core.applyChanges(); + oSubSection.addStyleClass(ObjectPageSubSectionClass.FIT_CONTAINER_CLASS); + + //setup + oPage.attachEventOnce("onAfterRenderingDOMReady", function() { + //check + var sHeight = oSubSection._height; + assert.strictEqual(sHeight, "", "Height is auto when content is bigger than SubSection's height"); + + //act + oPage.destroyHeaderTitle(); + + oPage.attachEventOnce("onAfterRenderingDOMReady", function () { + var sNewHeight = oSubSection._height; + assert.ok(sHeight !== sNewHeight, "Fixed height is changed when headerTitle is added/removed"); + + done(); + }); + Core.applyChanges(); + }, this); + }); + QUnit.test("sapUxAPObjectPageSubSectionFitContainer class can be added late", function (assert) { var oPage = this.oObjectPage, oSection = this.oObjectPage.getSections()[0],