spyne 0.19.1 → 0.20.1
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/.eslintignore +2 -0
- package/.eslintrc.js +4 -3
- package/.travis.yml +24 -11
- package/karma.conf.js +77 -87
- package/lib/spyne.esm.js +15 -0
- package/lib/spyne.esm.js.map +1 -0
- package/lib/spyne.js +248 -248
- package/lib/spyne.umd.js +3 -0
- package/lib/spyne.umd.js.LICENSE.txt +16 -0
- package/package.json +48 -27
- package/rollup.config.js +26 -0
- package/src/spyne/channels/channel-fetch-class.js +39 -43
- package/src/spyne/channels/channel-payload-class.js +61 -74
- package/src/spyne/channels/channel-proxy.js +25 -26
- package/src/spyne/channels/channel.js +141 -149
- package/src/spyne/channels/channels-config.js +46 -47
- package/src/spyne/channels/channels-map.js +61 -65
- package/src/spyne/channels/spyne-channel-lifecycle.js +12 -12
- package/src/spyne/channels/spyne-channel-route.js +241 -250
- package/src/spyne/channels/spyne-channel-ui.js +213 -75
- package/src/spyne/channels/spyne-channel-window.js +157 -157
- package/src/spyne/spyne-app.js +32 -19
- package/src/spyne/spyne-plugins.js +55 -70
- package/src/spyne/spyne.js +23 -23
- package/src/spyne/utils/channel-config-validator.js +10 -10
- package/src/spyne/utils/channel-fetch-util.js +72 -55
- package/src/spyne/utils/channel-payload-filter.js +89 -100
- package/src/spyne/utils/deep-merge.js +31 -29
- package/src/spyne/utils/frp-tools.js +108 -92
- package/src/spyne/utils/gc.js +6 -6
- package/src/spyne/utils/mixins/base-core-mixins.js +17 -15
- package/src/spyne/utils/mixins/base-streams-mixins.js +9 -9
- package/src/spyne/utils/route-channel-updater.js +23 -29
- package/src/spyne/utils/safe-clone.js +40 -58
- package/src/spyne/utils/sanitize-html.js +35 -0
- package/src/spyne/utils/security-policy.js +11 -0
- package/src/spyne/utils/spyne-app-properties.js +110 -114
- package/src/spyne/utils/spyne-logger.js +4 -11
- package/src/spyne/utils/spyne-plugins-methods.js +38 -63
- package/src/spyne/utils/spyne-trait.js +33 -33
- package/src/spyne/utils/spyne-utils-channel-route-url.js +229 -153
- package/src/spyne/utils/spyne-utils-channel-route.js +128 -138
- package/src/spyne/utils/spyne-utils-channel-window.js +39 -39
- package/src/spyne/utils/viewstream-animations.js +12 -12
- package/src/spyne/utils/viewstream-observables.js +45 -45
- package/src/spyne/views/dom-element-template.js +111 -114
- package/src/spyne/views/dom-element.js +82 -84
- package/src/spyne/views/view-stream-broadcaster.js +66 -62
- package/src/spyne/views/view-stream-element.js +105 -106
- package/src/spyne/views/view-stream-payload.js +25 -27
- package/src/spyne/views/view-stream-selector.js +157 -163
- package/src/spyne/views/view-stream.js +416 -640
- package/src/tests/channels/channel-dom.test.js +15 -15
- package/src/tests/channels/channel-fetch.test.js +51 -62
- package/src/tests/channels/channel-payload-class.test.js +50 -63
- package/src/tests/channels/channel-payload-filter.test.js +133 -193
- package/src/tests/channels/channel-route.test.js +102 -112
- package/src/tests/channels/channel-stream-item.test.js +19 -19
- package/src/tests/channels/channel-ui.test.js +15 -27
- package/src/tests/channels/channel-util-dom.test.js +31 -31
- package/src/tests/channels/channel.test.js +20 -25
- package/src/tests/channels/route-utils.test.js +61 -66
- package/src/tests/channels/url-utils.test.js +151 -151
- package/src/tests/channels/view-stream-broadcaster.test.js +7 -7
- package/src/tests/import.test.js +5 -5
- package/src/tests/index.js +6 -7
- package/src/tests/index.test.js +6 -8
- package/src/tests/mocks/channel-payload-data.js +218 -220
- package/src/tests/mocks/enhancer.test.js +5 -5
- package/src/tests/mocks/payload-ui.js +87 -90
- package/src/tests/mocks/routes-data.js +264 -266
- package/src/tests/mocks/spyne-docs.mocks.js +3 -3
- package/src/tests/mocks/template-renderer.mocks.js +47 -47
- package/src/tests/mocks/utils-data.js +78 -79
- package/src/tests/mocks/viewstream-internal-payload.mocks.js +50 -50
- package/src/tests/mocks/window-events-arr.js +1 -1
- package/src/tests/package-json.spec.test.js +9 -0
- package/src/tests/spyne-app.test.js +15 -18
- package/src/tests/spyne-plugin.test.js +16 -20
- package/src/tests/utils/channel-action-filter.test.js +84 -86
- package/src/tests/utils/channel-data-packet-generator.unused.js +62 -86
- package/src/tests/utils/channel-fetch-util.test.js +64 -66
- package/src/tests/utils/frp-tools.test.js +19 -19
- package/src/tests/utils/plugins-methods.test.js +31 -55
- package/src/tests/utils/security.test.js +10 -0
- package/src/tests/utils/spyne-app-properties.test.js +4 -8
- package/src/tests/views/dom-el-selectors.test.js +112 -119
- package/src/tests/views/dom-el-template-proxy.test.js +7 -0
- package/src/tests/views/dom-el-template.test.js +186 -156
- package/src/tests/views/dom-el.test.js +58 -56
- package/src/tests/views/view-stream-enhancer-loader.test.js +2 -2
- package/src/tests/views/view-stream-enhancer.test.js +11 -11
- package/src/tests/views/view-stream.test.js +22 -33
- package/webpack.config.js +76 -67
- package/docs/-_%20Solves%20equations%20of%20the%20form%20a%20_%20x%20=%20b.html +0 -487
- package/docs/DomItem.html +0 -298
- package/docs/DomItem_DomItem.html +0 -314
- package/docs/ViewStream.html +0 -2249
- package/docs/ViewStream_ViewStream.html +0 -503
- package/docs/custom/css/jsdoc-viewstream.css +0 -377
- package/docs/custom/layout.tmpl +0 -47
- package/docs/dom-item.js.html +0 -213
- package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Bold-webfont.svg +0 -1830
- package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.svg +0 -1830
- package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Light-webfont.svg +0 -1831
- package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.svg +0 -1831
- package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/global.html +0 -548
- package/docs/index-custom.html +0 -79
- package/docs/index.html +0 -82
- package/docs/jsdoc.config.json +0 -22
- package/docs/scripts/linenumber.js +0 -25
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/scripts/prettify/lang-css.js +0 -2
- package/docs/scripts/prettify/prettify.js +0 -28
- package/docs/styles/jsdoc-default.css +0 -358
- package/docs/styles/prettify-jsdoc.css +0 -111
- package/docs/styles/prettify-tomorrow.css +0 -132
- package/docs/view-stream.js.html +0 -767
|
@@ -1,84 +1,84 @@
|
|
|
1
1
|
const starWarsData = {
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
name: 'Rodolfo',
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
characters: ['Dart Vader', 'Yoda', 'Porgi', 'Princess Leia'],
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
movies: [
|
|
8
8
|
{
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
title: 'A New Hope',
|
|
10
|
+
year: '1977'
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
title: 'Attack of the Clones',
|
|
14
|
+
year: '2002'
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
title: 'The Phantom Menace',
|
|
18
|
+
year: '1999'
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
title: 'Revenge of the Sith',
|
|
22
|
+
year: '2005'
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
title: 'Return of the Jedi',
|
|
26
|
+
year: '1983'
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
title: 'The Empire Strikes Back',
|
|
30
|
+
year: '1980'
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
title: 'The Force Awakens',
|
|
34
|
+
year: '2015'
|
|
35
35
|
}
|
|
36
36
|
]
|
|
37
|
-
}
|
|
37
|
+
}
|
|
38
38
|
|
|
39
39
|
// ====================
|
|
40
40
|
|
|
41
|
-
const ScriptTemplate = document.createElement('script')
|
|
41
|
+
const ScriptTemplate = document.createElement('script')
|
|
42
42
|
|
|
43
|
-
const theDiv = document.createElement('div')
|
|
43
|
+
const theDiv = document.createElement('div')
|
|
44
44
|
|
|
45
|
-
const theH1 = document.createElement('h1')
|
|
46
|
-
theH1.textContent = 'Hello, {{name}}, here are your favorite Star Wars characters'
|
|
45
|
+
const theH1 = document.createElement('h1')
|
|
46
|
+
theH1.textContent = 'Hello, {{name}}, here are your favorite Star Wars characters'
|
|
47
47
|
|
|
48
|
-
const charactersStart = document.createTextNode('{{#characters}}')
|
|
49
|
-
const charactersEnd = document.createTextNode('{{/characters}}')
|
|
50
|
-
const charactersUl = document.createElement('ul')
|
|
51
|
-
const charactersLi = document.createElement('li')
|
|
52
|
-
charactersLi.textContent = '{{.*}}'
|
|
48
|
+
const charactersStart = document.createTextNode('{{#characters}}')
|
|
49
|
+
const charactersEnd = document.createTextNode('{{/characters}}')
|
|
50
|
+
const charactersUl = document.createElement('ul')
|
|
51
|
+
const charactersLi = document.createElement('li')
|
|
52
|
+
charactersLi.textContent = '{{.*}}'
|
|
53
53
|
|
|
54
|
-
charactersUl.appendChild(charactersStart)
|
|
55
|
-
charactersUl.appendChild(charactersLi)
|
|
56
|
-
charactersUl.appendChild(charactersEnd)
|
|
54
|
+
charactersUl.appendChild(charactersStart)
|
|
55
|
+
charactersUl.appendChild(charactersLi)
|
|
56
|
+
charactersUl.appendChild(charactersEnd)
|
|
57
57
|
|
|
58
|
-
const theH2 = document.createElement('h2')
|
|
59
|
-
theH2.textContent = 'And {{name}}, the movies were released on'
|
|
60
|
-
const moviesStart = document.createTextNode('{{#movies}}')
|
|
61
|
-
const moviesEnd = document.createTextNode('{{/movies}}')
|
|
62
|
-
const moviesUl = document.createElement('ul')
|
|
63
|
-
const moviesLi = document.createElement('li')
|
|
64
|
-
moviesLi.textContent = '{{title}} year:{{year}}'
|
|
58
|
+
const theH2 = document.createElement('h2')
|
|
59
|
+
theH2.textContent = 'And {{name}}, the movies were released on'
|
|
60
|
+
const moviesStart = document.createTextNode('{{#movies}}')
|
|
61
|
+
const moviesEnd = document.createTextNode('{{/movies}}')
|
|
62
|
+
const moviesUl = document.createElement('ul')
|
|
63
|
+
const moviesLi = document.createElement('li')
|
|
64
|
+
moviesLi.textContent = '{{title}} year:{{year}}'
|
|
65
65
|
|
|
66
|
-
moviesUl.appendChild(moviesStart)
|
|
67
|
-
moviesUl.appendChild(moviesLi)
|
|
68
|
-
moviesUl.appendChild(moviesEnd)
|
|
66
|
+
moviesUl.appendChild(moviesStart)
|
|
67
|
+
moviesUl.appendChild(moviesLi)
|
|
68
|
+
moviesUl.appendChild(moviesEnd)
|
|
69
69
|
|
|
70
|
-
theDiv.appendChild(theH1)
|
|
71
|
-
theDiv.appendChild(charactersUl)
|
|
72
|
-
theDiv.appendChild(theH2)
|
|
73
|
-
theDiv.appendChild(moviesUl)
|
|
70
|
+
theDiv.appendChild(theH1)
|
|
71
|
+
theDiv.appendChild(charactersUl)
|
|
72
|
+
theDiv.appendChild(theH2)
|
|
73
|
+
theDiv.appendChild(moviesUl)
|
|
74
74
|
|
|
75
|
-
ScriptTemplate.appendChild(theDiv)
|
|
75
|
+
ScriptTemplate.appendChild(theDiv)
|
|
76
76
|
// ScriptTemplate.text+="{{#test}}";
|
|
77
77
|
|
|
78
78
|
// const elSrc = new window.WINDOWParser().parseFromString(ScriptTemplate.innerHTML, 'text/html').body.childNodes;
|
|
79
79
|
|
|
80
|
-
const StringTemplate = '<div><h1>Hello, {{name}}, here are your favorite Star Wars characters</h1><ul>{{#characters}}<li>{{.*}}</li>{{/characters}}</ul><h2>And {{name}}, the movies were released on</h2><ul>{{#movies}}<li>{{title}} year:{{year}}</li>{{/movies}}</ul></div>'
|
|
80
|
+
const StringTemplate = '<div><h1>Hello, {{name}}, here are your favorite Star Wars characters</h1><ul>{{#characters}}<li>{{.*}}</li>{{/characters}}</ul><h2>And {{name}}, the movies were released on</h2><ul>{{#movies}}<li>{{title}} year:{{year}}</li>{{/movies}}</ul></div>'
|
|
81
81
|
|
|
82
|
-
export { ScriptTemplate, StringTemplate, starWarsData }
|
|
82
|
+
export { ScriptTemplate, StringTemplate, starWarsData }
|
|
83
83
|
|
|
84
84
|
// const markup = `<div><h1>Hello {{name}}, here are your favorite Star Wars characters</h1><ul> {{#characters}} <li>{{.*}} </li>{{/characters}}</ul><h2>And {{name}}, the movies were released on</h2><ul>{{#movies}}<li>{{title}} year:{{year}}</li>{{/movies}}<ul></div>`;
|
|
@@ -2,9 +2,9 @@ const SpyneConfigData = {
|
|
|
2
2
|
|
|
3
3
|
channels: {
|
|
4
4
|
WINDOW: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
mediaQueries: {
|
|
6
|
+
test : '(max-width: 500px)',
|
|
7
|
+
newTest : '(max-width: 800px)'
|
|
8
8
|
},
|
|
9
9
|
listenForResize: true,
|
|
10
10
|
listenForOrientation: true,
|
|
@@ -19,41 +19,41 @@ const SpyneConfigData = {
|
|
|
19
19
|
isHash: false,
|
|
20
20
|
isHidden: true,
|
|
21
21
|
routes: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
routePath: {
|
|
23
|
+
routeName: 'pageId',
|
|
24
|
+
home: '',
|
|
25
25
|
'page-one': {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
routePath: {
|
|
27
|
+
routeName: 'imageNum',
|
|
28
|
+
work : {
|
|
29
|
+
routePath: {
|
|
30
|
+
routeName: 'author',
|
|
31
|
+
hemingway: 'hemingway'
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
},
|
|
34
|
+
routePath: {
|
|
35
|
+
routeName: 'author',
|
|
36
|
+
hemingway: 'hemingway'
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
'page-one-up': {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
routePath: {
|
|
42
|
+
routeName: 'imageNum',
|
|
43
|
+
routePath: {
|
|
44
|
+
routeName: 'pixels'
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
'page-two': {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
routePath: {
|
|
50
|
+
routeName: 'photogNum'
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
'page-.*': {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
routePath: {
|
|
55
|
+
routeName: 'randomNum',
|
|
56
|
+
'thirty-two' : '32'
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -63,35 +63,35 @@ const SpyneConfigData = {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
}
|
|
66
|
+
}
|
|
67
67
|
|
|
68
68
|
const routeConfigWithRegexOverride = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
69
|
+
type: 'slash',
|
|
70
|
+
isHash: false,
|
|
71
|
+
isHidden: false,
|
|
72
|
+
routes: {
|
|
73
|
+
routePath: {
|
|
74
|
+
404: '.*',
|
|
75
|
+
routeName: 'pageId',
|
|
76
|
+
home: '^$|index.html',
|
|
77
|
+
about: 'about',
|
|
78
|
+
guide: {
|
|
79
|
+
routePath: {
|
|
80
|
+
routeName: 'section',
|
|
81
81
|
'overview|reference': {
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
routePath: {
|
|
83
|
+
routeName: 'menuItem'
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
|
-
|
|
90
|
+
regexTokens: {
|
|
91
91
|
'^$|index.html': ''
|
|
92
92
|
},
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
routeNamesArr : ['pageId', 'section', 'menuItem'],
|
|
94
|
+
paramsArr: [
|
|
95
95
|
'.*',
|
|
96
96
|
'pageId',
|
|
97
97
|
'^$|index.html',
|
|
@@ -99,16 +99,16 @@ const routeConfigWithRegexOverride = {
|
|
|
99
99
|
'section',
|
|
100
100
|
'menuItem'
|
|
101
101
|
]
|
|
102
|
-
}
|
|
102
|
+
}
|
|
103
103
|
|
|
104
104
|
const RouteDataForTests = {
|
|
105
105
|
|
|
106
106
|
multiple: {
|
|
107
107
|
|
|
108
108
|
data: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
pageId: 'page-one',
|
|
110
|
+
imageNum: '2',
|
|
111
|
+
author: 'ubalu'
|
|
112
112
|
},
|
|
113
113
|
arr: '[{"pageId":"page-one"},{"imageNum":"2"},{"author":"ubalu"}]',
|
|
114
114
|
slash: 'page-one/2/ubalu',
|
|
@@ -119,8 +119,8 @@ const RouteDataForTests = {
|
|
|
119
119
|
multipleRegex: {
|
|
120
120
|
|
|
121
121
|
data: {
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
pageId: 'page-three',
|
|
123
|
+
randomNum: '2'
|
|
124
124
|
},
|
|
125
125
|
arr: '[{"pageId":"page-three"},{"randomNum":"2"}]',
|
|
126
126
|
slash: 'page-three/2',
|
|
@@ -132,7 +132,7 @@ const RouteDataForTests = {
|
|
|
132
132
|
multipleRegexComplex: {
|
|
133
133
|
|
|
134
134
|
data: {
|
|
135
|
-
|
|
135
|
+
pageId: 'work'
|
|
136
136
|
},
|
|
137
137
|
arr: '[{"pageId":"work"},{"randomNum":"2"}]',
|
|
138
138
|
slash: 'photos/2',
|
|
@@ -141,13 +141,12 @@ const RouteDataForTests = {
|
|
|
141
141
|
|
|
142
142
|
},
|
|
143
143
|
|
|
144
|
-
|
|
145
144
|
multipleWrong: {
|
|
146
145
|
|
|
147
146
|
data: {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
pageId: 'page-four',
|
|
148
|
+
imageNum: '2',
|
|
149
|
+
author: 'ubalu'
|
|
151
150
|
},
|
|
152
151
|
arr: '[{"pageId":"page-one"},{"imageNum":"2"},{"author":"ubalu"}]',
|
|
153
152
|
slash: 'page-one/2/ubalu',
|
|
@@ -159,7 +158,7 @@ const RouteDataForTests = {
|
|
|
159
158
|
singleBasic: {
|
|
160
159
|
|
|
161
160
|
data: {
|
|
162
|
-
|
|
161
|
+
pageId: 'page-two'
|
|
163
162
|
},
|
|
164
163
|
arr: '[{"pageId":"page-two"}]',
|
|
165
164
|
slash: 'page-two',
|
|
@@ -171,8 +170,8 @@ const RouteDataForTests = {
|
|
|
171
170
|
single: {
|
|
172
171
|
|
|
173
172
|
data: {
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
pageId: 'page-two',
|
|
174
|
+
imageNum: '2'
|
|
176
175
|
},
|
|
177
176
|
arr: '[{"pageId":"page-two"}]',
|
|
178
177
|
slash: 'page-two',
|
|
@@ -183,7 +182,7 @@ const RouteDataForTests = {
|
|
|
183
182
|
home: {
|
|
184
183
|
|
|
185
184
|
data: {
|
|
186
|
-
|
|
185
|
+
pageId: 'home'
|
|
187
186
|
},
|
|
188
187
|
arr: [],
|
|
189
188
|
slash: '',
|
|
@@ -202,34 +201,34 @@ const RouteDataForTests = {
|
|
|
202
201
|
|
|
203
202
|
}
|
|
204
203
|
|
|
205
|
-
}
|
|
204
|
+
}
|
|
206
205
|
|
|
207
206
|
const payloadDataForUrlUtils = {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
207
|
+
pageId: 'home',
|
|
208
|
+
pageIdValue: '',
|
|
209
|
+
section: '',
|
|
210
|
+
menuItem: ''
|
|
211
|
+
}
|
|
213
212
|
|
|
214
213
|
const urlUtilsArr = [
|
|
215
214
|
{
|
|
216
|
-
|
|
215
|
+
pageId: '^$|index.html'
|
|
217
216
|
}
|
|
218
|
-
]
|
|
217
|
+
]
|
|
219
218
|
|
|
220
219
|
const ViewStreamHashMethodsObj = {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
220
|
+
DISPOSING: () => {},
|
|
221
|
+
DISPOSE: () => {},
|
|
222
|
+
RENDERED: () => {},
|
|
223
|
+
RENDERED_AND_ATTACHED_TO_WINDOW: () => {},
|
|
224
|
+
RENDERED_AND_ATTACHED_TO_PARENT: () => {},
|
|
225
|
+
READY_FOR_GC: () => {},
|
|
226
|
+
NOTHING: () => {},
|
|
227
|
+
CHANNEL_ROUTE_CHANGE_EVENT: () => {},
|
|
228
|
+
UI_EVENT_BLUR: () => {},
|
|
230
229
|
'UI_EVENT_.*': () => {},
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
230
|
+
UI_EVENT_CLICK: () => {},
|
|
231
|
+
UI_EVENT_DBLCLICK: () => {}
|
|
232
|
+
}
|
|
234
233
|
|
|
235
|
-
export { SpyneConfigData, RouteDataForTests, ViewStreamHashMethodsObj, routeConfigWithRegexOverride, payloadDataForUrlUtils, urlUtilsArr }
|
|
234
|
+
export { SpyneConfigData, RouteDataForTests, ViewStreamHashMethodsObj, routeConfigWithRegexOverride, payloadDataForUrlUtils, urlUtilsArr }
|
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
const internalViewStreamPayload = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
channel: 'UI',
|
|
3
|
+
action: 'CHANNEL_UI_CLICK_EVENT',
|
|
4
|
+
channelPayload: {
|
|
5
|
+
type: 'link',
|
|
6
|
+
linkType: 'external',
|
|
7
|
+
url: 'https://github.com/spynejs/spyne'
|
|
8
8
|
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
srcElement: {
|
|
10
|
+
vsid: 'header',
|
|
11
|
+
isLocalEvent: false,
|
|
12
|
+
viewName: 'HeaderView',
|
|
13
|
+
event: 'click',
|
|
14
|
+
el: ''
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
event: {
|
|
17
|
+
isTrusted: true
|
|
18
18
|
}
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
20
|
|
|
21
21
|
const internvalRouteChannelPayload = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
channel: 'CHANNEL_ROUTE',
|
|
23
|
+
action: 'CHANNEL_ROUTE_CHANGE_EVENT',
|
|
24
|
+
channelPayload: {
|
|
25
|
+
isDeepLink: false,
|
|
26
|
+
routeCount: 1,
|
|
27
|
+
routeKeyword: 'pageId',
|
|
28
|
+
routeKeywordsArr: [
|
|
29
29
|
'pageId'
|
|
30
30
|
],
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
routeData: {
|
|
32
|
+
pageId: 'guide',
|
|
33
|
+
section: 'reference',
|
|
34
|
+
menuItem: ''
|
|
35
35
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
routeValue: 'guide/reference',
|
|
37
|
+
isHash: false,
|
|
38
|
+
isHidden: false,
|
|
39
|
+
routeType: 'slash'
|
|
40
40
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
srcElement: {
|
|
42
|
+
vsid: 'header',
|
|
43
|
+
isLocalEvent: false,
|
|
44
|
+
viewName: 'HeaderView',
|
|
45
|
+
event: 'click',
|
|
46
|
+
el: {}
|
|
47
47
|
},
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
event: {
|
|
49
|
+
isTrusted: true
|
|
50
50
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
location: {
|
|
52
|
+
href: 'http://10.0.1.34:8080/guide/reference',
|
|
53
|
+
origin: 'http://10.0.1.34:8080',
|
|
54
|
+
protocol: 'http:',
|
|
55
|
+
host: '10.0.1.34:8080',
|
|
56
|
+
hostname: '10.0.1.34',
|
|
57
|
+
port: '8080',
|
|
58
|
+
pathname: '/guide/reference',
|
|
59
|
+
search: '',
|
|
60
|
+
hash: ''
|
|
61
61
|
}
|
|
62
|
-
}
|
|
62
|
+
}
|
|
63
63
|
|
|
64
|
-
export { internalViewStreamPayload, internvalRouteChannelPayload }
|
|
64
|
+
export { internalViewStreamPayload, internvalRouteChannelPayload }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { expect } from 'chai'
|
|
2
|
+
import pkg from '../../package.json' // Import package.json
|
|
3
|
+
|
|
4
|
+
describe('package.json export import statement', () => {
|
|
5
|
+
it('should be set to "./lib/spyne.esm.js"', () => {
|
|
6
|
+
const exports = pkg.exports['.']
|
|
7
|
+
expect(exports.import).to.equal('./lib/spyne.esm.js')
|
|
8
|
+
})
|
|
9
|
+
})
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
const {expect, assert} = require('chai')
|
|
2
|
-
const {SpyneApp} = require('../spyne/spyne-app')
|
|
1
|
+
const { expect, assert } = require('chai')
|
|
2
|
+
const { SpyneApp } = require('../spyne/spyne-app')
|
|
3
3
|
|
|
4
4
|
describe('should run spyne app tests', () => {
|
|
5
|
-
|
|
5
|
+
before(() => {
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})
|
|
7
|
+
// SpyneApp.init();
|
|
10
8
|
|
|
9
|
+
})
|
|
11
10
|
|
|
12
11
|
it('spyne app constructor should exist', () => {
|
|
13
|
-
const constructorName = SpyneApp.constructor.name
|
|
14
|
-
expect(constructorName).to.equal('SpyneApplication')
|
|
15
|
-
return true
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
it('should return warn if trying to initialize spyne application again', ()=>{
|
|
12
|
+
const constructorName = SpyneApp.constructor.name
|
|
13
|
+
expect(constructorName).to.equal('SpyneApplication')
|
|
14
|
+
return true
|
|
15
|
+
})
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
const
|
|
17
|
+
it('should return warn if trying to initialize spyne application again', () => {
|
|
18
|
+
const warnStr = 'The Spyne Application has already been initialized!'
|
|
19
|
+
const spyneAppInit2 = SpyneApp.init({}, true)
|
|
22
20
|
|
|
23
|
-
//console.log('second init returns string ',{spyneAppInit2, warnStr})
|
|
24
|
-
expect(spyneAppInit2).to.equal(warnStr)
|
|
21
|
+
// console.log('second init returns string ',{spyneAppInit2, warnStr})
|
|
22
|
+
expect(spyneAppInit2).to.equal(warnStr)
|
|
25
23
|
})
|
|
26
|
-
|
|
27
|
-
});
|
|
24
|
+
})
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
//import {SpyneApp} from '../spyne/spyne';
|
|
2
|
-
//const {SpyneApp} = require('../spyne/spyne');
|
|
3
|
-
const {expect, assert} = require('chai')
|
|
4
|
-
const {SpynePlugin} = require('../spyne/spyne-plugins.js')
|
|
1
|
+
// import {SpyneApp} from '../spyne/spyne';
|
|
2
|
+
// const {SpyneApp} = require('../spyne/spyne');
|
|
3
|
+
const { expect, assert } = require('chai')
|
|
4
|
+
const { SpynePlugin } = require('../spyne/spyne-plugins.js')
|
|
5
5
|
|
|
6
|
-
const name = 'mySpynePlugin'
|
|
7
|
-
const config = {debug:true}
|
|
6
|
+
const name = 'mySpynePlugin'
|
|
7
|
+
const config = { debug:true }
|
|
8
8
|
|
|
9
9
|
describe('should test use of spyne plugin', () => {
|
|
10
|
-
const baseConfig = {debug:false}
|
|
11
|
-
beforeEach(()=>{
|
|
12
|
-
|
|
10
|
+
const baseConfig = { debug:false }
|
|
11
|
+
beforeEach(() => {
|
|
13
12
|
|
|
14
13
|
})
|
|
15
14
|
|
|
16
|
-
|
|
17
15
|
it('spyne plugin should exist', () => {
|
|
18
|
-
//console.log('spyne plugin1 is ',spyneApp);
|
|
19
|
-
|
|
20
|
-
return true;
|
|
21
|
-
// expect(SpynePlugin).to.exist;
|
|
16
|
+
// console.log('spyne plugin1 is ',spyneApp);
|
|
22
17
|
|
|
23
|
-
|
|
18
|
+
return true
|
|
19
|
+
// expect(SpynePlugin).to.exist;
|
|
20
|
+
})
|
|
24
21
|
|
|
25
|
-
/*
|
|
22
|
+
/*
|
|
26
23
|
it('should get or create new spyne app', ()=>{
|
|
27
24
|
const spyneApp = SpynePlugin.getSpyneApp({name, config})
|
|
28
25
|
console.log("HERE IS ",{name, config, spyneApp})
|
|
@@ -33,7 +30,7 @@ describe('should test use of spyne plugin', () => {
|
|
|
33
30
|
|
|
34
31
|
*/
|
|
35
32
|
|
|
36
|
-
/* it('should set the plugin name', ()=>{
|
|
33
|
+
/* it('should set the plugin name', ()=>{
|
|
37
34
|
const spynePluginSetConfig = SpynePlugin.updateSpyneConfig(spyneApp, name, config);
|
|
38
35
|
|
|
39
36
|
expect(spynePluginSetConfig).to.deep.equal(config);
|
|
@@ -44,6 +41,5 @@ describe('should test use of spyne plugin', () => {
|
|
|
44
41
|
const config1 = SpynePlugin.updateSpyneConfig(spyneApp, name, config);
|
|
45
42
|
const configDupe = SpynePlugin.updateSpyneConfig(spyneApp, name, config);
|
|
46
43
|
expect(configDupe).to.be.false;
|
|
47
|
-
})*/
|
|
48
|
-
|
|
49
|
-
});
|
|
44
|
+
}) */
|
|
45
|
+
})
|