From a24bfbc47e624a9e2a0d251ac5b8c61f77a63667 Mon Sep 17 00:00:00 2001 From: Matthias Osswald Date: Wed, 9 Jan 2019 21:51:36 +0100 Subject: [PATCH] [INTERNAL] XMLTemplateAnalyzer: Add test with property data binding See: https://github.com/SAP/ui5-builder/issues/108 See: https://github.com/SAP/ui5-builder/pull/130 --- test/lib/lbt/analyzer/XMLTemplateAnalyzer.js | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/lib/lbt/analyzer/XMLTemplateAnalyzer.js b/test/lib/lbt/analyzer/XMLTemplateAnalyzer.js index 92e25e5d7..7c216d9b1 100644 --- a/test/lib/lbt/analyzer/XMLTemplateAnalyzer.js +++ b/test/lib/lbt/analyzer/XMLTemplateAnalyzer.js @@ -33,6 +33,31 @@ test("integration: Analysis of an xml view", async (t) => { "Implicit dependency should be added since an XMLView is analyzed"); }); +test("integration: Analysis of an xml view with data binding in properties", async (t) => { + const xml = ` + + `; + const mockPool = {async findResource(name) { + return { + buffer: () => name.endsWith(".xml") ? JSON.stringify(xml): "test" + }; + }}; + + const moduleInfo = new ModuleInfo(); + + const analyzer = new XMLTemplateAnalyzer(mockPool); + await analyzer.analyzeView(xml, moduleInfo); + t.deepEqual(moduleInfo.dependencies, + [ + "sap/ui/core/mvc/XMLView.js", + "myController.controller.js", + "sap/ui/core/ComponentContainer.js" + ], "Dependencies should come from the XML template"); + t.true(moduleInfo.isImplicitDependency("sap/ui/core/mvc/XMLView.js"), + "Implicit dependency should be added since an XMLView is analyzed"); +}); + test("integration: Analysis of an xml fragment", async (t) => { const xml = `