diff --git a/package.json b/package.json index 6248eb3cb..285d0528d 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,8 @@ "text-summary" ], "exclude": [ - "lib/processors/jsdoc/lib/**", + "lib/processors/jsdoc/lib/ui5/**", + "lib/processors/jsdoc/lib/createIndexFiles.cjs", "docs/**", "jsdocs/**", "coverage/**", diff --git a/test/expected/build/library.j/dest/test-resources/library/j/designtime/apiref/api.json b/test/expected/build/library.j/dest/test-resources/library/j/designtime/apiref/api.json new file mode 100644 index 000000000..cb36ca1cb --- /dev/null +++ b/test/expected/build/library.j/dest/test-resources/library/j/designtime/apiref/api.json @@ -0,0 +1 @@ +{"$schema-ref":"http://schemas.sap.com/sapui5/designtime/api.json/1.0","version":"1.0.0","library":"library.j","symbols":[{"kind":"namespace","name":"library.j","basename":"j","resource":"library/j/some.js","module":"library/j/some","static":true,"visibility":"public","displayName":"library.j","nodes":[{"name":"library.j.aaa","description":"","href":"api/library.j.aaa"},{"name":"library.j.Foo","description":"

My super documentation of this class

","href":"api/library.j.Foo"}],"title":"namespace library.j","subTitle":""},{"kind":"class","name":"library.j.aaa","basename":"aaa","resource":"library/j/dependency-es6-2.js","module":"library/j/dependency-es6-2","export":"","static":true,"visibility":"public","since":"1.22","extends":"library.j.a","ui5-metamodel":true,"ui5-metadata":{"properties":[{"name":"MyProp","type":"boolean","defaultValue":false,"group":"undefined","visibility":"public","since":"1.46","description":"

MyProp property

Since: 1.46.

","methods":["getMyProp","setMyProp"]}]},"constructor":{"visibility":"public","parameters":[{"name":"sId","optional":true,"description":"

ID for the new control, generated automatically if no ID is given

","phoneName":"sId","depth":0,"types":[{"name":"string","linkEnabled":false}],"defaultValue":""},{"name":"mSettings","optional":true,"description":"

Initial settings for the new control

","phoneName":"mSettings","depth":0,"types":[{"name":"object","linkEnabled":false}],"defaultValue":""}],"description":"

Constructor for a new library.j.aaa.

","references":[],"codeExample":"
new library.j.aaa(sId?, mSettings?)
"},"methods":[{"name":"library.j.aaa.extend","visibility":"public","static":true,"returnValue":{"type":"function","description":"

Created class / constructor function

","types":[{"value":"function"}]},"parameters":[{"name":"sClassName","optional":false,"description":"

Name of the class being created

","types":[{"value":"string"}],"defaultValue":""},{"name":"oClassInfo","optional":true,"description":"

Object literal with information about the class

","types":[{"value":"object"}],"defaultValue":""},{"name":"FNMetaImpl","optional":true,"description":"

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

","types":[{"value":"function"}],"defaultValue":""}],"description":"

Creates a new subclass of class library.j.aaa with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in library.j.a.extend.

","href":"api/library.j.aaa#methods/library.j.aaa.extend","code":"
library.j.aaa.extend(sClassName, oClassInfo?, FNMetaImpl?) : function
"},{"name":"library.j.aaa.getMetadata","visibility":"public","static":true,"returnValue":{"type":"sap.ui.base.Metadata","description":"

Metadata object describing this class

","types":[{"value":"sap.ui.base.Metadata","href":"api/sap.ui.base.Metadata","linkEnabled":true}]},"description":"

Returns a metadata object for class library.j.aaa.

","href":"api/library.j.aaa#methods/library.j.aaa.getMetadata","code":"
library.j.aaa.getMetadata() : sap.ui.base.Metadata
"},{"name":"getMyProp","visibility":"public","since":"1.46","returnValue":{"type":"boolean","description":"

Value of property MyProp

","types":[{"value":"boolean"}]},"description":"

Gets current value of property MyProp.

MyProp property

Default value is false.

","href":"api/library.j.aaa#methods/getMyProp","code":"
getMyProp() : boolean
"},{"name":"setMyProp","visibility":"public","since":"1.46","returnValue":{"type":"this","description":"

Reference to this in order to allow method chaining

","types":[{"value":"this"}]},"parameters":[{"name":"bMyProp","optional":true,"defaultValue":false,"description":"

New value for property MyProp

","types":[{"value":"boolean"}]}],"description":"

Sets a new value for property MyProp.

MyProp property

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

","href":"api/library.j.aaa#methods/setMyProp","code":"
setMyProp(bMyProp?) : this
"}],"displayName":"library.j.aaa","title":"class library.j.aaa","subTitle":""},{"kind":"class","name":"library.j.Foo","basename":"Foo","resource":"library/j/dependency-es6-1.js","module":"library/j/dependency-es6-1","static":true,"visibility":"public","extends":"library.j.Bar","description":"

My super documentation of this class

","constructor":{"visibility":"public","references":[],"codeExample":"
new library.j.Foo()
"},"displayName":"library.j.Foo","title":"class library.j.Foo","subTitle":""},{"name":"library","displayName":"library","kind":"namespace","nodes":[{"name":"library.j","description":"","href":"api/library.j"}],"title":"namespace library","subTitle":""}]} \ No newline at end of file diff --git a/test/lib/builder/builder.js b/test/lib/builder/builder.js index da01e9586..c81f00bfa 100644 --- a/test/lib/builder/builder.js +++ b/test/lib/builder/builder.js @@ -890,8 +890,7 @@ test.serial("Build library.j with JSDoc build only", async (t) => { graph.setTaskRepository(taskRepository); await graph.build({ destPath, - includedTasks: ["generateJsdoc"], - excludedTasks: ["*"] + jsdoc: true }); const expectedFiles = await findFiles(expectedPath); diff --git a/test/lib/processors/jsdoc/lib/transformApiJson.js b/test/lib/processors/jsdoc/lib/transformApiJson.js new file mode 100644 index 000000000..808d37bfe --- /dev/null +++ b/test/lib/processors/jsdoc/lib/transformApiJson.js @@ -0,0 +1,2452 @@ +/* eslint-disable max-len */ +import test from "ava"; +import esmock from "esmock"; +import sinonGlobal from "sinon"; + +test.beforeEach(async (t) => { + t.context.sinon = sinonGlobal.createSandbox(); + t.context.transformApiJson = await esmock("../../../../../lib/processors/jsdoc/lib/transformApiJson.cjs"); +}); + +test.afterEach.always((t) => { + t.context.sinon.restore(); +}); + +test("Basic test without symbols", async (t) => { + const {sinon, transformApiJson} = t.context; + + const apiJsonPath = "/test-resources/sap/ui5/tooling/test/designtime/api.json"; + const fakeTargetPath = "/ignore/this/path/resource/will/be/returned"; + const dotLibraryPath = "/resources/sap/ui5/tooling/test/.library"; + const dependencyApiJsonPaths = []; + + const readFile = sinon.stub().yieldsAsync(new Error("Not found!")); + + readFile.withArgs("/resources/sap/ui5/tooling/test/.library").yieldsAsync(null, ` + + + + sap.ui5.tooling.test + SAP SE + Some copyright notice + 1.2.3 + + UI5 Tooling Test Library + + ` + ); + + readFile.withArgs("/test-resources/sap/ui5/tooling/test/designtime/api.json").yieldsAsync(null, JSON.stringify( + { + "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0", + "version": "2.1.0", + "library": "sap.ui5.tooling.test", + "symbols": [] + } + )); + + const readdir = sinon.stub().yieldsAsync(new Error("Not found!")); + + const fs = {readFile, readdir}; + + const apiJsonContent = await transformApiJson( + apiJsonPath, fakeTargetPath, dotLibraryPath, dependencyApiJsonPaths, "", { + fs, + returnOutputFiles: true + } + ); + + t.deepEqual(JSON.parse(apiJsonContent), { + "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0", + "version": "2.1.0", + "library": "sap.ui5.tooling.test", + "symbols": [] + }); +}); + +test("Reading dependency api.json paths", async (t) => { + const {sinon, transformApiJson} = t.context; + + const apiJsonPath = "/test-resources/sap/ui5/tooling/test/designtime/api.json"; + const fakeTargetPath = "/ignore/this/path/resource/will/be/returned"; + const dotLibraryPath = "/resources/sap/ui5/tooling/test/.library"; + const dependencyApiJsonPaths = [ + "/test-resources/sap/ui/core/designtime/api.json", + "/test-resources/some/library/not/found/api.json" // to test the error case when reading the file + ]; + + const readFile = sinon.stub().yieldsAsync(new Error("Not found!")); + + readFile.withArgs("/test-resources/sap/ui5/tooling/test/designtime/api.json").yieldsAsync(null, JSON.stringify( + { + "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0", + "version": "2.1.0", + "library": "sap.ui5.tooling.test", + "symbols": [] + } + )); + + readFile.withArgs("/test-resources/sap/ui/core/designtime/api.json").yieldsAsync(null, JSON.stringify( + { + "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0", + "version": "1.111.1", + "library": "sap.ui.core", + "symbols": [] + } + )); + + const readdir = sinon.stub().yieldsAsync(new Error("Not found!")); + + const fs = {readFile, readdir}; + + const apiJsonContent = await transformApiJson( + apiJsonPath, fakeTargetPath, dotLibraryPath, dependencyApiJsonPaths, "", { + fs, + returnOutputFiles: true + } + ); + + t.deepEqual(JSON.parse(apiJsonContent), { + "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0", + "version": "2.1.0", + "library": "sap.ui5.tooling.test", + "symbols": [] + }); +}); + +test("Reading dependency api.json paths from directory", async (t) => { + const {sinon, transformApiJson} = t.context; + + const apiJsonPath = "/test-resources/sap/ui5/tooling/test/designtime/api.json"; + const fakeTargetPath = "/ignore/this/path/resource/will/be/returned"; + const dotLibraryPath = "/resources/sap/ui5/tooling/test/.library"; + const dependencyApiJsonPaths = "/api-jsons"; + + const readFile = sinon.stub().yieldsAsync(new Error("Not found!")); + + readFile.withArgs("/test-resources/sap/ui5/tooling/test/designtime/api.json").yieldsAsync(null, JSON.stringify( + { + "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0", + "version": "2.1.0", + "library": "sap.ui5.tooling.test", + "symbols": [] + } + )); + + const readdir = sinon.stub().yieldsAsync(new Error("Not found!")); + + readdir.withArgs("/api-jsons").yieldsAsync(null, ["lib1-api.json", "lib2-api.json"]); + + const fs = {readFile, readdir}; + + const apiJsonContent = await transformApiJson( + apiJsonPath, fakeTargetPath, dotLibraryPath, dependencyApiJsonPaths, "", { + fs, + returnOutputFiles: true + } + ); + + t.deepEqual(JSON.parse(apiJsonContent), { + "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0", + "version": "2.1.0", + "library": "sap.ui5.tooling.test", + "symbols": [] + }); +}); + +test("Test with library, control, enum", async (t) => { + const {sinon, transformApiJson} = t.context; + + const apiJsonPath = "/test-resources/sap/ui5/tooling/test/designtime/api.json"; + const fakeTargetPath = "/ignore/this/path/resource/will/be/returned"; + const dotLibraryPath = "/resources/sap/ui5/tooling/test/.library"; + const dependencyApiJsonPaths = []; + + const readFile = sinon.stub().yieldsAsync(new Error("Not found!")); + + readFile.withArgs("/resources/sap/ui5/tooling/test/.library").yieldsAsync(null, ` + + + + sap.ui5.tooling.test + SAP SE + Some copyright notice + 1.2.3 + + UI5 Tooling Test Library + + `); + + readFile.withArgs("/test-resources/sap/ui5/tooling/test/designtime/api.json").yieldsAsync(null, JSON.stringify( + { + "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0", + "version": "2.1.0", + "library": "sap.ui5.tooling.test", + "symbols": [ + { + "kind": "namespace", + "name": "sap.ui5.tooling.test", + "basename": "test", + "resource": "sap/ui5/tooling/test/library.js", + "module": "sap/ui5/tooling/test/library", + "export": "", + "static": true, + "visibility": "public", + "since": "1.0.0", + "description": "UI5 Tooling Test Library", + "deprecated": { + "since": "2.0.0" + } + }, + { + "kind": "class", + "name": "sap.ui5.tooling.test.TestControl", + "basename": "TestControl", + "resource": "sap/ui5/tooling/test/TestControl.js", + "module": "sap/ui5/tooling/test/TestControl", + "export": "", + "static": true, + "visibility": "public", + "extends": "sap.ui.core.Control", + "description": "This control is just for UI5 Tooling testing purposes.", + "experimental": { + "since": "1.4", + "text": "The API may change. Use with care." + }, + "deprecated": { + "since": "2.0", + "text": "there's no replacement for this functionality" + }, + "ui5-metadata": { + "stereotype": "control", + "specialSettings": [ + { + "name": "specialControlData", + "type": "any", + "visibility": "public" + } + ], + "properties": [ + { + "name": "value", + "type": "string", + "defaultValue": "", + "group": "Misc", + "visibility": "public", + "description": "Property with type string", + "deprecated": { + "since": "2.0" + }, + "methods": [ + "getValue", + "setValue" + ] + }, + { + "name": "color", + "type": "sap.ui5.tooling.test.TestEnum", + "defaultValue": "Red", + "group": "Misc", + "visibility": "public", + "description": "Property with an Enum", + "methods": [ + "getColor", + "setColor" + ] + } + ], + "aggregations": [ + { + "name": "items", + "singularName": "item", + "type": "sap.ui.core.Control", + "cardinality": "0..n", + "visibility": "public", + "description": "Items to be rendered", + "methods": [ + "getItems", + "destroyItems", + "insertItem", + "addItem", + "removeItem", + "indexOfItem", + "removeAllItems" + ] + } + ], + "associations": [ + { + "name": "selectedItem", + "singularName": "selectedItem", + "type": "sap.ui.core.Control", + "cardinality": "0..1", + "visibility": "public", + "description": "Selected item", + "methods": [ + "getSelectedItem", + "setSelectedItem" + ] + } + ], + "events": [ + { + "name": "press", + "visibility": "public", + "description": "Event is fired when the user clicks the control.", + "deprecated": { + "since": "2.0" + }, + "methods": [ + "attachPress", + "detachPress", + "firePress" + ] + }, + { + "name": "change", + "visibility": "public", + "since": "1.4", + "description": "Fires when an item is changed.", + "parameters": { + "item": { + "name": "item", + "type": "sap.ui.core.Control", + "since": "1.4", + "description": "Reference to the item" + }, + "pressed": { + "name": "pressed", + "type": "boolean", + "description": "Whether pressed", + "deprecated": {} + } + }, + "methods": [ + "attachChange", + "detachChange", + "fireChange" + ] + } + ] + }, + "constructor": { + "visibility": "public", + "parameters": [ + { + "name": "sId", + "type": "string", + "optional": true, + "description": "id for the new control, generated automatically if no id is given" + }, + { + "name": "mSettings", + "type": "object", + "optional": true, + "description": "initial settings for the new control" + } + ], + "throws": [ + { + "type": "Error", + "description": "In case something bad happens" + } + ], + "description": "Constructor for a new TestControl.\n\nAccepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See {@link sap.ui.base.ManagedObject#constructor} for a general description of the syntax of the settings object.", + "examples": [ + { + "text": "new TestControl();" + } + ] + }, + "events": [ + { + "name": "change", + "visibility": "public", + "since": "1.4", + "parameters": [ + { + "name": "oControlEvent", + "type": "sap.ui.base.Event", + "parameterProperties": { + "getSource": { + "name": "getSource", + "type": "sap.ui.base.EventProvider", + "optional": false + }, + "getParameters": { + "name": "getParameters", + "type": "object", + "optional": false, + "parameterProperties": { + "item": { + "name": "item", + "type": "sap.ui.core.Control", + "optional": false, + "description": "Reference to the item" + }, + "pressed": { + "name": "pressed", + "type": "boolean", + "optional": false, + "description": "Whether pressed" + } + } + } + } + } + ], + "description": "Fires when an item is changed." + }, + { + "name": "press", + "visibility": "public", + "parameters": [ + { + "name": "oControlEvent", + "type": "sap.ui.base.Event", + "parameterProperties": { + "getSource": { + "name": "getSource", + "type": "sap.ui.base.EventProvider", + "optional": false + }, + "getParameters": { + "name": "getParameters", + "type": "object", + "optional": false + } + } + } + ], + "description": "Event is fired when the user clicks the control.", + "deprecated": { + "since": "2.0" + } + } + ], + "methods": [ + { + "name": "addItem", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "Reference to this in order to allow method chaining" + }, + "parameters": [ + { + "name": "oItem", + "type": "sap.ui.core.Control", + "optional": false, + "description": "The item to add; if empty, nothing is inserted" + } + ], + "description": "Adds some item to the aggregation {@link #getItems items}." + }, + { + "name": "attachChange", + "visibility": "public", + "since": "1.4", + "returnValue": { + "type": "this", + "description": "Reference to this in order to allow method chaining" + }, + "parameters": [ + { + "name": "oData", + "type": "object", + "optional": true, + "description": "An application-specific payload object that will be passed to the event handler along with the event object when firing the event" + }, + { + "name": "fnFunction", + "type": "function(sap.ui.base.Event) : void", + "optional": false, + "description": "The function to be called when the event occurs" + }, + { + "name": "oListener", + "type": "object", + "optional": true, + "description": "Context object to call the event handler with. Defaults to this sap.ui5.tooling.test.TestControl itself" + } + ], + "description": "Attaches event handler fnFunction to the {@link #event:change change} event of this sap.ui5.tooling.test.TestControl.\n\nWhen called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui5.tooling.test.TestControl itself.\n\nFires when an item is changed." + }, + { + "name": "attachPress", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "Reference to this in order to allow method chaining" + }, + "parameters": [ + { + "name": "oData", + "type": "object", + "optional": true, + "description": "An application-specific payload object that will be passed to the event handler along with the event object when firing the event" + }, + { + "name": "fnFunction", + "type": "function(sap.ui.base.Event) : void", + "optional": false, + "description": "The function to be called when the event occurs" + }, + { + "name": "oListener", + "type": "object", + "optional": true, + "description": "Context object to call the event handler with. Defaults to this sap.ui5.tooling.test.TestControl itself" + } + ], + "description": "Attaches event handler fnFunction to the {@link #event:press press} event of this sap.ui5.tooling.test.TestControl.\n\nWhen called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui5.tooling.test.TestControl itself.\n\nEvent is fired when the user clicks the control.", + "deprecated": { + "since": "2.0" + } + }, + { + "name": "destroyItems", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "Reference to this in order to allow method chaining" + }, + "description": "Destroys all the items in the aggregation {@link #getItems items}." + }, + { + "name": "detachChange", + "visibility": "public", + "since": "1.4", + "returnValue": { + "type": "this", + "description": "Reference to this in order to allow method chaining" + }, + "parameters": [ + { + "name": "fnFunction", + "type": "function(sap.ui.base.Event) : void", + "optional": false, + "description": "The function to be called, when the event occurs" + }, + { + "name": "oListener", + "type": "object", + "optional": true, + "description": "Context object on which the given function had to be called" + } + ], + "description": "Detaches event handler fnFunction from the {@link #event:change change} event of this sap.ui5.tooling.test.TestControl.\n\nThe passed function and listener object must match the ones used for event registration." + }, + { + "name": "detachPress", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "Reference to this in order to allow method chaining" + }, + "parameters": [ + { + "name": "fnFunction", + "type": "function(sap.ui.base.Event) : void", + "optional": false, + "description": "The function to be called, when the event occurs" + }, + { + "name": "oListener", + "type": "object", + "optional": true, + "description": "Context object on which the given function had to be called" + } + ], + "description": "Detaches event handler fnFunction from the {@link #event:press press} event of this sap.ui5.tooling.test.TestControl.\n\nThe passed function and listener object must match the ones used for event registration.", + "deprecated": { + "since": "2.0" + } + }, + { + "name": "extend", + "visibility": "public", + "static": true, + "returnValue": { + "type": "function", + "description": "Created class / constructor function" + }, + "parameters": [ + { + "name": "sClassName", + "type": "string", + "optional": false, + "description": "Name of the class being created" + }, + { + "name": "oClassInfo", + "type": "object", + "optional": true, + "description": "Object literal with information about the class" + }, + { + "name": "FNMetaImpl", + "type": "function", + "optional": true, + "description": "Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class" + } + ], + "description": "Creates a new subclass of class sap.ui5.tooling.test.TestControl with name sClassName and enriches it with the information contained in oClassInfo.\n\noClassInfo might contain the same kind of information as described in {@link sap.ui.core.Control.extend}." + }, + { + "name": "fancyFunction", + "visibility": "public", + "throws": [ + { + "type": "Error", + "description": "In case something bad happens" + } + ], + "description": "Some fancy function.\n\nSome links: {@link https://openui5.org OpenUI5} {@link demo:foo} {@link sap.ui.core.Control.prototype.placeAt} {@link sap.m.Button#event:press} {@link sap.m.Button#setText} {@link fiori:/flexible-column-layout/ Flexible Column Layout} {@link topic:59a0e11712e84a648bb990a1dba76bc7 Link text} {@link module:sap/ui/comp/smartfield/SmartField#annotation:TextArrangement TextArrangement}", + "deprecated": { + "since": "2.0" + } + }, + { + "name": "fireChange", + "visibility": "protected", + "since": "1.4", + "returnValue": { + "type": "this", + "description": "Reference to this in order to allow method chaining" + }, + "parameters": [ + { + "name": "mParameters", + "type": "object", + "optional": true, + "parameterProperties": { + "item": { + "name": "item", + "type": "sap.ui.core.Control", + "optional": true, + "description": "Reference to the item" + }, + "pressed": { + "name": "pressed", + "type": "boolean", + "optional": true, + "description": "Whether pressed" + } + }, + "description": "Parameters to pass along with the event" + } + ], + "description": "Fires event {@link #event:change change} to attached listeners." + }, + { + "name": "firePress", + "visibility": "protected", + "returnValue": { + "type": "this", + "description": "Reference to this in order to allow method chaining" + }, + "parameters": [ + { + "name": "mParameters", + "type": "object", + "optional": true, + "description": "Parameters to pass along with the event" + } + ], + "description": "Fires event {@link #event:press press} to attached listeners.", + "deprecated": { + "since": "2.0" + } + }, + { + "name": "getColor", + "visibility": "public", + "returnValue": { + "type": "sap.ui5.tooling.test.TestEnum", + "description": "Value of property color" + }, + "description": "Gets current value of property {@link #getColor color}.\n\nProperty with an Enum\n\nDefault value is Red." + }, + { + "name": "getItems", + "visibility": "public", + "returnValue": { + "type": "sap.ui.core.Control[]" + }, + "description": "Gets content of aggregation {@link #getItems items}.\n\nItems to be rendered" + }, + { + "name": "getMetadata", + "visibility": "public", + "static": true, + "returnValue": { + "type": "sap.ui.core.ElementMetadata", + "description": "Metadata object describing this class" + }, + "description": "Returns a metadata object for class sap.ui5.tooling.test.TestControl." + }, + { + "name": "getSelectedItem", + "visibility": "public", + "returnValue": { + "type": "sap.ui.core.ID" + }, + "description": "ID of the element which is the current target of the association {@link #getSelectedItem selectedItem}, or null." + }, + { + "name": "getValue", + "visibility": "public", + "returnValue": { + "type": "string", + "description": "Value of property value" + }, + "description": "Gets current value of property {@link #getValue value}.\n\nProperty with type string\n\nDefault value is empty string.", + "deprecated": { + "since": "2.0" + } + }, + { + "name": "indexOfItem", + "visibility": "public", + "returnValue": { + "type": "int", + "description": "The index of the provided control in the aggregation if found, or -1 otherwise" + }, + "parameters": [ + { + "name": "oItem", + "type": "sap.ui.core.Control", + "optional": false, + "description": "The item whose index is looked for" + } + ], + "description": "Checks for the provided sap.ui.core.Control in the aggregation {@link #getItems items}. and returns its index if found or -1 otherwise." + }, + { + "name": "insertItem", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "Reference to this in order to allow method chaining" + }, + "parameters": [ + { + "name": "oItem", + "type": "sap.ui.core.Control", + "optional": false, + "description": "The item to insert; if empty, nothing is inserted" + }, + { + "name": "iIndex", + "type": "int", + "optional": false, + "description": "The 0-based index the item should be inserted at; for a negative value of iIndex, the item is inserted at position 0; for a value greater than the current size of the aggregation, the item is inserted at the last position" + } + ], + "description": "Inserts a item into the aggregation {@link #getItems items}." + }, + { + "name": "removeAllItems", + "visibility": "public", + "returnValue": { + "type": "sap.ui.core.Control[]", + "description": "An array of the removed elements (might be empty)" + }, + "description": "Removes all the controls from the aggregation {@link #getItems items}.\n\nAdditionally, it unregisters them from the hosting UIArea." + }, + { + "name": "removeItem", + "visibility": "public", + "returnValue": { + "type": "sap.ui.core.Control|null", + "description": "The removed item or null" + }, + "parameters": [ + { + "name": "vItem", + "type": "int|string|sap.ui.core.Control", + "optional": false, + "description": "The item to remove or its index or id" + } + ], + "description": "Removes a item from the aggregation {@link #getItems items}." + }, + { + "name": "setColor", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "Reference to this in order to allow method chaining" + }, + "parameters": [ + { + "name": "sColor", + "type": "sap.ui5.tooling.test.TestEnum", + "optional": true, + "defaultValue": "Red", + "description": "New value for property color" + } + ], + "description": "Sets a new value for property {@link #getColor color}.\n\nProperty with an Enum\n\nWhen called with a value of null or undefined, the default value of the property will be restored.\n\nDefault value is Red." + }, + { + "name": "setSelectedItem", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "Reference to this in order to allow method chaining" + }, + "parameters": [ + { + "name": "oSelectedItem", + "type": "sap.ui.core.ID|sap.ui.core.Control", + "optional": false, + "description": "ID of an element which becomes the new target of this selectedItem association; alternatively, an element instance may be given" + } + ], + "description": "Sets the associated {@link #getSelectedItem selectedItem}." + }, + { + "name": "setValue", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "Reference to this in order to allow method chaining" + }, + "parameters": [ + { + "name": "sValue", + "type": "string", + "optional": true, + "defaultValue": "\"\"", + "description": "New value for property value" + } + ], + "description": "Sets a new value for property {@link #getValue value}.\n\nProperty with type string\n\nWhen called with a value of null or undefined, the default value of the property will be restored.\n\nDefault value is empty string.", + "deprecated": { + "since": "2.0" + } + } + ] + }, + { + "kind": "enum", + "name": "sap.ui5.tooling.test.TestEnum", + "basename": "TestEnum", + "resource": "sap/ui5/tooling/test/library.js", + "module": "sap/ui5/tooling/test/library", + "export": "TestEnum", + "static": true, + "visibility": "public", + "description": "Defines colors", + "ui5-metadata": { + "stereotype": "enum" + }, + "properties": [ + { + "name": "Blue", + "visibility": "public", + "static": true, + "type": "string", + "description": "Yellow" + }, + { + "name": "Red", + "visibility": "public", + "static": true, + "type": "string", + "description": "Red" + } + ] + } + ] + } + )); + + const readdir = sinon.stub().yieldsAsync(new Error("Not found!")); + + const fs = {readFile, readdir}; + + const apiJsonContent = await transformApiJson( + apiJsonPath, fakeTargetPath, dotLibraryPath, dependencyApiJsonPaths, "", { + fs, + returnOutputFiles: true + } + ); + + t.deepEqual(JSON.parse(apiJsonContent), + { + "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0", + "version": "2.1.0", + "library": "sap.ui5.tooling.test", + "symbols": [ + { + "kind": "namespace", + "name": "sap.ui5.tooling.test", + "basename": "test", + "resource": "sap/ui5/tooling/test/library.js", + "module": "sap/ui5/tooling/test/library", + "export": "", + "static": true, + "visibility": "public", + "since": "1.0.0", + "description": "

UI5 Tooling Test Library

", + "displayName": "sap.ui5.tooling.test", + "nodes": [ + { + "name": "sap.ui5.tooling.test.TestControl", + "description": "

This control is just for UI5 Tooling testing purposes.

", + "href": "api/sap.ui5.tooling.test.TestControl", + "deprecated": true + }, + { + "name": "sap.ui5.tooling.test.TestEnum", + "description": "

Defines colors

", + "href": "api/sap.ui5.tooling.test.TestEnum" + } + ], + "title": "namespace sap.ui5.tooling.test", + "subTitle": "Deprecated in version: 2.0.0", + "deprecatedText": "Deprecated as of version 2.0.0" + }, + { + "kind": "class", + "name": "sap.ui5.tooling.test.TestControl", + "basename": "TestControl", + "resource": "sap/ui5/tooling/test/TestControl.js", + "module": "sap/ui5/tooling/test/TestControl", + "export": "", + "static": true, + "visibility": "public", + "extends": "sap.ui.core.Control", + "description": "

This control is just for UI5 Tooling testing purposes.

", + "experimental": { + "since": "1.4", + "text": "The API may change. Use with care." + }, + "ui5-metadata": { + "stereotype": "control", + "specialSettings": [ + { + "name": "specialControlData", + "type": "any", + "visibility": "public", + "description": "" + } + ], + "properties": [ + { + "name": "color", + "type": "sap.ui5.tooling.test.TestEnum", + "defaultValue": "Red", + "group": "Misc", + "visibility": "public", + "description": "

Property with an Enum

", + "methods": [ + "getColor", + "setColor" + ], + "linkEnabled": true + }, + { + "name": "value", + "type": "string", + "defaultValue": "empty string", + "group": "Misc", + "visibility": "public", + "description": "

Property with type string

", + "methods": [ + "getValue", + "setValue" + ], + "deprecatedText": "Deprecated as of version 2.0" + } + ], + "aggregations": [ + { + "name": "items", + "singularName": "item", + "type": "sap.ui.core.Control", + "cardinality": "0..n", + "visibility": "public", + "description": "

Items to be rendered

", + "methods": [ + "getItems", + "destroyItems", + "insertItem", + "addItem", + "removeItem", + "indexOfItem", + "removeAllItems" + ], + "linkEnabled": true + } + ], + "associations": [ + { + "name": "selectedItem", + "singularName": "selectedItem", + "type": "sap.ui.core.Control", + "cardinality": "0..1", + "visibility": "public", + "description": "

Selected item

", + "methods": [ + "getSelectedItem", + "setSelectedItem" + ], + "linkEnabled": true + } + ] + }, + "constructor": { + "visibility": "public", + "parameters": [ + { + "name": "sId", + "optional": true, + "description": "

id for the new control, generated automatically if no id is given

", + "phoneName": "sId", + "depth": 0, + "types": [ + { + "name": "string", + "linkEnabled": false + } + ], + "defaultValue": "" + }, + { + "name": "mSettings", + "optional": true, + "description": "

initial settings for the new control

", + "phoneName": "mSettings", + "depth": 0, + "types": [ + { + "name": "object", + "linkEnabled": false + } + ], + "defaultValue": "" + } + ], + "throws": [ + { + "type": "Error", + "description": "

In case something bad happens

", + "linkEnabled": false + } + ], + "description": "

Constructor for a new TestControl.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

", + "examples": [ + { + "data": "

Example:

new TestControl();

" + } + ], + "references": [], + "codeExample": "
new sap.ui5.tooling.test.TestControl(sId?, mSettings?)
" + }, + "events": [ + { + "name": "change", + "visibility": "public", + "since": "1.4", + "parameters": [ + { + "name": "oControlEvent", + "type": "sap.ui.base.Event", + "linkEnabled": true + }, + { + "name": "getSource", + "type": "sap.ui.base.EventProvider", + "optional": false, + "depth": 1, + "phoneName": "oControlEvent.getSource", + "linkEnabled": true + }, + { + "name": "getParameters", + "type": "object", + "optional": false, + "depth": 1, + "phoneName": "oControlEvent.getParameters" + }, + { + "name": "item", + "type": "sap.ui.core.Control", + "optional": false, + "description": "

Reference to the item

Since: 1.4.

", + "since": "1.4", + "depth": 2, + "phoneName": "oControlEvent.getParameters.item", + "linkEnabled": true + }, + { + "name": "pressed", + "type": "boolean", + "optional": false, + "description": "

Whether pressed

", + "deprecated": {}, + "depth": 2, + "phoneName": "oControlEvent.getParameters.pressed", + "deprecatedText": "Deprecated" + } + ], + "description": "

Fires when an item is changed.

Since: 1.4.

" + }, + { + "name": "press", + "visibility": "public", + "parameters": [ + { + "name": "oControlEvent", + "type": "sap.ui.base.Event", + "linkEnabled": true + }, + { + "name": "getSource", + "type": "sap.ui.base.EventProvider", + "optional": false, + "depth": 1, + "phoneName": "oControlEvent.getSource", + "linkEnabled": true + }, + { + "name": "getParameters", + "type": "object", + "optional": false, + "depth": 1, + "phoneName": "oControlEvent.getParameters" + } + ], + "description": "

Event is fired when the user clicks the control.

", + "deprecated": { + "since": "2.0" + }, + "deprecatedText": "Deprecated as of version 2.0" + } + ], + "methods": [ + { + "name": "addItem", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "

Reference to this in order to allow method chaining

", + "types": [ + { + "value": "this" + } + ] + }, + "parameters": [ + { + "name": "oItem", + "optional": false, + "description": "

The item to add; if empty, nothing is inserted

", + "types": [ + { + "value": "sap.ui.core.Control", + "linkEnabled": true, + "href": "api/sap.ui.core.Control" + } + ], + "defaultValue": "" + } + ], + "description": "

Adds some item to the aggregation items.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/addItem", + "code": "
addItem(oItem) : this
" + }, + { + "name": "attachChange", + "visibility": "public", + "since": "1.4", + "returnValue": { + "type": "this", + "description": "

Reference to this in order to allow method chaining

", + "types": [ + { + "value": "this" + } + ] + }, + "parameters": [ + { + "name": "oData", + "optional": true, + "description": "

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

", + "types": [ + { + "value": "object" + } + ], + "defaultValue": "" + }, + { + "name": "fnFunction", + "optional": false, + "description": "

The function to be called when the event occurs

", + "types": [ + { + "value": "function(sap.ui.base.Event) : void" + } + ], + "defaultValue": "" + }, + { + "name": "oListener", + "optional": true, + "description": "

Context object to call the event handler with. Defaults to this sap.ui5.tooling.test.TestControl itself

", + "types": [ + { + "value": "object" + } + ], + "defaultValue": "" + } + ], + "description": "

Attaches event handler fnFunction to the change event of this sap.ui5.tooling.test.TestControl.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui5.tooling.test.TestControl itself.

Fires when an item is changed.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/attachChange", + "code": "
attachChange(oData?, fnFunction, oListener?) : this
" + }, + { + "name": "attachPress", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "

Reference to this in order to allow method chaining

", + "types": [ + { + "value": "this" + } + ] + }, + "parameters": [ + { + "name": "oData", + "optional": true, + "description": "

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

", + "types": [ + { + "value": "object" + } + ], + "defaultValue": "" + }, + { + "name": "fnFunction", + "optional": false, + "description": "

The function to be called when the event occurs

", + "types": [ + { + "value": "function(sap.ui.base.Event) : void" + } + ], + "defaultValue": "" + }, + { + "name": "oListener", + "optional": true, + "description": "

Context object to call the event handler with. Defaults to this sap.ui5.tooling.test.TestControl itself

", + "types": [ + { + "value": "object" + } + ], + "defaultValue": "" + } + ], + "description": "

Attaches event handler fnFunction to the press event of this sap.ui5.tooling.test.TestControl.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui5.tooling.test.TestControl itself.

Event is fired when the user clicks the control.

", + "deprecated": { + "since": "2.0" + }, + "href": "api/sap.ui5.tooling.test.TestControl#methods/attachPress", + "deprecatedText": "Deprecated as of version 2.0", + "code": "
attachPress(oData?, fnFunction, oListener?) : this
" + }, + { + "name": "destroyItems", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "

Reference to this in order to allow method chaining

", + "types": [ + { + "value": "this" + } + ] + }, + "description": "

Destroys all the items in the aggregation items.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/destroyItems", + "code": "
destroyItems() : this
" + }, + { + "name": "detachChange", + "visibility": "public", + "since": "1.4", + "returnValue": { + "type": "this", + "description": "

Reference to this in order to allow method chaining

", + "types": [ + { + "value": "this" + } + ] + }, + "parameters": [ + { + "name": "fnFunction", + "optional": false, + "description": "

The function to be called, when the event occurs

", + "types": [ + { + "value": "function(sap.ui.base.Event) : void" + } + ], + "defaultValue": "" + }, + { + "name": "oListener", + "optional": true, + "description": "

Context object on which the given function had to be called

", + "types": [ + { + "value": "object" + } + ], + "defaultValue": "" + } + ], + "description": "

Detaches event handler fnFunction from the change event of this sap.ui5.tooling.test.TestControl.

The passed function and listener object must match the ones used for event registration.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/detachChange", + "code": "
detachChange(fnFunction, oListener?) : this
" + }, + { + "name": "detachPress", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "

Reference to this in order to allow method chaining

", + "types": [ + { + "value": "this" + } + ] + }, + "parameters": [ + { + "name": "fnFunction", + "optional": false, + "description": "

The function to be called, when the event occurs

", + "types": [ + { + "value": "function(sap.ui.base.Event) : void" + } + ], + "defaultValue": "" + }, + { + "name": "oListener", + "optional": true, + "description": "

Context object on which the given function had to be called

", + "types": [ + { + "value": "object" + } + ], + "defaultValue": "" + } + ], + "description": "

Detaches event handler fnFunction from the press event of this sap.ui5.tooling.test.TestControl.

The passed function and listener object must match the ones used for event registration.

", + "deprecated": { + "since": "2.0" + }, + "href": "api/sap.ui5.tooling.test.TestControl#methods/detachPress", + "deprecatedText": "Deprecated as of version 2.0", + "code": "
detachPress(fnFunction, oListener?) : this
" + }, + { + "name": "sap.ui5.tooling.test.TestControl.extend", + "visibility": "public", + "static": true, + "returnValue": { + "type": "function", + "description": "

Created class / constructor function

", + "types": [ + { + "value": "function" + } + ] + }, + "parameters": [ + { + "name": "sClassName", + "optional": false, + "description": "

Name of the class being created

", + "types": [ + { + "value": "string" + } + ], + "defaultValue": "" + }, + { + "name": "oClassInfo", + "optional": true, + "description": "

Object literal with information about the class

", + "types": [ + { + "value": "object" + } + ], + "defaultValue": "" + }, + { + "name": "FNMetaImpl", + "optional": true, + "description": "

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

", + "types": [ + { + "value": "function" + } + ], + "defaultValue": "" + } + ], + "description": "

Creates a new subclass of class sap.ui5.tooling.test.TestControl with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/sap.ui5.tooling.test.TestControl.extend", + "code": "
sap.ui5.tooling.test.TestControl.extend(sClassName, oClassInfo?, FNMetaImpl?) : function
" + }, + { + "name": "fancyFunction", + "visibility": "public", + "throws": [ + { + "type": "Error", + "description": "

In case something bad happens

", + "linkEnabled": false + } + ], + "description": "

Some fancy function.

Some links: OpenUI5\n\t\t\t demo:foo\n\t\t\t sap.ui.core.Control.prototype.placeAt sap.m.Button#event:press sap.m.Button#setText Flexible Column Layout Link text TextArrangement

", + "deprecated": { + "since": "2.0" + }, + "href": "api/sap.ui5.tooling.test.TestControl#methods/fancyFunction", + "deprecatedText": "Deprecated as of version 2.0", + "code": "
fancyFunction() : void
" + }, + { + "name": "fireChange", + "visibility": "protected", + "since": "1.4", + "returnValue": { + "type": "this", + "description": "

Reference to this in order to allow method chaining

", + "types": [ + { + "value": "this" + } + ] + }, + "parameters": [ + { + "name": "mParameters", + "optional": true, + "description": "

Parameters to pass along with the event

", + "types": [ + { + "value": "object" + } + ], + "defaultValue": "" + }, + { + "name": "item", + "optional": true, + "description": "

Reference to the item

", + "depth": 1, + "types": [ + { + "value": "sap.ui.core.Control", + "linkEnabled": true, + "href": "api/sap.ui.core.Control" + } + ], + "phoneName": "mParameters.item", + "defaultValue": "" + }, + { + "name": "pressed", + "optional": true, + "description": "

Whether pressed

", + "depth": 1, + "types": [ + { + "value": "boolean" + } + ], + "phoneName": "mParameters.pressed", + "defaultValue": "" + } + ], + "description": "

Fires event change to attached listeners.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/fireChange", + "code": "
fireChange(mParameters?) : this
" + }, + { + "name": "firePress", + "visibility": "protected", + "returnValue": { + "type": "this", + "description": "

Reference to this in order to allow method chaining

", + "types": [ + { + "value": "this" + } + ] + }, + "parameters": [ + { + "name": "mParameters", + "optional": true, + "description": "

Parameters to pass along with the event

", + "types": [ + { + "value": "object" + } + ], + "defaultValue": "" + } + ], + "description": "

Fires event press to attached listeners.

", + "deprecated": { + "since": "2.0" + }, + "href": "api/sap.ui5.tooling.test.TestControl#methods/firePress", + "deprecatedText": "Deprecated as of version 2.0", + "code": "
firePress(mParameters?) : this
" + }, + { + "name": "getColor", + "visibility": "public", + "returnValue": { + "type": "sap.ui5.tooling.test.TestEnum", + "description": "

Value of property color

", + "types": [ + { + "value": "sap.ui5.tooling.test.TestEnum" + } + ] + }, + "description": "

Gets current value of property color.

Property with an Enum

Default value is Red.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/getColor", + "code": "
getColor() : sap.ui5.tooling.test.TestEnum
" + }, + { + "name": "getItems", + "visibility": "public", + "returnValue": { + "type": "sap.ui.core.Control[]", + "types": [ + { + "value": "sap.ui.core.Control[]" + } + ], + "description": "" + }, + "description": "

Gets content of aggregation items.

Items to be rendered

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/getItems", + "code": "
getItems() : sap.ui.core.Control[]
" + }, + { + "name": "sap.ui5.tooling.test.TestControl.getMetadata", + "visibility": "public", + "static": true, + "returnValue": { + "type": "sap.ui.core.ElementMetadata", + "description": "

Metadata object describing this class

", + "types": [ + { + "value": "sap.ui.core.ElementMetadata", + "href": "api/sap.ui.core.ElementMetadata", + "linkEnabled": true + } + ] + }, + "description": "

Returns a metadata object for class sap.ui5.tooling.test.TestControl.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/sap.ui5.tooling.test.TestControl.getMetadata", + "code": "
sap.ui5.tooling.test.TestControl.getMetadata() : sap.ui.core.ElementMetadata
" + }, + { + "name": "getSelectedItem", + "visibility": "public", + "returnValue": { + "type": "sap.ui.core.ID", + "types": [ + { + "value": "sap.ui.core.ID", + "href": "api/sap.ui.core.ID", + "linkEnabled": true + } + ], + "description": "" + }, + "description": "

ID of the element which is the current target of the association selectedItem, or null.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/getSelectedItem", + "code": "
getSelectedItem() : sap.ui.core.ID
" + }, + { + "name": "getValue", + "visibility": "public", + "returnValue": { + "type": "string", + "description": "

Value of property value

", + "types": [ + { + "value": "string" + } + ] + }, + "description": "

Gets current value of property value.

Property with type string

Default value is empty string.

", + "deprecated": { + "since": "2.0" + }, + "href": "api/sap.ui5.tooling.test.TestControl#methods/getValue", + "deprecatedText": "Deprecated as of version 2.0", + "code": "
getValue() : string
" + }, + { + "name": "indexOfItem", + "visibility": "public", + "returnValue": { + "type": "int", + "description": "

The index of the provided control in the aggregation if found, or -1 otherwise

", + "types": [ + { + "value": "int" + } + ] + }, + "parameters": [ + { + "name": "oItem", + "optional": false, + "description": "

The item whose index is looked for

", + "types": [ + { + "value": "sap.ui.core.Control", + "linkEnabled": true, + "href": "api/sap.ui.core.Control" + } + ], + "defaultValue": "" + } + ], + "description": "

Checks for the provided sap.ui.core.Control in the aggregation items. and returns its index if found or -1 otherwise.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/indexOfItem", + "code": "
indexOfItem(oItem) : int
" + }, + { + "name": "insertItem", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "

Reference to this in order to allow method chaining

", + "types": [ + { + "value": "this" + } + ] + }, + "parameters": [ + { + "name": "oItem", + "optional": false, + "description": "

The item to insert; if empty, nothing is inserted

", + "types": [ + { + "value": "sap.ui.core.Control", + "linkEnabled": true, + "href": "api/sap.ui.core.Control" + } + ], + "defaultValue": "" + }, + { + "name": "iIndex", + "optional": false, + "description": "

The 0-based index the item should be inserted at; for a negative value of iIndex, the item is inserted at position 0; for a value greater than the current size of the aggregation, the item is inserted at the last position

", + "types": [ + { + "value": "int" + } + ], + "defaultValue": "" + } + ], + "description": "

Inserts a item into the aggregation items.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/insertItem", + "code": "
insertItem(oItem, iIndex) : this
" + }, + { + "name": "removeAllItems", + "visibility": "public", + "returnValue": { + "type": "sap.ui.core.Control[]", + "description": "

An array of the removed elements (might be empty)

", + "types": [ + { + "value": "sap.ui.core.Control[]" + } + ] + }, + "description": "

Removes all the controls from the aggregation items.

Additionally, it unregisters them from the hosting UIArea.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/removeAllItems", + "code": "
removeAllItems() : sap.ui.core.Control[]
" + }, + { + "name": "removeItem", + "visibility": "public", + "returnValue": { + "type": "sap.ui.core.Control|null", + "description": "

The removed item or null

", + "types": [ + { + "value": "sap.ui.core.Control", + "href": "api/sap.ui.core.Control", + "linkEnabled": true + }, + { + "value": "null" + } + ] + }, + "parameters": [ + { + "name": "vItem", + "optional": false, + "description": "

The item to remove or its index or id

", + "types": [ + { + "value": "int" + }, + { + "value": "string" + }, + { + "value": "sap.ui.core.Control", + "linkEnabled": true, + "href": "api/sap.ui.core.Control" + } + ], + "defaultValue": "" + } + ], + "description": "

Removes a item from the aggregation items.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/removeItem", + "code": "
removeItem(vItem) : sap.ui.core.Control|null
" + }, + { + "name": "setColor", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "

Reference to this in order to allow method chaining

", + "types": [ + { + "value": "this" + } + ] + }, + "parameters": [ + { + "name": "sColor", + "optional": true, + "defaultValue": "Red", + "description": "

New value for property color

", + "types": [ + { + "value": "sap.ui5.tooling.test.TestEnum" + } + ] + } + ], + "description": "

Sets a new value for property color.

Property with an Enum

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Red.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/setColor", + "code": "
setColor(sColor?) : this
" + }, + { + "name": "setSelectedItem", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "

Reference to this in order to allow method chaining

", + "types": [ + { + "value": "this" + } + ] + }, + "parameters": [ + { + "name": "oSelectedItem", + "optional": false, + "description": "

ID of an element which becomes the new target of this selectedItem association; alternatively, an element instance may be given

", + "types": [ + { + "value": "sap.ui.core.ID", + "linkEnabled": true, + "href": "api/sap.ui.core.ID" + }, + { + "value": "sap.ui.core.Control", + "linkEnabled": true, + "href": "api/sap.ui.core.Control" + } + ], + "defaultValue": "" + } + ], + "description": "

Sets the associated selectedItem.

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/setSelectedItem", + "code": "
setSelectedItem(oSelectedItem) : this
" + }, + { + "name": "setValue", + "visibility": "public", + "returnValue": { + "type": "this", + "description": "

Reference to this in order to allow method chaining

", + "types": [ + { + "value": "this" + } + ] + }, + "parameters": [ + { + "name": "sValue", + "optional": true, + "defaultValue": "\"\"", + "description": "

New value for property value

", + "types": [ + { + "value": "string" + } + ] + } + ], + "description": "

Sets a new value for property value.

Property with type string

When called with a value of null or undefined, the default value of the property will be restored.

Default value is empty string.

", + "deprecated": { + "since": "2.0" + }, + "href": "api/sap.ui5.tooling.test.TestControl#methods/setValue", + "deprecatedText": "Deprecated as of version 2.0", + "code": "
setValue(sValue?) : this
" + } + ], + "displayName": "sap.ui5.tooling.test.TestControl", + "title": "class sap.ui5.tooling.test.TestControl", + "subTitle": "Deprecated in version: 2.0", + "deprecatedText": "Deprecated as of version 2.0. there's no replacement for this functionality" + }, + { + "kind": "enum", + "name": "sap.ui5.tooling.test.TestEnum", + "basename": "TestEnum", + "resource": "sap/ui5/tooling/test/library.js", + "module": "sap/ui5/tooling/test/library", + "export": "TestEnum", + "static": true, + "visibility": "public", + "description": "

Defines colors

", + "ui5-metadata": { + "stereotype": "enum" + }, + "properties": [ + { + "name": "sap.ui5.tooling.test.TestEnum.Blue", + "visibility": "public", + "description": "

Yellow

" + }, + { + "name": "sap.ui5.tooling.test.TestEnum.Red", + "visibility": "public", + "description": "

Red

" + } + ], + "displayName": "sap.ui5.tooling.test.TestEnum", + "title": "enum sap.ui5.tooling.test.TestEnum", + "subTitle": "" + }, + { + "name": "sap", + "displayName": "sap", + "kind": "namespace", + "nodes": [ + { + "name": "sap.ui5", + "description": "", + "href": "api/sap.ui5" + } + ], + "title": "namespace sap", + "subTitle": "" + }, + { + "name": "sap.ui5", + "displayName": "sap.ui5", + "kind": "namespace", + "nodes": [ + { + "name": "sap.ui5.tooling", + "description": "", + "href": "api/sap.ui5.tooling" + } + ], + "title": "namespace sap.ui5", + "subTitle": "" + }, + { + "name": "sap.ui5.tooling", + "displayName": "sap.ui5.tooling", + "kind": "namespace", + "nodes": [ + { + "name": "sap.ui5.tooling.test", + "description": "

UI5 Tooling Test Library

", + "href": "api/sap.ui5.tooling.test", + "deprecated": true + } + ], + "title": "namespace sap.ui5.tooling", + "subTitle": "" + } + ] + } + ); +}); + +test(".library with docuindex.json reference", async (t) => { + const {sinon, transformApiJson} = t.context; + + const apiJsonPath = "/test-resources/sap/ui5/tooling/test/designtime/api.json"; + const fakeTargetPath = "/ignore/this/path/resource/will/be/returned"; + const dotLibraryPath = "/resources/sap/ui5/tooling/test/.library"; + const dependencyApiJsonPaths = []; + + const readFile = sinon.stub().yieldsAsync(new Error("Not found!")); + + readFile.withArgs("/resources/sap/ui5/tooling/test/.library").yieldsAsync(null, ` + + + + sap.ui5.tooling.test + SAP SE + Some copyright notice + 1.2.3 + + UI5 Tooling Test Library + + + + + + `); + + readFile.withArgs("/test-resources/sap/ui5/tooling/test/designtime/api.json").yieldsAsync(null, JSON.stringify( + { + "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0", + "version": "2.1.0", + "library": "sap.ui5.tooling.test", + "symbols": [ + { + "kind": "namespace", + "name": "sap.ui5.tooling.test", + "basename": "test", + "resource": "sap/ui5/tooling/test/library.js", + "module": "sap/ui5/tooling/test/library", + "export": "", + "static": true, + "visibility": "public", + "since": "1.0.0", + "description": "UI5 Tooling Test Library", + "deprecated": { + "since": "2.0.0" + } + }, + { + "kind": "class", + "name": "sap.ui5.tooling.test.TestControl", + "basename": "TestControl", + "resource": "sap/ui5/tooling/test/TestControl.js", + "module": "sap/ui5/tooling/test/TestControl", + "export": "", + "static": true, + "visibility": "public", + "extends": "sap.ui.core.Control", + "description": "This control is just for UI5 Tooling testing purposes.", + "ui5-metadata": { + "stereotype": "control" + }, + "constructor": { + "visibility": "public", + "parameters": [ + { + "name": "sId", + "type": "string", + "optional": true, + "description": "TEST DESCRIPTION", + }, + { + "name": "mSettings", + "type": "object", + "optional": true, + "description": "TEST DESCRIPTION", + } + ], + "description": "TEST DESCRIPTION", + }, + "methods": [ + { + "name": "extend", + "visibility": "public", + "static": true, + "returnValue": { + "type": "function", + "description": "TEST DESCRIPTION", + }, + "parameters": [ + { + "name": "sClassName", + "type": "string", + "optional": false, + "description": "TEST DESCRIPTION", + }, + { + "name": "oClassInfo", + "type": "object", + "optional": true, + "description": "TEST DESCRIPTION", + }, + { + "name": "FNMetaImpl", + "type": "function", + "optional": true, + "description": "TEST DESCRIPTION", + } + ], + "description": "TEST DESCRIPTION", + }, + { + "name": "getMetadata", + "visibility": "public", + "static": true, + "returnValue": { + "type": "sap.ui.core.ElementMetadata", + "description": "TEST DESCRIPTION", + }, + "description": "TEST DESCRIPTION", + } + ] + }, + ] + } + )); + + readFile.withArgs("/test-resources/sap/ui5/tooling/test/demokit/docuindex.json").yieldsAsync(null, JSON.stringify( + { + "explored": { + "entities": [ + // { + // "id": "sap.ui5.tooling.test.TestControl" + // } + ] + } + } + )); + + const readdir = sinon.stub().yieldsAsync(new Error("Not found!")); + + const fs = {readFile, readdir}; + + const apiJsonContent = await transformApiJson( + apiJsonPath, fakeTargetPath, dotLibraryPath, dependencyApiJsonPaths, "", { + fs, + returnOutputFiles: true + } + ); + + t.deepEqual(JSON.parse(apiJsonContent), { + "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0", + "version": "2.1.0", + "library": "sap.ui5.tooling.test", + "symbols": [ + { + basename: "test", + deprecatedText: "Deprecated as of version 2.0.0", + description: "

UI5 Tooling Test Library

", + displayName: "sap.ui5.tooling.test", + export: "", + kind: "namespace", + module: "sap/ui5/tooling/test/library", + nodes: [ + { + "name": "sap.ui5.tooling.test.TestControl", + "description": "

This control is just for UI5 Tooling testing purposes.

", + "href": "api/sap.ui5.tooling.test.TestControl", + } + ], + name: "sap.ui5.tooling.test", + resource: "sap/ui5/tooling/test/library.js", + since: "1.0.0", + static: true, + subTitle: "Deprecated in version: 2.0.0", + title: "namespace sap.ui5.tooling.test", + visibility: "public", + }, + { + "kind": "class", + "name": "sap.ui5.tooling.test.TestControl", + "basename": "TestControl", + "resource": "sap/ui5/tooling/test/TestControl.js", + "module": "sap/ui5/tooling/test/TestControl", + "export": "", + "static": true, + "visibility": "public", + "extends": "sap.ui.core.Control", + "description": "

This control is just for UI5 Tooling testing purposes.

", + "ui5-metadata": { + "stereotype": "control" + }, + "constructor": { + "visibility": "public", + "parameters": [ + { + "name": "sId", + "optional": true, + "description": "

TEST DESCRIPTION

", + "phoneName": "sId", + "depth": 0, + "types": [ + { + "name": "string", + "linkEnabled": false + } + ], + "defaultValue": "" + }, + { + "name": "mSettings", + "optional": true, + "description": "

TEST DESCRIPTION

", + "phoneName": "mSettings", + "depth": 0, + "types": [ + { + "name": "object", + "linkEnabled": false + } + ], + "defaultValue": "" + } + ], + "description": "

TEST DESCRIPTION

", + "references": [], + "codeExample": "
new sap.ui5.tooling.test.TestControl(sId?, mSettings?)
" + }, + "methods": [ + { + "name": "sap.ui5.tooling.test.TestControl.extend", + "visibility": "public", + "static": true, + "returnValue": { + "type": "function", + "description": "

TEST DESCRIPTION

", + "types": [ + { + "value": "function" + } + ] + }, + "parameters": [ + { + "name": "sClassName", + "optional": false, + "description": "

TEST DESCRIPTION

", + "types": [ + { + "value": "string" + } + ], + "defaultValue": "" + }, + { + "name": "oClassInfo", + "optional": true, + "description": "

TEST DESCRIPTION

", + "types": [ + { + "value": "object" + } + ], + "defaultValue": "" + }, + { + "name": "FNMetaImpl", + "optional": true, + "description": "

TEST DESCRIPTION

", + "types": [ + { + "value": "function" + } + ], + "defaultValue": "" + } + ], + "description": "

TEST DESCRIPTION

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/sap.ui5.tooling.test.TestControl.extend", + "code": "
sap.ui5.tooling.test.TestControl.extend(sClassName, oClassInfo?, FNMetaImpl?) : function
" + }, + { + "name": "sap.ui5.tooling.test.TestControl.getMetadata", + "visibility": "public", + "static": true, + "returnValue": { + "type": "sap.ui.core.ElementMetadata", + "description": "

TEST DESCRIPTION

", + "types": [ + { + "value": "sap.ui.core.ElementMetadata", + "href": "api/sap.ui.core.ElementMetadata", + "linkEnabled": true + } + ] + }, + "description": "

TEST DESCRIPTION

", + "href": "api/sap.ui5.tooling.test.TestControl#methods/sap.ui5.tooling.test.TestControl.getMetadata", + "code": "
sap.ui5.tooling.test.TestControl.getMetadata() : sap.ui.core.ElementMetadata
" + } + ], + "displayName": "sap.ui5.tooling.test.TestControl", + "title": "class sap.ui5.tooling.test.TestControl", + "subTitle": "", + }, + { + displayName: "sap", + kind: "namespace", + name: "sap", + nodes: [ + { + description: "", + href: "api/sap.ui5", + name: "sap.ui5", + }, + ], + subTitle: "", + title: "namespace sap", + }, + { + displayName: "sap.ui5", + kind: "namespace", + name: "sap.ui5", + nodes: [ + { + description: "", + href: "api/sap.ui5.tooling", + name: "sap.ui5.tooling", + }, + ], + subTitle: "", + title: "namespace sap.ui5", + }, + { + displayName: "sap.ui5.tooling", + kind: "namespace", + name: "sap.ui5.tooling", + nodes: [ + { + deprecated: true, + description: "

UI5 Tooling Test Library

", + href: "api/sap.ui5.tooling.test", + name: "sap.ui5.tooling.test", + }, + ], + subTitle: "", + title: "namespace sap.ui5.tooling", + }, + ] + }); +}); + +test(".library with information", async (t) => { + const {sinon, transformApiJson} = t.context; + + const apiJsonPath = "/test-resources/sap/ui5/tooling/test/designtime/api.json"; + const fakeTargetPath = "/ignore/this/path/resource/will/be/returned"; + const dotLibraryPath = "/resources/sap/ui5/tooling/test/.library"; + const dependencyApiJsonPaths = []; + + const readFile = sinon.stub().yieldsAsync(new Error("Not found!")); + + readFile.withArgs("/resources/sap/ui5/tooling/test/.library").yieldsAsync(null, ` + + + + sap.ui5.tooling.test + SAP SE + Some copyright notice + 1.2.3 + + UI5 Tooling Test Library + + + + UI5-TOOLING + + UI5-TOOLING-EXT + + sap/ui5/tooling/test/ext/* + + + + + + `); + + readFile.withArgs("/test-resources/sap/ui5/tooling/test/designtime/api.json").yieldsAsync(null, JSON.stringify( + { + "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0", + "version": "2.1.0", + "library": "sap.ui5.tooling.test", + "symbols": [ + { + "kind": "namespace", + "name": "sap.ui5.tooling.test", + "basename": "test", + "resource": "sap/ui5/tooling/test/library.js", + "module": "sap/ui5/tooling/test/library", + "export": "", + "static": true, + "visibility": "public", + "description": "UI5 Tooling Test Library", + }, + { + "kind": "namespace", + "name": "sap.ui5.tooling.test.ext", + "basename": "ext", + "resource": "sap/ui5/tooling/test/ext/ext.js", + "module": "sap/ui5/tooling/test/ext/ext", + "export": "", + "static": true, + "visibility": "public", + "description": "UI5 Tooling Test Library - Extension", + } + ] + } + )); + + const readdir = sinon.stub().yieldsAsync(new Error("Not found!")); + + const fs = {readFile, readdir}; + + const apiJsonContent = await transformApiJson( + apiJsonPath, fakeTargetPath, dotLibraryPath, dependencyApiJsonPaths, "", { + fs, + returnOutputFiles: true + } + ); + + t.deepEqual(JSON.parse(apiJsonContent), { + "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0", + "version": "2.1.0", + "library": "sap.ui5.tooling.test", + "defaultComponent": "UI5-TOOLING", + "symbols": [ + { + basename: "test", + component: "UI5-TOOLING", + description: "

UI5 Tooling Test Library

", + displayName: "sap.ui5.tooling.test", + export: "", + kind: "namespace", + module: "sap/ui5/tooling/test/library", + name: "sap.ui5.tooling.test", + nodes: [ + { + description: "

UI5 Tooling Test Library - Extension

", + href: "api/sap.ui5.tooling.test.ext", + name: "sap.ui5.tooling.test.ext", + } + ], + resource: "sap/ui5/tooling/test/library.js", + static: true, + subTitle: "", + title: "namespace sap.ui5.tooling.test", + visibility: "public", + }, + { + basename: "ext", + component: "UI5-TOOLING-EXT", + description: "

UI5 Tooling Test Library - Extension

", + displayName: "sap.ui5.tooling.test.ext", + export: "", + kind: "namespace", + module: "sap/ui5/tooling/test/ext/ext", + name: "sap.ui5.tooling.test.ext", + resource: "sap/ui5/tooling/test/ext/ext.js", + static: true, + subTitle: "", + title: "namespace sap.ui5.tooling.test.ext", + visibility: "public", + }, + { + displayName: "sap", + kind: "namespace", + name: "sap", + nodes: [ + { + description: "", + href: "api/sap.ui5", + name: "sap.ui5", + }, + ], + subTitle: "", + title: "namespace sap", + }, + { + displayName: "sap.ui5", + kind: "namespace", + name: "sap.ui5", + nodes: [ + { + description: "", + href: "api/sap.ui5.tooling", + name: "sap.ui5.tooling", + }, + ], + subTitle: "", + title: "namespace sap.ui5", + }, + { + displayName: "sap.ui5.tooling", + kind: "namespace", + name: "sap.ui5.tooling", + nodes: [ + { + description: "

UI5 Tooling Test Library

", + href: "api/sap.ui5.tooling.test", + name: "sap.ui5.tooling.test", + }, + ], + subTitle: "", + title: "namespace sap.ui5.tooling", + }, + ] + }); +});