Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/lbt/analyzer/ComponentAnalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,18 @@ class ComponentAnalyzer {
}

if ( ui5.rootView ) {
let rootView;
if ( typeof ui5.rootView === "string" ) {
rootView = {
viewName: ui5.rootView,
type: "XML"
};
} else {
rootView = ui5.rootView;
}
const module = ModuleName.fromUI5LegacyName(
ui5.rootView.viewName,
".view." + ui5.rootView.type.toLowerCase() );
rootView.viewName,
".view." + rootView.type.toLowerCase() );
log.verbose("adding root view dependency ", module);
info.addDependency( module );
}
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,16 @@
"docs/**",
"jsdocs/**",
"coverage/**",
"test/**",
"lib/lbt/**"
"test/**"
],
"check-coverage": true,
"lines": 60,
"statements": 60,
"lines": 55,
"statements": 55,
"functions": 50,
"branches": 30,
"watermarks": {
"lines": [
60,
55,
90
],
"functions": [
Expand All @@ -81,7 +80,7 @@
70
],
"statements": [
60,
55,
90
]
},
Expand Down
51 changes: 51 additions & 0 deletions test/lib/lbt/analyzer/ComponentAnalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,54 @@ test("routing with targets with local config", (t) => {
});
});

test("rootView with object", (t) => {
const mockManifest = {
"sap.ui5": {
rootView: {
viewName: "test.view.App",
type: "JS",
async: true
}
}
};

const mockPool = createMockPool("test/", mockManifest);

const mockInfo = {
deps: [],
addDependency(name) {
this.deps.push(name);
}
};

const subject = new ComponentAnalyzer(mockPool);
return subject.analyze({name: "test/Component.js"}, mockInfo).then( () => {
t.deepEqual(mockInfo.deps, [
"test/view/App.view.js",
], "dependencies should be correct");
});
});

test("rootView with string", (t) => {
const mockManifest = {
"sap.ui5": {
rootView: "test.view.App"
}
};

const mockPool = createMockPool("test/", mockManifest);

const mockInfo = {
deps: [],
addDependency(name) {
this.deps.push(name);
}
};

const subject = new ComponentAnalyzer(mockPool);
return subject.analyze({name: "test/Component.js"}, mockInfo).then( () => {
t.deepEqual(mockInfo.deps, [
"test/view/App.view.xml",
], "dependencies should be correct");
});
});