GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Basic Setup: Added and adjusted everything needed for Step 1: Overvie… · wridgeu/UI5-testing@0ebd475

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • webapp
    • controller
      • App.Controller.js
      • BaseController.js
      • Home.controller.js
      • Worklist.controller.js
    • i18n
      • i18n.properties
    • index.html
    • localService
      • metadata.xml
      • mockdata
        • Posts.json
      • mockserver.js
    • manifest.json
    • model
      • formatter.js
    • test
      • initMockServer.js
      • integration
        • AllJourneys.js
        • BasicJourney.js
        • WorklistJourney.js
        • arrangements
          • Startup.js
        • opaTests.qunit.html
        • opaTests.qunit.js
        • pages
          • App.js
          • Worklist.js
      • mockServer.html
      • testsuite.qunit.html
      • testsuite.qunit.js
      • unit
        • AllTests.js
        • model
          • formatter.js
          • models.js
        • unitTests.qunit.html
        • unitTests.qunit.js
    • view
      • App.view.xml
      • Home.view.xml
      • Worklist.view.xml
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎webapp/controller/App.Controller.js‎

Copy file name to clipboard
+29-9Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1-
sap.ui.define([
2-
"com/mrb/UI5-Testing/controller/BaseController"
3-
], function(
4-
BaseController
5-
) {
6-
"use strict";
1+
sap.ui.define(
2+
[
3+
"./BaseController",
4+
"sap/ui/model/json/JSONModel",
5+
],
6+
function (BaseController, JSONModel) {
7+
"use strict";
78

8-
return BaseController.extend("com.mrb.UI5-Testing.controller.App.Controller", {
9-
});
10-
});
9+
return BaseController.extend(
10+
"com.mrb.UI5-Testing.controller.App.Controller",
11+
{
12+
onInit: function () {
13+
var oViewModel = new JSONModel({
14+
busy: true,
15+
delay: 0,
16+
});
17+
18+
this.setModel(oViewModel, "appView");
19+
20+
this.getOwnerComponent()
21+
.getModel()
22+
.metadataLoaded()
23+
.then(function () {
24+
oViewModel.setProperty("/busy", false);
25+
});
26+
},
27+
}
28+
);
29+
}
30+
);
Collapse file

‎webapp/controller/BaseController.js‎

Copy file name to clipboard
+70-62Lines changed: 70 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,78 @@
1-
sap.ui.define([
2-
"sap/ui/core/mvc/Controller",
3-
"sap/ui/core/routing/History",
4-
"sap/ui/core/UIComponent",
5-
"com/mrb/UI5-Testing/model/formatter"
6-
], function(Controller, History, UIComponent, formatter) {
7-
"use strict";
1+
sap.ui.define(
2+
[
3+
"sap/ui/core/mvc/Controller",
4+
"sap/ui/core/routing/History",
5+
"sap/ui/core/UIComponent",
6+
"com/mrb/UI5-Testing/model/formatter",
7+
],
8+
function (Controller, History, UIComponent, formatter) {
9+
"use strict";
810

9-
return Controller.extend("com.mrb.UI5-Testing.controller.BaseController", {
11+
return Controller.extend("com.mrb.UI5-Testing.controller.BaseController", {
12+
formatter: formatter,
13+
/**
14+
* Convenience method for accessing the event bus.
15+
* @public
16+
* @returns {sap.ui.core.EventBus} the event bus for this component
17+
*/
18+
getEventBus: function () {
19+
return this.getOwnerComponent().getEventBus();
20+
},
1021

11-
formatter: formatter,
22+
/**
23+
* Convenience method for getting the view model by name in every controller of the application.
24+
* @public
25+
* @param {string} sName the model name
26+
* @returns {sap.ui.model.Model} the model instance
27+
*/
28+
getModel: function (sName) {
29+
return this.getView().getModel(sName);
30+
},
1231

13-
/**
14-
* Convenience method for getting the view model by name in every controller of the application.
15-
* @public
16-
* @param {string} sName the model name
17-
* @returns {sap.ui.model.Model} the model instance
18-
*/
19-
getModel: function(sName) {
20-
return this.getView().getModel(sName);
21-
},
32+
/**
33+
* Convenience method for setting the view model in every controller of the application.
34+
* @public
35+
* @param {sap.ui.model.Model} oModel the model instance
36+
* @param {string} sName the model name
37+
* @returns {sap.ui.mvc.View} the view instance
38+
*/
39+
setModel: function (oModel, sName) {
40+
return this.getView().setModel(oModel, sName);
41+
},
2242

23-
/**
24-
* Convenience method for setting the view model in every controller of the application.
25-
* @public
26-
* @param {sap.ui.model.Model} oModel the model instance
27-
* @param {string} sName the model name
28-
* @returns {sap.ui.mvc.View} the view instance
29-
*/
30-
setModel: function(oModel, sName) {
31-
return this.getView().setModel(oModel, sName);
32-
},
43+
/**
44+
* Convenience method for getting the resource bundle.
45+
* @public
46+
* @returns {sap.ui.model.resource.ResourceModel} the resourceModel of the component
47+
*/
48+
getResourceBundle: function () {
49+
return this.getOwnerComponent().getModel("i18n").getResourceBundle();
50+
},
3351

34-
/**
35-
* Convenience method for getting the resource bundle.
36-
* @public
37-
* @returns {sap.ui.model.resource.ResourceModel} the resourceModel of the component
38-
*/
39-
getResourceBundle: function() {
40-
return this.getOwnerComponent().getModel("i18n").getResourceBundle();
41-
},
52+
/**
53+
* Method for navigation to specific view
54+
* @public
55+
* @param {string} psTarget Parameter containing the string for the target navigation
56+
* @param {mapping} pmParameters? Parameters for navigation
57+
* @param {boolean} pbReplace? Defines if the hash should be replaced (no browser history entry) or set (browser history entry)
58+
*/
59+
navTo: function (psTarget, pmParameters, pbReplace) {
60+
this.getRouter().navTo(psTarget, pmParameters, pbReplace);
61+
},
4262

43-
/**
44-
* Method for navigation to specific view
45-
* @public
46-
* @param {string} psTarget Parameter containing the string for the target navigation
47-
* @param {mapping} pmParameters? Parameters for navigation
48-
* @param {boolean} pbReplace? Defines if the hash should be replaced (no browser history entry) or set (browser history entry)
49-
*/
50-
navTo: function(psTarget, pmParameters, pbReplace) {
51-
this.getRouter().navTo(psTarget, pmParameters, pbReplace);
52-
},
63+
getRouter: function () {
64+
return UIComponent.getRouterFor(this);
65+
},
5366

54-
getRouter: function() {
55-
return UIComponent.getRouterFor(this);
56-
},
67+
onNavBack: function () {
68+
var sPreviousHash = History.getInstance().getPreviousHash();
5769

58-
onNavBack: function() {
59-
var sPreviousHash = History.getInstance().getPreviousHash();
60-
61-
if (sPreviousHash !== undefined) {
62-
window.history.back();
63-
} else {
64-
this.getRouter().navTo("appHome", {}, true /*no history*/ );
65-
}
66-
}
67-
68-
});
69-
70-
});
70+
if (sPreviousHash !== undefined) {
71+
window.history.back();
72+
} else {
73+
this.getRouter().navTo("appHome", {}, true /*no history*/);
74+
}
75+
},
76+
});
77+
}
78+
);
Collapse file

‎webapp/controller/Home.controller.js‎

Copy file name to clipboardExpand all lines: webapp/controller/Home.controller.js
-7Lines changed: 0 additions & 7 deletions
This file was deleted.
Collapse file

‎webapp/controller/Worklist.controller.js‎

Copy file name to clipboard
+114Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
sap.ui.define(
2+
[
3+
"./BaseController",
4+
"sap/ui/model/json/JSONModel",
5+
"../model/formatter",
6+
"sap/m/library",
7+
],
8+
function (BaseController, JSONModel, formatter, mobileLibrary) {
9+
"use strict";
10+
11+
return BaseController.extend("com.mrb.UI5-Testing.controller.Worklist", {
12+
/**
13+
* Called when the worklist controller is instantiated.
14+
* @public
15+
*/
16+
onInit: function () {
17+
var oViewModel,
18+
iOriginalBusyDelay,
19+
oTable = this.byId("table");
20+
21+
// Put down worklist table's original value for busy indicator delay,
22+
// so it can be restored later on. Busy handling on the table is
23+
// taken care of by the table itself.
24+
iOriginalBusyDelay = oTable.getBusyIndicatorDelay();
25+
26+
// Model used to manipulate control states
27+
oViewModel = new JSONModel({
28+
worklistTableTitle: this.getResourceBundle().getText(
29+
"worklistTableTitle"
30+
),
31+
shareSendEmailSubject: this.getResourceBundle().getText(
32+
"shareSendEmailWorklistSubject"
33+
),
34+
shareSendEmailMessage: this.getResourceBundle().getText(
35+
"shareSendEmailWorklistMessage",
36+
[window.location.href]
37+
),
38+
tableBusyDelay: 0,
39+
});
40+
this.setModel(oViewModel, "worklistView");
41+
42+
// Make sure, busy indication is showing immediately so there is no
43+
// break after the busy indication for loading the view's meta data is
44+
// ended (see promise 'oWhenMetadataIsLoaded' in AppController)
45+
oTable.attachEventOnce("updateFinished", function () {
46+
// Restore original busy indicator delay for worklist's table
47+
oViewModel.setProperty("/tableBusyDelay", iOriginalBusyDelay);
48+
});
49+
},
50+
51+
/* =========================================================== */
52+
/* event handlers */
53+
/* =========================================================== */
54+
55+
/**
56+
* Triggered by the table's 'updateFinished' event: after new table
57+
* data is available, this handler method updates the table counter.
58+
* This should only happen if the update was successful, which is
59+
* why this handler is attached to 'updateFinished' and not to the
60+
* table's list binding's 'dataReceived' method.
61+
*
62+
* @param {sap.ui.base.Event} oEvent the update finished event
63+
* @public
64+
*/
65+
onUpdateFinished: function (oEvent) {
66+
// update the worklist's object counter after the table update
67+
var sTitle,
68+
oTable = oEvent.getSource(),
69+
iTotalItems = oEvent.getParameter("total");
70+
// only update the counter if the length is final and
71+
// the table is not empty
72+
if (iTotalItems && oTable.getBinding("items").isLengthFinal()) {
73+
sTitle = this.getResourceBundle().getText("worklistTableTitleCount", [
74+
iTotalItems,
75+
]);
76+
} else {
77+
sTitle = this.getResourceBundle().getText("worklistTableTitle");
78+
}
79+
this.getModel("worklistView").setProperty(
80+
"/worklistTableTitle",
81+
sTitle
82+
);
83+
},
84+
/**
85+
* Sets the item count on the worklist view header
86+
* @param {int} iTotalItems the total number of items in the table
87+
* @private
88+
*/
89+
_updateListItemCount: function (iTotalItems) {
90+
var sTitle;
91+
// only update the counter if the length is final
92+
if (this._oTable.getBinding("items").isLengthFinal()) {
93+
sTitle = this.getResourceBundle().getText("worklistTableTitleCount", [
94+
iTotalItems,
95+
]);
96+
this.oViewModel.setProperty("/worklistTableTitle", sTitle);
97+
}
98+
},
99+
100+
/**
101+
* Event handler when the share by E-Mail button has been clicked
102+
* @public
103+
*/
104+
onShareEmailPress: function () {
105+
var oViewModel = this.getModel("worklistView");
106+
mobileLibrary.URLHelper.triggerEmail(
107+
null,
108+
oViewModel.getProperty("/shareSendEmailSubject"),
109+
oViewModel.getProperty("/shareSendEmailMessage")
110+
);
111+
},
112+
});
113+
}
114+
);
Collapse file

‎webapp/i18n/i18n.properties‎

Copy file name to clipboard
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
11
title=UI5-Testing
22
appTitle=UI5-Testing
33
appDescription=UI5 Testing Walkthrough
4+
5+
# This is the resource bundle for the worklist app
6+
7+
#~~~ Worklist View ~~~~~~~~~~~~~~~~~~~~~~~~~~
8+
#XTIT: Table view title - Not used as we're using the Repository 'UI5-Testing' title
9+
worklistViewTitle=Bulletin Board
10+
11+
#XTIT: Table view title
12+
worklistTableTitle=Posts
13+
14+
#XTIT: Table view title with placeholder for the number of items
15+
worklistTableTitleCount=Posts ({0})
16+
17+
#XTIT: The title of the column containing the Names of objects
18+
TableNameColumnTitle=Name
19+
20+
#XTIT: The title of the column containing the Category of objects
21+
TableCategoryColumnTitle=Category
22+
23+
#XTIT: The title of the column containing the unit number and the unit of measure
24+
TableUnitNumberColumnTitle=Price
25+
26+
#~~~ Object View ~~~~~~~~~~~~~~~~~~~~~~~~~~
27+
28+
#XTIT: Object view title
29+
objectTitle=Post
30+
31+
#~~~ Footer Options ~~~~~~~~~~~~~~~~~~~~~~~
32+
33+
#XTIT: Send E-Mail subject
34+
shareSendEmailWorklistSubject=<Email subject PLEASE REPLACE ACCORDING TO YOUR USE CASE>
35+
36+
#YMSG: Send E-Mail message
37+
shareSendEmailWorklistMessage=<Email body PLEASE REPLACE ACCORDING TO YOUR USE CASE>\r\n{0}
Collapse file

‎webapp/index.html‎

Copy file name to clipboard
+21-22Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
1-
<!DOCTYPE HTML>
21
<html>
32

43
<head>
5-
<meta charset="utf-8">
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<link href="/resources/img/ui5.png" rel="shortcut icon" type="image/x-icon" />
4+
<title>Bulletin Board</title>
85

6+
<!-- try to load the basic UI5 styles for standalone and demokit usecase -->
7+
<link rel="stylesheet" href="/resources/sap/ui/core/themes/sap_fiori_3/library.css">
8+
<link rel="stylesheet" href="/resources/sap/ui/core/themes/sap_fiori_3/library.css">
9+
</head>
910

10-
<title>UI5-Testing</title>
11+
<body class="sapUiBody sapUiForceWidthAuto">
12+
<div style="display: flex; flex-direction: column; align-items: center; margin-top: 15vh;">
13+
<h1>Bulletin Board</h1>
14+
<p>This sample app for the testing will test application functionality <br> with QUnit, OPA5, and the mock
15+
server</p>
1116

12-
<script id="sap-ui-bootstrap"
13-
src="resources/sap-ui-core.js"
14-
data-sap-ui-theme="sap_fiori_3"
15-
data-sap-ui-resourceroots='{
16-
"com.mrb.UI5-Testing": "./"
17-
}'
18-
data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"
19-
data-sap-ui-compatVersion="edge"
20-
data-sap-ui-async="true"
21-
data-sap-ui-frameOptions="trusted"
22-
data-sap-ui-logLevel="NONE">
23-
</script>
24-
</head>
17+
<h2>Entry points</h2>
18+
<p>Can be used to run the app or the automated tests as needed:</p>
2519

26-
<body class="sapUiBody">
27-
<div data-sap-ui-component data-name="com.mrb.UI5-Testing" data-id="container"
28-
data-settings='{"id" : "UI5-Testing"}'>
29-
</div>
20+
<ul>
21+
<li><a href="test/mockServer.html">mockServer.html</a> - start the app with mock data</li>
22+
<li><a href="test/unit/unitTests.qunit.html">unit/unitTests.qunit.html</a> - run all unit tests</li>
23+
<li><a href="test/integration/opaTests.qunit.html">integration/opaTests.qunit.html</a> - run all integration
24+
tests</li>
25+
</ul>
26+
<p>For more documentation please read the <a href="https://openui5.hana.ondemand.com">UI5 Developer Guide</a>.
27+
</p>
28+
</div>
3029
</body>
3130

3231
</html>

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.