@@ -20,7 +20,7 @@ test("integration: XMLComposite code", async (t) => {
2020 const moduleInfo = new ModuleInfo ( ) ;
2121 await analyzer . analyze ( ast , name , moduleInfo ) ;
2222 t . deepEqual ( moduleInfo . dependencies , [ "composites/ButtonList.control.xml" ] ,
23- "Dependency should be created from component name" ) ;
23+ "Dependency should be created from composite name" ) ;
2424} ) ;
2525
2626test ( "integration: XMLComposite code without VariableDeclaration" , async ( t ) => {
@@ -38,7 +38,7 @@ test("integration: XMLComposite code without VariableDeclaration", async (t) =>
3838 const moduleInfo = new ModuleInfo ( ) ;
3939 await analyzer . analyze ( ast , name , moduleInfo ) ;
4040 t . deepEqual ( moduleInfo . dependencies , [ "composites/ButtonList.control.xml" ] ,
41- "Dependency should be created from component name" ) ;
41+ "Dependency should be created from composite name" ) ;
4242} ) ;
4343
4444test ( "integration: XMLComposite code with arrow function" , async ( t ) => {
@@ -55,7 +55,7 @@ test("integration: XMLComposite code with arrow function", async (t) => {
5555 const moduleInfo = new ModuleInfo ( ) ;
5656 await analyzer . analyze ( ast , name , moduleInfo ) ;
5757 t . deepEqual ( moduleInfo . dependencies , [ "composites/ButtonList.control.xml" ] ,
58- "Dependency should be created from component name" ) ;
58+ "Dependency should be created from composite name" ) ;
5959} ) ;
6060
6161test ( "integration: XMLComposite code with arrow function with implicit return" , async ( t ) => {
@@ -70,7 +70,36 @@ test("integration: XMLComposite code with arrow function with implicit return",
7070 const moduleInfo = new ModuleInfo ( ) ;
7171 await analyzer . analyze ( ast , name , moduleInfo ) ;
7272 t . deepEqual ( moduleInfo . dependencies , [ "composites/ButtonList.control.xml" ] ,
73- "Dependency should be created from component name" ) ;
73+ "Dependency should be created from composite name" ) ;
74+ } ) ;
75+
76+ test . only ( "integration: XMLComposite code with SpreadElement" , async ( t ) => {
77+ const code = `sap.ui.define([
78+ 'jquery.sap.global', 'sap/ui/core/XMLComposite'],
79+ (jQuery, XMLComposite) => {
80+ const myXMLComposite = {
81+ fragment: "composites.custom.ButtonList"
82+ };
83+ return XMLComposite.extend("composites.ButtonList", {
84+ ...myXMLComposite
85+ });
86+ });` ;
87+
88+
89+ const ast = parseJS ( code ) ;
90+
91+ const analyzer = new XMLCompositeAnalyzer ( ) ;
92+ const name = "composites.ButtonList" ;
93+ const moduleInfo = new ModuleInfo ( ) ;
94+ await analyzer . analyze ( ast , name , moduleInfo ) ;
95+
96+ t . deepEqual ( moduleInfo . dependencies , [ "composites/ButtonList.control.xml" ] ,
97+ "Dependency should be created from composite name because overriden by the 'fragment' property " +
98+ " is not possible to lacking SpreadElement support" ) ;
99+
100+ // TODO: Support SpreadElement
101+ // t.deepEqual(moduleInfo.dependencies, ["composites/custom/ButtonList.control.xml"],
102+ // "Dependency should be created from composite name");
74103} ) ;
75104
76105test ( "analyze: not an XMLComposite module" , async ( t ) => {
0 commit comments