Skip to content

Commit 49a115c

Browse files
committed
adds de i18n
adds currency formatting
1 parent adc77b6 commit 49a115c

File tree

8 files changed

+164
-58
lines changed

8 files changed

+164
-58
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[Slides](http://slides.com/christianschuff/a-different-approach-to-ui-testing#/)
44

5+
56
## Project Template
67

78
This demo application is based on the SAP Web IDE Template 'SAP Fiori Master-Detail Application' (see .project.json).

webapp/controller/BaseController.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ sap.ui.define([
55
"use strict";
66

77
return Controller.extend("ui5experts.ui-testing.controller.BaseController", {
8+
89
/**
910
* Convenience method for accessing the router in every controller of the application.
1011
* @public
@@ -59,6 +60,11 @@ sap.ui.define([
5960
} else {
6061
this.getRouter().navTo("master", {}, true);
6162
}
63+
},
64+
65+
66+
formatStateText: function (sStatusText) {
67+
return this.getResourceBundle().getText(sStatusText);
6268
}
6369

6470
});

webapp/i18n/i18n.properties

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
appTitle=UI Testing
55

66
#YDES: Application description
7-
appDescription=Example SAPUI5 application demonstrating the use of QUnit, OPA5 and karma.
7+
appDescription=Example SAPUI5 application demonstrating the use of QUnit, OPA5, karma and BackstopJS.
88

99
#~~~ Master View ~~~~~~~~~~~~~~~~~~~~~~~~~~
1010

@@ -73,6 +73,17 @@ shareSendEmailObjectSubject=<Email subject including object identifier PLEASE RE
7373
#YMSG: Send E-Mail message
7474
shareSendEmailObjectMessage=<Email body PLEASE REPLACE ACCORDING TO YOUR USE CASE> {0} (id: {1})\r\n{2}
7575

76+
purpose=Purpose
77+
location=Location
78+
country=Country
79+
departure=Departure
80+
arrival=Arrival
81+
lastChanged=Last Changed
82+
83+
Pending=Pending
84+
Approved=Approved
85+
Rejected=Rejected
86+
7687
#~~~ Not Found View ~~~~~~~~~~~~~~~~~~~~~~~
7788

7889
#XTIT: Not found view title

webapp/i18n/i18n_de.properties

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# This is the resource bundle for UI5Experts - UI Testing
2+
3+
#XTIT: Application name
4+
appTitle=UI Testing
5+
6+
#YDES: Application description
7+
appDescription=Example SAPUI5 application demonstrating the use of QUnit, OPA5, karma and BackstopJS.
8+
9+
#~~~ Master View ~~~~~~~~~~~~~~~~~~~~~~~~~~
10+
11+
#XTIT: Master view title with placeholder for the number of items
12+
masterTitleCount=Reisen ({0})
13+
14+
#XTOL: Tooltip for the search field
15+
masterSearchTooltip=Enter a travel name or a part of it.
16+
17+
#XBLI: text for a list with no data
18+
masterListNoDataText=No travels are currently available
19+
20+
#XBLI: text for a list with no data with filter or search
21+
masterListNoDataWithFilterOrSearchText=No matching travels found
22+
23+
#XSEL: Option to sort the master list by TripActivityName
24+
masterSort1=Sortieren nach Reisename
25+
26+
#XSEL: Option to sort the master list by Estimated Cost
27+
masterSort2=Sortieren nach geschätzten Kosten
28+
29+
#XSEL: Option to filter the master list by Estimated Cost
30+
masterFilterName=Geschätzte Kosten
31+
32+
#XSEL: Option to not filter the master list
33+
masterFilterNone=Keiner
34+
35+
#XSEL: Option to filter the master list by EstimatedCost/Currency if the value is less than 1000
36+
masterFilter1=< 1000
37+
38+
#XSEL: Option to filter the master list by EstimatedCost/Currency if the value is greater than 1000
39+
masterFilter2=> 1000
40+
41+
#YMSG: Filter text that is displayed above the master list
42+
masterFilterBarText=Gefiltert nach {0}
43+
44+
#XSEL: Option to not group the master list
45+
masterGroupNone=(Nicht gruppiert)
46+
47+
#XSEL: Option to group the master list by Estimated Cost
48+
masterGroup1=Geschätzte Kosten
49+
50+
#XGRP: Group header Estimated Cost
51+
masterGroup1Header1=Geschätzte Kosten 1000 oder weniger
52+
53+
#XGRP: Group header Estimated Cost
54+
masterGroup1Header2=Geschätzte Kosten höher als 1000
55+
56+
#~~~ Detail View ~~~~~~~~~~~~~~~~~~~~~~~~~~
57+
58+
#XTIT: Detail view title
59+
detailTitle=Reisedetails
60+
61+
#XTOL: Icon Tab Bar Info
62+
detailIconTabBarInfo=Info
63+
64+
#XTOL: Icon Tab Bar Attachments
65+
detailIconTabBarAttachments=Anhänge
66+
67+
#XTIT: Save as tile app title
68+
shareSaveTileAppTitle=UI5Experts - UI Testing - {0}
69+
70+
#XTIT: Send E-Mail subject
71+
shareSendEmailObjectSubject=<Email subject including object identifier PLEASE REPLACE ACCORDING TO YOUR USE CASE> {0}
72+
73+
#YMSG: Send E-Mail message
74+
shareSendEmailObjectMessage=<Email body PLEASE REPLACE ACCORDING TO YOUR USE CASE> {0} (id: {1})\r\n{2}
75+
76+
purpose=Anlass
77+
location=Ziel
78+
country=Land
79+
departure=Abreise
80+
arrival=Ankunft
81+
lastChanged=Letzte Änderung
82+
83+
Pending=Wartend
84+
Approved=Genehmigt
85+
Rejected=Abgelehnt
86+
87+
#~~~ Not Found View ~~~~~~~~~~~~~~~~~~~~~~~
88+
89+
#XTIT: Not found view title
90+
notFoundTitle=Nicht Gefunden
91+
92+
#YMSG: The travels not found text is displayed when there is no travels with this id
93+
noObjectFoundText=Diese Reise ist nicht verfügbar
94+
95+
#YMSG: The travels not available text is displayed when there is no data when starting the app
96+
noObjectsAvailableText=Keine Reisen sind momentan verfügbar
97+
98+
#YMSG: The not found text is displayed when there was an error loading the resource (404 error)
99+
notFoundText=Die angeforderte Reise wurde nicht gefunden
100+
101+
#~~~ Not Available View ~~~~~~~~~~~~~~~~~~~~~~~
102+
103+
#XTIT: Master view title
104+
notAvailableViewTitle=Reisen
105+
106+
#~~~ Error Handling ~~~~~~~~~~~~~~~~~~~~~~~
107+
108+
#YMSG: Error dialog description
109+
errorText=Sorry, a technical error occurred! Please try again later.

webapp/localService/mockdata/Travels.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"EstimatedCost": {
44
"Currency": "EUR",
5-
"Value": "1299.99"
5+
"Value": 1299.99
66
},
77
"LastChangeDate": "/Date(1327063328000)/",
88
"TripActivityName": "Customer Visit",
@@ -37,7 +37,7 @@
3737
{
3838
"EstimatedCost": {
3939
"Currency": "EUR",
40-
"Value": "2799.00"
40+
"Value": 2799.00
4141
},
4242
"LastChangeDate": "/Date(1370691728000)/",
4343
"TripActivityName": "China",
@@ -72,7 +72,7 @@
7272
{
7373
"EstimatedCost": {
7474
"Currency": "EUR",
75-
"Value": "17042.14"
75+
"Value": 17042.14
7676
},
7777
"LastChangeDate": "/Date(998826128000)/",
7878
"TripActivityName": "Going to Ibiza",
@@ -107,7 +107,7 @@
107107
{
108108
"EstimatedCost": {
109109
"Currency": "EUR",
110-
"Value": "1869.81"
110+
"Value": 1869.81
111111
},
112112
"LastChangeDate": "/Date(1272022928000)/",
113113
"TripActivityName": "Hawaii Incentive",
@@ -142,10 +142,10 @@
142142
{
143143
"EstimatedCost": {
144144
"Currency": "USD",
145-
"Value": "478.61"
145+
"Value": 478.61
146146
},
147147
"LastChangeDate": "/Date(1319715728000)/",
148-
"TripActivityName": "sitBERN",
148+
"TripActivityName": "sitFRA",
149149
"Id": "Id 5",
150150
"Purpose": "Purpose 5",
151151
"Departure": "/Date(1014208928000)/",
@@ -177,7 +177,7 @@
177177
{
178178
"EstimatedCost": {
179179
"Currency": "USD",
180-
"Value": "1235.50"
180+
"Value": 1235.50
181181
},
182182
"LastChangeDate": "/Date(1210592528000)/",
183183
"TripActivityName": "Eis essen",
@@ -212,7 +212,7 @@
212212
{
213213
"EstimatedCost": {
214214
"Currency": "EUR",
215-
"Value": "2777.92"
215+
"Value": 2777.92
216216
},
217217
"LastChangeDate": "/Date(1140871328000)/",
218218
"TripActivityName": "Business Trip",
@@ -247,7 +247,7 @@
247247
{
248248
"EstimatedCost": {
249249
"Currency": "EUR",
250-
"Value": "9230.06"
250+
"Value": 9230.06
251251
},
252252
"LastChangeDate": "/Date(1103719328000)/",
253253
"TripActivityName": "Business Trip",
@@ -282,7 +282,7 @@
282282
{
283283
"EstimatedCost": {
284284
"Currency": "EUR",
285-
"Value": "4667.41"
285+
"Value": 4667.41
286286
},
287287
"LastChangeDate": "/Date(1119094928000)/",
288288
"TripActivityName": "Business Trip",
@@ -317,7 +317,7 @@
317317
{
318318
"EstimatedCost": {
319319
"Currency": "EUR",
320-
"Value": "1850.04"
320+
"Value": 1850.04
321321
},
322322
"LastChangeDate": "/Date(954157328000)/",
323323
"TripActivityName": "Business Trip",

webapp/model/formatter.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,6 @@ sap.ui.define([
77
"use strict";
88

99
return {
10-
/**
11-
* Rounds the currency value to 2 digits
12-
*
13-
* @public
14-
* @param {string} sValue value to be formatted
15-
* @returns {string} formatted currency value with 2 digits
16-
*/
17-
currencyValue: function (sValue) {
18-
if (!sValue) {
19-
return "";
20-
}
21-
22-
return parseFloat(sValue).toFixed(2);
23-
},
24-
2510

2611
state: function (sState) {
2712
switch (sState) {

webapp/view/Detail.view.xml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,23 @@
1616
busyIndicatorDelay="{detailView>/delay}">
1717

1818
<semantic:content>
19-
20-
<!--number="{-->
21-
<!--path: 'EstimatedCost/Value',-->
22-
<!--type: 'sap.ui.model.type.Currency',-->
23-
<!--formatOptions: {-->
24-
<!--source: {-->
25-
<!--groupingSeparator: '',-->
26-
<!--decimalSeparator: '.'-->
27-
<!--}-->
28-
<!--}-->
29-
<!--}"-->
3019
<ObjectHeader
3120
id="objectHeader"
3221
icon="sap-icon://flight"
3322
title="{TripActivityName}"
3423
number="{
3524
path: 'EstimatedCost/Value',
36-
formatter: '.formatter.currencyValue'
25+
type: 'sap.ui.model.type.Float'
3726
}"
3827
numberUnit="{EstimatedCost/Currency}">
3928
<attributes>
40-
<ObjectAttribute text="{RequesterLastName}, {RequesterFirstName}" />
29+
<ObjectAttribute text="{RequesterLastname}, {RequesterFirstName}" />
4130
</attributes>
4231
<statuses>
43-
<ObjectStatus text="{Status}"
32+
<ObjectStatus text="{
33+
path: 'Status',
34+
formatter: '.formatStateText'
35+
}"
4436
icon="{
4537
path: 'Status',
4638
formatter: '.formatter.stateIcon'
@@ -61,17 +53,17 @@
6153
tooltip="{i18n>detailIconTabBarInfo}">
6254
<content>
6355
<f:SimpleForm>
64-
<Label text="Purpose" />
56+
<Label text="{i18n>purpose}" />
6557
<Text text="{Purpose}" />
66-
<Label text="Location" />
58+
<Label text="{i18n>location}" />
6759
<Text text="{Location}" />
68-
<Label text="Country" />
60+
<Label text="{i18n>country}" />
6961
<Text text="{CountryName} ({CountryCode})" />
70-
<Label text="Departure" />
62+
<Label text="{i18n>departure}" />
7163
<Text text="{ path: 'Departure', type: 'sap.ui.model.type.DateTime' }" />
72-
<Label text="Arrival" />
64+
<Label text="{i18n>arrival}" />
7365
<Text text="{ path: 'Arrival', type: 'sap.ui.model.type.DateTime' }" />
74-
<Label text="Last Changed" />
66+
<Label text="{i18n>lastChanged}" />
7567
<Text text="{ path: 'LastChangeDate', type: 'sap.ui.model.type.DateTime' }" />
7668
</f:SimpleForm>
7769
</content>

webapp/view/Master.view.xml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,25 @@
7575
title="{TripActivityName}"
7676
number="{
7777
path: 'EstimatedCost/Value',
78-
formatter: '.formatter.currencyValue'
78+
type: 'sap.ui.model.type.Float'
7979
}"
8080
numberUnit="{EstimatedCost/Currency}">
8181
<attributes>
8282
<ObjectAttribute text="{RequesterLastName}, {RequesterFirstName}" />
8383
</attributes>
8484
<firstStatus>
85-
<ObjectStatus
86-
text="{Status}"
87-
icon="{
88-
path: 'Status',
89-
formatter: '.formatter.stateIcon'
90-
}"
91-
state="{
92-
path: 'Status',
93-
formatter: '.formatter.state'
94-
}" />
85+
<ObjectStatus text="{
86+
path: 'Status',
87+
formatter: '.formatStateText'
88+
}"
89+
icon="{
90+
path: 'Status',
91+
formatter: '.formatter.stateIcon'
92+
}"
93+
state="{
94+
path: 'Status',
95+
formatter: '.formatter.state'
96+
}" />
9597
</firstStatus>
9698
</ObjectListItem>
9799
</items>

0 commit comments

Comments
 (0)