@wiztivi/dana-templates 0.0.1-beta-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app-template/.editorconfig +18 -0
- package/app-template/.eslintrc.json +5 -0
- package/app-template/.github/labeler.yml +11 -0
- package/app-template/.github/workflows/demo-ci-cd.yml +35 -0
- package/app-template/Gruntfile.js +31 -0
- package/app-template/README.md +17 -0
- package/app-template/app.config.json +54 -0
- package/app-template/i18n/LocaleStringEnUS.json +7 -0
- package/app-template/i18n/README.md +32 -0
- package/app-template/images/dana.png +0 -0
- package/app-template/images/loading.png +0 -0
- package/app-template/package.json +33 -0
- package/app-template/profiles/app.config.browser-css.json +16 -0
- package/app-template/profiles/app.config.browser-lightning.json +16 -0
- package/app-template/scripts/app/README.md +6 -0
- package/app-template/scripts/app/TemplateAppRoutes.js.hbs +18 -0
- package/app-template/scripts/app/app.js.hbs +17 -0
- package/app-template/scripts/app/theme/AppTheme.js +42 -0
- package/app-template/scripts/app/ui/screens/AppScreen.js +106 -0
- package/app-template/scripts/app/ui/screens/SplashScreen.js +58 -0
- package/app-template/scripts/app/ui/views/LoaderView.js +31 -0
- package/app-template/styles/fonts/Roboto-Bold.ttf +0 -0
- package/app-template/styles/fonts/Roboto-Regular.ttf +0 -0
- package/app-template/tests/README.md +70 -0
- package/app-template/tests/automation/features/splash.feature +5 -0
- package/app-template/tests/automation/init.js +20 -0
- package/app-template/tests/automation/steps-definitions/dictionary.js +31 -0
- package/app-template/tests/automation/steps-definitions/helpers.js +9 -0
- package/app-template/tests/unit/README.md +7 -0
- package/app-template/tests/unit/app/TemplateAppRoutes.js.hbs +24 -0
- package/components/ButtonItemView.js.hbs +66 -0
- package/components/ButtonView.js.hbs +65 -0
- package/components/ScrollItemView.js.hbs +53 -0
- package/components/ScrollView.js.hbs +44 -0
- package/components/TileView.js.hbs +55 -0
- package/components/screen.js.hbs +74 -0
- package/components/wtvMenuListView.js.hbs +38 -0
- package/components/wtvRailListView.js.hbs +41 -0
- package/components/wtvRecyclingList.js.hbs +0 -0
- package/icons/epg.png +0 -0
- package/icons/epg_focused.png +0 -0
- package/icons/home.png +0 -0
- package/icons/home_focused.png +0 -0
- package/icons/search.png +0 -0
- package/icons/search_focused.png +0 -0
- package/icons/settings.png +0 -0
- package/icons/settings_focused.png +0 -0
- package/icons/vod.png +0 -0
- package/icons/vod_focused.png +0 -0
- package/index.ts +3 -0
- package/mocks/menuMock.json +29 -0
- package/mocks/railMock.json +101 -0
- package/mocks/scrollViewMock.json +165 -0
- package/package.json +14 -0
- package/profiles/app.config.androidtv.json +21 -0
- package/profiles/app.config.tizen.json +12 -0
- package/profiles/app.config.tvos.json +18 -0
- package/profiles/app.config.webos.json +15 -0
- package/tutorial/modules/fip/package.json +4 -0
- package/tutorial/modules/fip/scripts/FipModule.js +18 -0
- package/tutorial/modules/fip/scripts/FipRoutes.js +19 -0
- package/tutorial/modules/fip/scripts/ui/screens/FipContentScreen.js +146 -0
- package/tutorial/modules/fip/scripts/ui/views/ElevatorView.js +66 -0
- package/tutorial/modules/fip/scripts/ui/views/FipContentInfoView.js +90 -0
- package/tutorial/modules/fip/scripts/ui/views/PlayButtonView.js +59 -0
- package/tutorial/vendors/customBE/package.json +5 -0
- package/tutorial/vendors/customBE/scripts/datas/contents.json +749 -0
- package/tutorial/vendors/customBE/scripts/services/CustomBEVodService.js +70 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# http://editorconfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
indent_style = space
|
|
6
|
+
indent_size = 4
|
|
7
|
+
end_of_line = lf
|
|
8
|
+
charset = utf-8
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
insert_final_newline = true
|
|
11
|
+
|
|
12
|
+
[*.md]
|
|
13
|
+
trim_trailing_whitespace = false
|
|
14
|
+
|
|
15
|
+
[*.js]
|
|
16
|
+
ij_javascript_method_call_chain_wrap = normal
|
|
17
|
+
ij_javascript_object_literal_wrap = normal
|
|
18
|
+
ij_javascript_var_declaration_wrap = split_into_lines
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: CI-CD
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
- "*-dev"
|
|
8
|
+
pull_request:
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
generate-labels:
|
|
13
|
+
name: Generate PR labels
|
|
14
|
+
uses: wiztivi-rd/shared-workflows/.github/workflows/generate-label.yml@master
|
|
15
|
+
|
|
16
|
+
lint:
|
|
17
|
+
name: Linter
|
|
18
|
+
uses: wiztivi-rd/shared-workflows/.github/workflows/npm-run.yml@master
|
|
19
|
+
secrets: inherit
|
|
20
|
+
with:
|
|
21
|
+
script: lint
|
|
22
|
+
|
|
23
|
+
unit-test:
|
|
24
|
+
name: Unit Testing
|
|
25
|
+
uses: wiztivi-rd/shared-workflows/.github/workflows/npm-run.yml@master
|
|
26
|
+
secrets: inherit
|
|
27
|
+
with:
|
|
28
|
+
script: test:unit
|
|
29
|
+
|
|
30
|
+
cucumber-test:
|
|
31
|
+
name: Cucumber Testing
|
|
32
|
+
uses: wiztivi-rd/shared-workflows/.github/workflows/npm-run.yml@master
|
|
33
|
+
secrets: inherit
|
|
34
|
+
with:
|
|
35
|
+
script: test:cucumber
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* jshint node: true */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
module.exports = function (grunt) {
|
|
5
|
+
|
|
6
|
+
// Load tasks
|
|
7
|
+
grunt.loadNpmTasks('@dana/tools-grunt');
|
|
8
|
+
|
|
9
|
+
// Define project config
|
|
10
|
+
grunt.config.merge({
|
|
11
|
+
"global": {
|
|
12
|
+
"options": {
|
|
13
|
+
"appName": "My App"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
grunt.registerTask("_dev", function () {
|
|
19
|
+
// Get tasks
|
|
20
|
+
var tasks = this.options().tasks;
|
|
21
|
+
// Run tasks
|
|
22
|
+
grunt.task.run(tasks);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
grunt.registerTask("_package", function () {
|
|
26
|
+
// Get tasks
|
|
27
|
+
var tasks = this.options().tasks;
|
|
28
|
+
// Run tasks
|
|
29
|
+
grunt.task.run(tasks);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Getting started
|
|
2
|
+
|
|
3
|
+
Start the server:
|
|
4
|
+
|
|
5
|
+
npm start
|
|
6
|
+
|
|
7
|
+
It should open a browser on `localhost:9000`.
|
|
8
|
+
|
|
9
|
+
The server watch your sources files, so you don't need to restart it when a file has been changed; simply hits the refresh button of your browser.
|
|
10
|
+
|
|
11
|
+
### Autocompletion
|
|
12
|
+
|
|
13
|
+
Dana provides autocompletion script for bash and zsh:
|
|
14
|
+
|
|
15
|
+
dana completion <bash|zsh>
|
|
16
|
+
|
|
17
|
+
**For more information, read the [Dana documentation](https://dana-framework.com/docs/overview)**
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"includes": [],
|
|
3
|
+
"default": {
|
|
4
|
+
"autoRun": true,
|
|
5
|
+
"resolution": {
|
|
6
|
+
"name": "fullHd",
|
|
7
|
+
"width": 1920,
|
|
8
|
+
"height": 1080
|
|
9
|
+
},
|
|
10
|
+
"Logger": {
|
|
11
|
+
"ConsoleAppender": {
|
|
12
|
+
"level": "info"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"locales": [
|
|
16
|
+
"en-US"
|
|
17
|
+
],
|
|
18
|
+
"AppTheme": {
|
|
19
|
+
"fonts": {
|
|
20
|
+
"RobotoRegular": {
|
|
21
|
+
"family": "Roboto",
|
|
22
|
+
"path": "styles/fonts/Roboto-Regular.ttf"
|
|
23
|
+
},
|
|
24
|
+
"RobotoBold": {
|
|
25
|
+
"family": "Roboto",
|
|
26
|
+
"path": "styles/fonts/Roboto-Bold.ttf",
|
|
27
|
+
"weight": 700
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"defaultFont": "RobotoRegular"
|
|
31
|
+
},
|
|
32
|
+
"firstRoute": {
|
|
33
|
+
"id": "splash"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"testCucumber": {
|
|
37
|
+
"mixins": [
|
|
38
|
+
"default"
|
|
39
|
+
],
|
|
40
|
+
"base": {
|
|
41
|
+
"name": "Cucumber",
|
|
42
|
+
"vendors": [
|
|
43
|
+
"@dana/engine-nodejs",
|
|
44
|
+
"@dana/vendor-test"
|
|
45
|
+
],
|
|
46
|
+
"implementations": {
|
|
47
|
+
"PlayerPrimitive": "JsonPlayerPrimitive",
|
|
48
|
+
"Animation": "JsonAnimation",
|
|
49
|
+
"KeyEventAdapter": "NodeJsTestKeyEventAdapter"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"isTest": true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Internationalization Bundles
|
|
2
|
+
|
|
3
|
+
All application interface texts should be referenced by a text key in the application code / templates
|
|
4
|
+
|
|
5
|
+
The target text must be defined in the `LocaleStringXXX.json` file contained in this folder
|
|
6
|
+
|
|
7
|
+
## Format
|
|
8
|
+
|
|
9
|
+
This will then be visible and easily editable in EXCEL as:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"id": "fr-FR",
|
|
14
|
+
"strings": {
|
|
15
|
+
"home.welcome": "welcome"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Configuration
|
|
21
|
+
|
|
22
|
+
You **MUST** configure the locales used for your application. You can have different locales depending on the profile, but each profile must at least declare one locale.
|
|
23
|
+
|
|
24
|
+
In `app.config.json`:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"default": {
|
|
29
|
+
"locales": ["en-GB", "fr-FR"]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "application",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Application build by DANA",
|
|
5
|
+
"main": "Gruntfile.js",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"JavaScript",
|
|
8
|
+
"wiztivi",
|
|
9
|
+
"DANA"
|
|
10
|
+
],
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"pre-commit": "1.2.2"
|
|
13
|
+
},
|
|
14
|
+
"engineStrict": true,
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=12.22.1",
|
|
17
|
+
"npm": ">=6.14.4"
|
|
18
|
+
},
|
|
19
|
+
"pre-commit": [
|
|
20
|
+
"lintdiff"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"start": "grunt serve --profile=template-css",
|
|
24
|
+
"lint": "wtv lint",
|
|
25
|
+
"lintdiff": "wtv lintdiff",
|
|
26
|
+
"test:unit": "wtv test:unit:project",
|
|
27
|
+
"coverage:unit": "wtv clean:unit:coverage && wtv test:unit:coverage:project",
|
|
28
|
+
"test:cucumber": "grunt dev-node --profile=testCucumber && wtv test:cucumber",
|
|
29
|
+
"coverage:cucumber": "wtv clean:cucumber:coverage && grunt dev-node --profile=testCucumber && wtv test:cucumber:coverage",
|
|
30
|
+
"test:cucumber:debug": "node --inspect --debug-brk node_modules/.bin/cucumber-js -f node_modules/wtv-cucumber-steps/src/formatters/PrettyFormatter.js --require ./node_modules/@dana/core/scripts/wiztivi/tests/cucumber/initCucumber.js --require ./tests/automation/init.js ./tests/automation/features/**/*.feature --publish-quiet --exit",
|
|
31
|
+
"ci": "npm run lint && npm run coverage:unit && npm run coverage:cucumber"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import $AbstractAppRoutes from "@AbstractAppRoutes";
|
|
2
|
+
import $SplashScreen from "@SplashScreen";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @name {{appName}}AppRoutes
|
|
7
|
+
* @class
|
|
8
|
+
* @extends AbstractAppRoutes
|
|
9
|
+
* @implementation
|
|
10
|
+
* @routes splash
|
|
11
|
+
*/
|
|
12
|
+
export default $AbstractAppRoutes.declare("{{appName}}AppRoutes", {
|
|
13
|
+
methods: /** @lends {{appName}}AppRoutes.prototype */ {
|
|
14
|
+
splash: function (data) {
|
|
15
|
+
return $SplashScreen.display(data);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// App definition
|
|
2
|
+
import $Application from "@Application";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* {{appName}}App
|
|
6
|
+
*
|
|
7
|
+
* @name {{appName}}
|
|
8
|
+
* @extends Application
|
|
9
|
+
* @class
|
|
10
|
+
*
|
|
11
|
+
* @property {string} name - Application name
|
|
12
|
+
*/
|
|
13
|
+
export default $Application.declare("{{appName}}App", {
|
|
14
|
+
properties: /** @lends {{appName}}App.prototype */ {
|
|
15
|
+
name: "{{appName}}"
|
|
16
|
+
}
|
|
17
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import $AbstractTheme from "@AbstractTheme";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The theme groups all the common properties for the ui style
|
|
5
|
+
*
|
|
6
|
+
* @name AppTheme
|
|
7
|
+
* @class
|
|
8
|
+
* @extends AbstractTheme
|
|
9
|
+
*
|
|
10
|
+
* @implementation
|
|
11
|
+
*/
|
|
12
|
+
export default $AbstractTheme.declare("AppTheme", {
|
|
13
|
+
statics: /** @lends AppTheme */ {
|
|
14
|
+
FULL_SCREEN_WIDTH: 1920,
|
|
15
|
+
FULL_SCREEN_HEIGHT: 1080,
|
|
16
|
+
DANA_LOGO_URL: "dana"
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
///////////////////////////////////////////////////////////////////////
|
|
20
|
+
// FONTS
|
|
21
|
+
///////////////////////////////////////////////////////////////////////
|
|
22
|
+
RobotoRegular: "RobotoRegular",
|
|
23
|
+
RobotoBold: "RobotoBold",
|
|
24
|
+
|
|
25
|
+
properties: /** @lends AppTheme.prototype */{},
|
|
26
|
+
|
|
27
|
+
methods: {
|
|
28
|
+
/**
|
|
29
|
+
* Return the image path
|
|
30
|
+
*
|
|
31
|
+
* @param {string} name the name of the image
|
|
32
|
+
* @param {string} extension extension of the image, default is "png"
|
|
33
|
+
* @returns {string}
|
|
34
|
+
*/
|
|
35
|
+
getImageUrl: function (name, extension) {
|
|
36
|
+
extension = extension || "png";
|
|
37
|
+
const base = this.baseUrl || this.profile.basePath || "";
|
|
38
|
+
|
|
39
|
+
return base + "images/" + name + "." + extension + (this.profile.flags.remoteBundle === true ? "?v=" + this.profile.version : "");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import $Screen from "@Screen";
|
|
2
|
+
import $ScreenEvents from "@ScreenEvents";
|
|
3
|
+
import $MNavigation from "@MNavigation";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* All screens **MUST** inherit from this screen.
|
|
7
|
+
*
|
|
8
|
+
* @name AppScreen
|
|
9
|
+
* @class
|
|
10
|
+
* @extends Screen
|
|
11
|
+
*
|
|
12
|
+
* @property {boolean} overflow true by default
|
|
13
|
+
*/
|
|
14
|
+
export default $Screen.declare("AppScreen", {
|
|
15
|
+
traits: [$MNavigation],
|
|
16
|
+
|
|
17
|
+
properties: {
|
|
18
|
+
overflow: true
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
listen: [
|
|
22
|
+
$ScreenEvents.ready
|
|
23
|
+
],
|
|
24
|
+
|
|
25
|
+
inputs: ["keypress.UP", "keypress.DOWN", "keypress.LEFT", "keypress.RIGHT", "keypress.OK", "keypress.BACK"],
|
|
26
|
+
|
|
27
|
+
methods: /** @lends AppScreen.prototype */ {
|
|
28
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
29
|
+
// EVENT CALLBACKS
|
|
30
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
31
|
+
/**
|
|
32
|
+
* Called when a screen is ready
|
|
33
|
+
* The data have been retrieved, the children are shown
|
|
34
|
+
*/
|
|
35
|
+
onScreenReady: function () {},
|
|
36
|
+
|
|
37
|
+
onKeypressLEFT: function (key) {
|
|
38
|
+
return this.left(key);
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
onKeypressRIGHT: function (key) {
|
|
42
|
+
return this.right(key);
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
onKeypressUP: function (key) {
|
|
46
|
+
return this.up(key);
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
onKeypressDOWN: function (key) {
|
|
50
|
+
return this.down(key);
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
onKeypressOK: function (key) {
|
|
54
|
+
return this.ok(key);
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
onKeypressBACK: function (key) {
|
|
58
|
+
return this.back(key);
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
62
|
+
// NAVIGATION
|
|
63
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
64
|
+
/**
|
|
65
|
+
* @override
|
|
66
|
+
*/
|
|
67
|
+
left: function (key) {
|
|
68
|
+
return this.focusedChild.hasNavigation ? this.focusedChild.left(key) : false;
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* @override
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
right: function (key) {
|
|
75
|
+
return this.focusedChild.hasNavigation ? this.focusedChild.right(key) : false;
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @override
|
|
80
|
+
*/
|
|
81
|
+
up: function (key) {
|
|
82
|
+
return this.focusedChild.hasNavigation ? this.focusedChild.up(key) : false;
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @override
|
|
87
|
+
*/
|
|
88
|
+
down: function (key) {
|
|
89
|
+
return this.focusedChild.hasNavigation ? this.focusedChild.down(key) : false;
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @override
|
|
94
|
+
*/
|
|
95
|
+
ok: function (key) {
|
|
96
|
+
throw new Error("You must implement ok !");
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @override
|
|
101
|
+
*/
|
|
102
|
+
back: function (key) {
|
|
103
|
+
throw new Error("You must implement back !");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import $AppScreen from "@AppScreen";
|
|
2
|
+
import $LoaderView from "@LoaderView";
|
|
3
|
+
import $TimerManager from "@TimerManager";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The first screen that is shown, use to show a boot splash
|
|
7
|
+
*
|
|
8
|
+
* @name SplashScreen
|
|
9
|
+
* @class
|
|
10
|
+
* @extends AppScreen
|
|
11
|
+
*
|
|
12
|
+
* @property {TimerManager} timerManager - Instance of TimerManager
|
|
13
|
+
* @property {number} splashDuration - Duration in ms to display splash screen
|
|
14
|
+
*
|
|
15
|
+
* @screen
|
|
16
|
+
*/
|
|
17
|
+
export default $AppScreen.declare("SplashScreen", {
|
|
18
|
+
statics: {
|
|
19
|
+
HIDE_SPLASH_SCREEN_TIMER_ID: "SplashScreen:Hide"
|
|
20
|
+
},
|
|
21
|
+
properties: {
|
|
22
|
+
timerManager: {class: $TimerManager},
|
|
23
|
+
splashDuration: 2000
|
|
24
|
+
},
|
|
25
|
+
children: /** @lends SplashScreen.prototype */ {
|
|
26
|
+
loader: {class: $LoaderView}
|
|
27
|
+
},
|
|
28
|
+
methods: /** @lends SplashScreen.prototype */ {
|
|
29
|
+
/**
|
|
30
|
+
* Called before the screen is shown
|
|
31
|
+
* The flow is interrupted until the promise has been resolved/rejected
|
|
32
|
+
*
|
|
33
|
+
* @param {Object} [context] The context shared by the screens during display
|
|
34
|
+
*/
|
|
35
|
+
beforeShow: function (context) {
|
|
36
|
+
this.timerManager.setTimeout(() => {
|
|
37
|
+
console.warn("FIXME: route to home !");
|
|
38
|
+
}, this.splashDuration, this.statics.HIDE_SPLASH_SCREEN_TIMER_ID);
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Called before the screen is hidden
|
|
43
|
+
* The flow is interrupted until the promise has been resolved/rejected
|
|
44
|
+
*
|
|
45
|
+
* @param {Object} [context] The context shared by the screens during display
|
|
46
|
+
*/
|
|
47
|
+
beforeHide: function (context) {
|
|
48
|
+
this.timerManager.stop(this.statics.HIDE_SPLASH_SCREEN_TIMER_ID);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
style: {
|
|
53
|
+
loader: {
|
|
54
|
+
x: ({parent}) => (parent.width - parent.loader.width) / 2,
|
|
55
|
+
y: ({parent}) => (parent.height - parent.loader.height) / 2
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import $View from "@View";
|
|
2
|
+
import $Theme from "@Theme";
|
|
3
|
+
import $ImagePrimitive from "@ImagePrimitive";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A loader
|
|
7
|
+
*
|
|
8
|
+
* @name LoaderView
|
|
9
|
+
* @class
|
|
10
|
+
* @extends View
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export default $View.declare("LoaderView", {
|
|
14
|
+
children: {
|
|
15
|
+
image: {
|
|
16
|
+
class: $ImagePrimitive,
|
|
17
|
+
url: ({theme}) => theme.getImageUrl($Theme.DANA_LOGO_URL)
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
style: {
|
|
22
|
+
width: $Theme.FULL_SCREEN_WIDTH,
|
|
23
|
+
height: $Theme.FULL_SCREEN_HEIGHT,
|
|
24
|
+
image: {
|
|
25
|
+
width: 323,
|
|
26
|
+
height: 140,
|
|
27
|
+
x: ({width}) => ($Theme.FULL_SCREEN_WIDTH - width) / 2,
|
|
28
|
+
y: ({height}) => ($Theme.FULL_SCREEN_HEIGHT - height) / 2
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Tests
|
|
2
|
+
|
|
3
|
+
Application tests can be categorized in 2 categories:
|
|
4
|
+
|
|
5
|
+
1. Behavior Tests, as in [BDD](https://en.wikipedia.org/wiki/Behavior-driven_development)
|
|
6
|
+
2. Unit Tests, as in [TDD](https://en.wikipedia.org/wiki/Test-driven_development)
|
|
7
|
+
|
|
8
|
+
## Documentation
|
|
9
|
+
|
|
10
|
+
To help writing tests, Dana provides:
|
|
11
|
+
|
|
12
|
+
* an [Overview](https://dana-framework.com/docs/tests/overview/) documentation with code examples
|
|
13
|
+
* some helpers global functions (only accessible from test files)
|
|
14
|
+
* a [Chai WTV module](https://dana-framework.com/docs/tests/ft/dana-steps/)
|
|
15
|
+
|
|
16
|
+
## Behavior Tests
|
|
17
|
+
|
|
18
|
+
They are meant to validate the implementations of the specifications given by the project owner
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
The specifications should first be written in [GherkinSyntax](http://docs.behat.org/en/v2.5/guides/1.gherkin.html) in
|
|
23
|
+
the `"features"` folder:
|
|
24
|
+
|
|
25
|
+
* Each **feature** should be described in its own `"{featureName}.feature"` file
|
|
26
|
+
* Features might be grouped by topic folders (often more or less matching main screens)
|
|
27
|
+
* Feature files contain a list of **Scenarios** (mostly matching with **user stories**)
|
|
28
|
+
|
|
29
|
+
### Specifications Tests
|
|
30
|
+
|
|
31
|
+
Executable specification test file are created in the `"spec"` folder for each existing `".feature"` file. They follow
|
|
32
|
+
the same topic folder hierarchy.
|
|
33
|
+
|
|
34
|
+
#### Note
|
|
35
|
+
|
|
36
|
+
A template can initially be created from the `".feature"` files using the command `grunt gherkin_mocha` (requires first
|
|
37
|
+
to be installed via `npm install grunt-gherkin-mocha`)
|
|
38
|
+
|
|
39
|
+
### BDD (Behavior Driven Development)
|
|
40
|
+
|
|
41
|
+
The BDD approach is to, feature by feature:
|
|
42
|
+
|
|
43
|
+
1. first get user stories and write behavior tests from them (they should all fail).
|
|
44
|
+
2. then start implementing the feature
|
|
45
|
+
3. then check its validity until all user stories (scenarios) succeed
|
|
46
|
+
|
|
47
|
+
## Unit Tests
|
|
48
|
+
|
|
49
|
+
These are more low level tests that expect to unitary confirm that a function you created will always work as expected.
|
|
50
|
+
**They are very useful to identify regressions origin** (ex: when modifying a function break another one that was using it).
|
|
51
|
+
|
|
52
|
+
Such test files are meant to be written in the `"unit"` folder.
|
|
53
|
+
|
|
54
|
+
### TDD
|
|
55
|
+
|
|
56
|
+
The TDD approach is to, JS file by JS file:
|
|
57
|
+
|
|
58
|
+
1. first write a matching unit test file with one unit test per expected function implementation (they should all fail).
|
|
59
|
+
2. then start implementing the functions in the original JS file
|
|
60
|
+
3. then check JS function implementations validity until all unit tests succeed
|
|
61
|
+
|
|
62
|
+
## Bug Tests
|
|
63
|
+
|
|
64
|
+
Each time a bug is identified by a project owner, it should be described to the developer team via user stories they can
|
|
65
|
+
follow to reproduce it.
|
|
66
|
+
|
|
67
|
+
A dedicated test should be written from this scenario:
|
|
68
|
+
|
|
69
|
+
* to be sure the issue is fixed
|
|
70
|
+
* to prevent from any further regression.
|