-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic Setup: Added and adjusted everything needed for Step 1: Overvie…
…w and Testing Strategy - to get started with the application
- Loading branch information
Showing
31 changed files
with
1,134 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,30 @@ | ||
sap.ui.define([ | ||
"com/mrb/UI5-Testing/controller/BaseController" | ||
], function( | ||
BaseController | ||
) { | ||
"use strict"; | ||
sap.ui.define( | ||
[ | ||
"./BaseController", | ||
"sap/ui/model/json/JSONModel", | ||
], | ||
function (BaseController, JSONModel) { | ||
"use strict"; | ||
|
||
return BaseController.extend("com.mrb.UI5-Testing.controller.App.Controller", { | ||
}); | ||
}); | ||
return BaseController.extend( | ||
"com.mrb.UI5-Testing.controller.App.Controller", | ||
{ | ||
onInit: function () { | ||
var oViewModel = new JSONModel({ | ||
busy: true, | ||
delay: 0, | ||
}); | ||
|
||
this.setModel(oViewModel, "appView"); | ||
|
||
this.getOwnerComponent() | ||
.getModel() | ||
.metadataLoaded() | ||
.then(function () { | ||
oViewModel.setProperty("/busy", false); | ||
}); | ||
}, | ||
} | ||
); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,78 @@ | ||
sap.ui.define([ | ||
"sap/ui/core/mvc/Controller", | ||
"sap/ui/core/routing/History", | ||
"sap/ui/core/UIComponent", | ||
"com/mrb/UI5-Testing/model/formatter" | ||
], function(Controller, History, UIComponent, formatter) { | ||
"use strict"; | ||
sap.ui.define( | ||
[ | ||
"sap/ui/core/mvc/Controller", | ||
"sap/ui/core/routing/History", | ||
"sap/ui/core/UIComponent", | ||
"com/mrb/UI5-Testing/model/formatter", | ||
], | ||
function (Controller, History, UIComponent, formatter) { | ||
"use strict"; | ||
|
||
return Controller.extend("com.mrb.UI5-Testing.controller.BaseController", { | ||
return Controller.extend("com.mrb.UI5-Testing.controller.BaseController", { | ||
formatter: formatter, | ||
/** | ||
* Convenience method for accessing the event bus. | ||
* @public | ||
* @returns {sap.ui.core.EventBus} the event bus for this component | ||
*/ | ||
getEventBus: function () { | ||
return this.getOwnerComponent().getEventBus(); | ||
}, | ||
|
||
formatter: formatter, | ||
/** | ||
* Convenience method for getting the view model by name in every controller of the application. | ||
* @public | ||
* @param {string} sName the model name | ||
* @returns {sap.ui.model.Model} the model instance | ||
*/ | ||
getModel: function (sName) { | ||
return this.getView().getModel(sName); | ||
}, | ||
|
||
/** | ||
* Convenience method for getting the view model by name in every controller of the application. | ||
* @public | ||
* @param {string} sName the model name | ||
* @returns {sap.ui.model.Model} the model instance | ||
*/ | ||
getModel: function(sName) { | ||
return this.getView().getModel(sName); | ||
}, | ||
/** | ||
* Convenience method for setting the view model in every controller of the application. | ||
* @public | ||
* @param {sap.ui.model.Model} oModel the model instance | ||
* @param {string} sName the model name | ||
* @returns {sap.ui.mvc.View} the view instance | ||
*/ | ||
setModel: function (oModel, sName) { | ||
return this.getView().setModel(oModel, sName); | ||
}, | ||
|
||
/** | ||
* Convenience method for setting the view model in every controller of the application. | ||
* @public | ||
* @param {sap.ui.model.Model} oModel the model instance | ||
* @param {string} sName the model name | ||
* @returns {sap.ui.mvc.View} the view instance | ||
*/ | ||
setModel: function(oModel, sName) { | ||
return this.getView().setModel(oModel, sName); | ||
}, | ||
/** | ||
* Convenience method for getting the resource bundle. | ||
* @public | ||
* @returns {sap.ui.model.resource.ResourceModel} the resourceModel of the component | ||
*/ | ||
getResourceBundle: function () { | ||
return this.getOwnerComponent().getModel("i18n").getResourceBundle(); | ||
}, | ||
|
||
/** | ||
* Convenience method for getting the resource bundle. | ||
* @public | ||
* @returns {sap.ui.model.resource.ResourceModel} the resourceModel of the component | ||
*/ | ||
getResourceBundle: function() { | ||
return this.getOwnerComponent().getModel("i18n").getResourceBundle(); | ||
}, | ||
/** | ||
* Method for navigation to specific view | ||
* @public | ||
* @param {string} psTarget Parameter containing the string for the target navigation | ||
* @param {mapping} pmParameters? Parameters for navigation | ||
* @param {boolean} pbReplace? Defines if the hash should be replaced (no browser history entry) or set (browser history entry) | ||
*/ | ||
navTo: function (psTarget, pmParameters, pbReplace) { | ||
this.getRouter().navTo(psTarget, pmParameters, pbReplace); | ||
}, | ||
|
||
/** | ||
* Method for navigation to specific view | ||
* @public | ||
* @param {string} psTarget Parameter containing the string for the target navigation | ||
* @param {mapping} pmParameters? Parameters for navigation | ||
* @param {boolean} pbReplace? Defines if the hash should be replaced (no browser history entry) or set (browser history entry) | ||
*/ | ||
navTo: function(psTarget, pmParameters, pbReplace) { | ||
this.getRouter().navTo(psTarget, pmParameters, pbReplace); | ||
}, | ||
getRouter: function () { | ||
return UIComponent.getRouterFor(this); | ||
}, | ||
|
||
getRouter: function() { | ||
return UIComponent.getRouterFor(this); | ||
}, | ||
onNavBack: function () { | ||
var sPreviousHash = History.getInstance().getPreviousHash(); | ||
|
||
onNavBack: function() { | ||
var sPreviousHash = History.getInstance().getPreviousHash(); | ||
|
||
if (sPreviousHash !== undefined) { | ||
window.history.back(); | ||
} else { | ||
this.getRouter().navTo("appHome", {}, true /*no history*/ ); | ||
} | ||
} | ||
|
||
}); | ||
|
||
}); | ||
if (sPreviousHash !== undefined) { | ||
window.history.back(); | ||
} else { | ||
this.getRouter().navTo("appHome", {}, true /*no history*/); | ||
} | ||
}, | ||
}); | ||
} | ||
); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
sap.ui.define( | ||
[ | ||
"./BaseController", | ||
"sap/ui/model/json/JSONModel", | ||
"../model/formatter", | ||
"sap/m/library", | ||
], | ||
function (BaseController, JSONModel, formatter, mobileLibrary) { | ||
"use strict"; | ||
|
||
return BaseController.extend("com.mrb.UI5-Testing.controller.Worklist", { | ||
/** | ||
* Called when the worklist controller is instantiated. | ||
* @public | ||
*/ | ||
onInit: function () { | ||
var oViewModel, | ||
iOriginalBusyDelay, | ||
oTable = this.byId("table"); | ||
|
||
// Put down worklist table's original value for busy indicator delay, | ||
// so it can be restored later on. Busy handling on the table is | ||
// taken care of by the table itself. | ||
iOriginalBusyDelay = oTable.getBusyIndicatorDelay(); | ||
|
||
// Model used to manipulate control states | ||
oViewModel = new JSONModel({ | ||
worklistTableTitle: this.getResourceBundle().getText( | ||
"worklistTableTitle" | ||
), | ||
shareSendEmailSubject: this.getResourceBundle().getText( | ||
"shareSendEmailWorklistSubject" | ||
), | ||
shareSendEmailMessage: this.getResourceBundle().getText( | ||
"shareSendEmailWorklistMessage", | ||
[window.location.href] | ||
), | ||
tableBusyDelay: 0, | ||
}); | ||
this.setModel(oViewModel, "worklistView"); | ||
|
||
// Make sure, busy indication is showing immediately so there is no | ||
// break after the busy indication for loading the view's meta data is | ||
// ended (see promise 'oWhenMetadataIsLoaded' in AppController) | ||
oTable.attachEventOnce("updateFinished", function () { | ||
// Restore original busy indicator delay for worklist's table | ||
oViewModel.setProperty("/tableBusyDelay", iOriginalBusyDelay); | ||
}); | ||
}, | ||
|
||
/* =========================================================== */ | ||
/* event handlers */ | ||
/* =========================================================== */ | ||
|
||
/** | ||
* Triggered by the table's 'updateFinished' event: after new table | ||
* data is available, this handler method updates the table counter. | ||
* This should only happen if the update was successful, which is | ||
* why this handler is attached to 'updateFinished' and not to the | ||
* table's list binding's 'dataReceived' method. | ||
* | ||
* @param {sap.ui.base.Event} oEvent the update finished event | ||
* @public | ||
*/ | ||
onUpdateFinished: function (oEvent) { | ||
// update the worklist's object counter after the table update | ||
var sTitle, | ||
oTable = oEvent.getSource(), | ||
iTotalItems = oEvent.getParameter("total"); | ||
// only update the counter if the length is final and | ||
// the table is not empty | ||
if (iTotalItems && oTable.getBinding("items").isLengthFinal()) { | ||
sTitle = this.getResourceBundle().getText("worklistTableTitleCount", [ | ||
iTotalItems, | ||
]); | ||
} else { | ||
sTitle = this.getResourceBundle().getText("worklistTableTitle"); | ||
} | ||
this.getModel("worklistView").setProperty( | ||
"/worklistTableTitle", | ||
sTitle | ||
); | ||
}, | ||
/** | ||
* Sets the item count on the worklist view header | ||
* @param {int} iTotalItems the total number of items in the table | ||
* @private | ||
*/ | ||
_updateListItemCount: function (iTotalItems) { | ||
var sTitle; | ||
// only update the counter if the length is final | ||
if (this._oTable.getBinding("items").isLengthFinal()) { | ||
sTitle = this.getResourceBundle().getText("worklistTableTitleCount", [ | ||
iTotalItems, | ||
]); | ||
this.oViewModel.setProperty("/worklistTableTitle", sTitle); | ||
} | ||
}, | ||
|
||
/** | ||
* Event handler when the share by E-Mail button has been clicked | ||
* @public | ||
*/ | ||
onShareEmailPress: function () { | ||
var oViewModel = this.getModel("worklistView"); | ||
mobileLibrary.URLHelper.triggerEmail( | ||
null, | ||
oViewModel.getProperty("/shareSendEmailSubject"), | ||
oViewModel.getProperty("/shareSendEmailMessage") | ||
); | ||
}, | ||
}); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,37 @@ | ||
title=UI5-Testing | ||
appTitle=UI5-Testing | ||
appDescription=UI5 Testing Walkthrough | ||
|
||
# This is the resource bundle for the worklist app | ||
|
||
#~~~ Worklist View ~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
#XTIT: Table view title - Not used as we're using the Repository 'UI5-Testing' title | ||
worklistViewTitle=Bulletin Board | ||
|
||
#XTIT: Table view title | ||
worklistTableTitle=Posts | ||
|
||
#XTIT: Table view title with placeholder for the number of items | ||
worklistTableTitleCount=Posts ({0}) | ||
|
||
#XTIT: The title of the column containing the Names of objects | ||
TableNameColumnTitle=Name | ||
|
||
#XTIT: The title of the column containing the Category of objects | ||
TableCategoryColumnTitle=Category | ||
|
||
#XTIT: The title of the column containing the unit number and the unit of measure | ||
TableUnitNumberColumnTitle=Price | ||
|
||
#~~~ Object View ~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
#XTIT: Object view title | ||
objectTitle=Post | ||
|
||
#~~~ Footer Options ~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
#XTIT: Send E-Mail subject | ||
shareSendEmailWorklistSubject=<Email subject PLEASE REPLACE ACCORDING TO YOUR USE CASE> | ||
|
||
#YMSG: Send E-Mail message | ||
shareSendEmailWorklistMessage=<Email body PLEASE REPLACE ACCORDING TO YOUR USE CASE>\r\n{0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link href="/resources/img/ui5.png" rel="shortcut icon" type="image/x-icon" /> | ||
<title>Bulletin Board</title> | ||
|
||
<!-- try to load the basic UI5 styles for standalone and demokit usecase --> | ||
<link rel="stylesheet" href="/resources/sap/ui/core/themes/sap_fiori_3/library.css"> | ||
<link rel="stylesheet" href="/resources/sap/ui/core/themes/sap_fiori_3/library.css"> | ||
</head> | ||
|
||
<title>UI5-Testing</title> | ||
<body class="sapUiBody sapUiForceWidthAuto"> | ||
<div style="display: flex; flex-direction: column; align-items: center; margin-top: 15vh;"> | ||
<h1>Bulletin Board</h1> | ||
<p>This sample app for the testing will test application functionality <br> with QUnit, OPA5, and the mock | ||
server</p> | ||
|
||
<script id="sap-ui-bootstrap" | ||
src="resources/sap-ui-core.js" | ||
data-sap-ui-theme="sap_fiori_3" | ||
data-sap-ui-resourceroots='{ | ||
"com.mrb.UI5-Testing": "./" | ||
}' | ||
data-sap-ui-oninit="module:sap/ui/core/ComponentSupport" | ||
data-sap-ui-compatVersion="edge" | ||
data-sap-ui-async="true" | ||
data-sap-ui-frameOptions="trusted" | ||
data-sap-ui-logLevel="NONE"> | ||
</script> | ||
</head> | ||
<h2>Entry points</h2> | ||
<p>Can be used to run the app or the automated tests as needed:</p> | ||
|
||
<body class="sapUiBody"> | ||
<div data-sap-ui-component data-name="com.mrb.UI5-Testing" data-id="container" | ||
data-settings='{"id" : "UI5-Testing"}'> | ||
</div> | ||
<ul> | ||
<li><a href="test/mockServer.html">mockServer.html</a> - start the app with mock data</li> | ||
<li><a href="test/unit/unitTests.qunit.html">unit/unitTests.qunit.html</a> - run all unit tests</li> | ||
<li><a href="test/integration/opaTests.qunit.html">integration/opaTests.qunit.html</a> - run all integration | ||
tests</li> | ||
</ul> | ||
<p>For more documentation please read the <a href="https://openui5.hana.ondemand.com">UI5 Developer Guide</a>. | ||
</p> | ||
</div> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.