From f72c9147d8ba0beebb032f83bb5306e953b4d99e Mon Sep 17 00:00:00 2001 From: Frank Weigel Date: Sun, 29 Dec 2019 22:18:01 +0100 Subject: [PATCH] Fix issue in dependency handling, improve tests --- lib/processors/resourceListCreator.js | 6 +----- .../library.n/dest/resources/library/n/Button-dbg.js | 9 ++++++++- .../library.n/dest/resources/library/n/Button.js | 2 +- .../dest/resources/library/n/resources.json | 12 ++++++++++-- test/fixtures/library.n/src/library/n/Button.js | 9 ++++++++- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/lib/processors/resourceListCreator.js b/lib/processors/resourceListCreator.js index 653a2a845..1f46b713d 100644 --- a/lib/processors/resourceListCreator.js +++ b/lib/processors/resourceListCreator.js @@ -146,10 +146,6 @@ class ResourceInfo { } return result; } - - isEmpty() { - return this.i18nLocale == null && this.i18nName == null && this.isDebug == false && this.theme == null && this.merged == false; - } } /** @@ -412,7 +408,7 @@ class ResourceCollector { resourceInfo.condRequired = resourceInfo.condRequired || new Set(); info.dependencies.forEach((dep) => { if ( info.isConditionalDependency(dep) ) { - resourceInfo.condRequired.push(dep); + resourceInfo.condRequired.add(dep); } else if ( !info.isImplicitDependency(dep) ) { resourceInfo.required.add(dep); } diff --git a/test/expected/build/library.n/dest/resources/library/n/Button-dbg.js b/test/expected/build/library.n/dest/resources/library/n/Button-dbg.js index ca43eff95..274df4a28 100644 --- a/test/expected/build/library.n/dest/resources/library/n/Button-dbg.js +++ b/test/expected/build/library.n/dest/resources/library/n/Button-dbg.js @@ -14,7 +14,7 @@ sap.ui.define([ ) { "use strict"; - return Control.extend("library.n.Button", { + return Control.extend("library.n.Button", { metadata : { library : "library.n", properties : { @@ -44,6 +44,13 @@ sap.ui.define([ oRm.close("span"); oRm.close("button"); } + }, + helper: function(sCalendarType) { + var sCalendar = "sap/ui/core/date/" + sCalendarType; + sap.ui.require(["sap/ui/core/format/DateFormat", sCalendar], function(DateFormat, Calendar) { + DateFormat.getInstance(); + new Calendar(); + }); } }); diff --git a/test/expected/build/library.n/dest/resources/library/n/Button.js b/test/expected/build/library.n/dest/resources/library/n/Button.js index 9b2547fdf..58360358b 100644 --- a/test/expected/build/library.n/dest/resources/library/n/Button.js +++ b/test/expected/build/library.n/dest/resources/library/n/Button.js @@ -3,4 +3,4 @@ * (c) Copyright 2009-xxx SAP SE or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ -sap.ui.define(["./library","sap/ui/core/Control"],function(e,t){"use strict";return t.extend("library.n.Button",{metadata:{library:"library.n",properties:{text:{type:"string",group:"Misc",defaultValue:""}},aggregations:{icon:{type:"sap.ui.core.Control",cardinality:"0..1"}},events:{press:{}}},designtime:"library/n/designtime/Button.designtime",renderer:{apiVersion:2,render:function(e,t){e.openStart("button",t);e.class("libNBtnBase");e.openEnd();if(t.getIcon()){e.renderControl(t.getIcon())}e.openStart("span",t.getId()+"-content");e.class("libNBtnContent");e.openEnd();e.text(sText);e.close("span");e.close("button")}}})}); \ No newline at end of file +sap.ui.define(["./library","sap/ui/core/Control"],function(e,t){"use strict";return t.extend("library.n.Button",{metadata:{library:"library.n",properties:{text:{type:"string",group:"Misc",defaultValue:""}},aggregations:{icon:{type:"sap.ui.core.Control",cardinality:"0..1"}},events:{press:{}}},designtime:"library/n/designtime/Button.designtime",renderer:{apiVersion:2,render:function(e,t){e.openStart("button",t);e.class("libNBtnBase");e.openEnd();if(t.getIcon()){e.renderControl(t.getIcon())}e.openStart("span",t.getId()+"-content");e.class("libNBtnContent");e.openEnd();e.text(sText);e.close("span");e.close("button")}},helper:function(e){var t="sap/ui/core/date/"+e;sap.ui.require(["sap/ui/core/format/DateFormat",t],function(e,t){e.getInstance();new t})}})}); \ No newline at end of file diff --git a/test/expected/build/library.n/dest/resources/library/n/resources.json b/test/expected/build/library.n/dest/resources/library/n/resources.json index da7f5a806..659f88e8f 100644 --- a/test/expected/build/library.n/dest/resources/library/n/resources.json +++ b/test/expected/build/library.n/dest/resources/library/n/resources.json @@ -11,7 +11,11 @@ "required": [ "library/n/library.js", "sap/ui/core/Control.js" - ] + ], + "condRequired": [ + "sap/ui/core/format/DateFormat.js" + ], + "dynRequired": true }, { "name": "Button.js", @@ -19,7 +23,11 @@ "required": [ "library/n/library.js", "sap/ui/core/Control.js" - ] + ], + "condRequired": [ + "sap/ui/core/format/DateFormat.js" + ], + "dynRequired": true }, { "name": "changeHandler/SplitButton-dbg.js", diff --git a/test/fixtures/library.n/src/library/n/Button.js b/test/fixtures/library.n/src/library/n/Button.js index 7259cde38..70f7b4918 100644 --- a/test/fixtures/library.n/src/library/n/Button.js +++ b/test/fixtures/library.n/src/library/n/Button.js @@ -12,7 +12,7 @@ sap.ui.define([ ) { "use strict"; - return Control.extend("library.n.Button", { + return Control.extend("library.n.Button", { metadata : { library : "library.n", properties : { @@ -42,6 +42,13 @@ sap.ui.define([ oRm.close("span"); oRm.close("button"); } + }, + helper: function(sCalendarType) { + var sCalendar = "sap/ui/core/date/" + sCalendarType; + sap.ui.require(["sap/ui/core/format/DateFormat", sCalendar], function(DateFormat, Calendar) { + DateFormat.getInstance(); + new Calendar(); + }); } });