Skip to content

Commit 09d1919

Browse files
committed
Week1 Challenge
1 parent f58086a commit 09d1919

File tree

7 files changed

+90
-11
lines changed

7 files changed

+90
-11
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
sap.ui.define([
2+
"./BaseController",
3+
"sap/ui/model/json/JSONModel",
4+
"sap/m/MessageToast",
5+
], function (Controller, JSONModel, MessageToast) {
6+
"use strict";
7+
8+
return Controller.extend("ui5.challenge.controller.MainController", {
9+
onInit: function () {
10+
// This is used for Dynamically change title
11+
// document.title = 'ui5-challenge';
12+
13+
var oDummyData = {
14+
Employees: [{
15+
Name: "Name1",
16+
Surname: "Surname1",
17+
Age: 26
18+
}, {
19+
Name: "Name2",
20+
Surname: "Surname2",
21+
Age: 23
22+
}, {
23+
Name: "Name3",
24+
Surname: "Surname3",
25+
Age: 32
26+
}]
27+
};
28+
29+
const oModel = new JSONModel(oDummyData);
30+
this.getView().setModel(oModel);
31+
32+
},
33+
34+
onPress: function () {
35+
MessageToast.show("You pressed the Button!");
36+
}
37+
});
38+
});

webapp/i18n/i18n.properties

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
browserTitle=ui5-challenge
3+
4+
5+
# Main Page
6+
mainPageTitle=ui5-challenge
7+
appTitle=ui5-challenge
8+
appDescription=App test Desciption
9+
10+
mainButtonText=Test Button
11+
12+
listEmployees=Employees
13+

webapp/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<title>title</title>
4+
<title>ui5-challenge</title>
55

66
<script
77
id="sap-ui-bootstrap"

webapp/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151
"targets": {}
5252
},
5353
"rootView": {
54-
"viewName": "ui5.challenge.view.App",
54+
"viewName": "ui5.challenge.view.Main",
5555
"type": "XML",
5656
"async": true,
57-
"id": "app"
57+
"id": "shell"
5858
},
5959
"models": {
6060
"i18n": {

webapp/test/e2e/week1.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
const { wdi5 } = require("wdio-ui5-service")
1+
const {
2+
wdi5
3+
} = require("wdio-ui5-service")
24
const Main = require("./pageObjects/Main")
35

46
describe("main page", () => {
@@ -16,7 +18,7 @@ describe("main page", () => {
1618
selector: {
1719
id: "mainButton",
1820
viewName: Main._viewName
19-
}
21+
}
2022
})
2123
const buttonText = await button.getText()
2224
expect(buttonText).not.toEqual("")
@@ -28,7 +30,7 @@ describe("main page", () => {
2830
selector: {
2931
controlType: "sap.m.List",
3032
viewName: Main._viewName
31-
}
33+
}
3234
})
3335
const ListItems = await List.getItems()
3436
expect(ListItems.length).toBeGreaterThanOrEqual(3)

webapp/view/App.view.xml

Lines changed: 0 additions & 5 deletions
This file was deleted.

webapp/view/Main.view.xml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<mvc:View controllerName="ui5.challenge.controller.MainController" displayBlock="true"
2+
xmlns:mvc="sap.ui.core.mvc"
3+
xmlns="sap.m">
4+
<Shell id="shell">
5+
<App id="app">
6+
<pages>
7+
<Page title="{i18n>mainPageTitle}">
8+
<content>
9+
10+
<Panel width="auto" title="Button Controller" class="sapUiSmallMargin">
11+
<content>
12+
<Button id="mainButton" text="{i18n>mainButtonText}" press=".onPress" />
13+
</content>
14+
</Panel>
15+
16+
<Panel width="auto" title="List Information" class="sapUiSmallMargin">
17+
<content>
18+
<List headerText="{i18n>listEmployees}" items="{
19+
path: '/Employees'
20+
}">
21+
<StandardListItem title="{Name}" description="{Surname}" counter="{Age}"/>
22+
</List>
23+
</content>
24+
</Panel>
25+
26+
</content>
27+
</Page>
28+
</pages>
29+
</App>
30+
</Shell>
31+
</mvc:View>

0 commit comments

Comments
 (0)