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,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const spynePluginMethods = new SpynePluginsMethods();
|
|
1
|
+
import { SpynePluginsMethods } from '../../spyne/utils/spyne-plugins-methods'
|
|
2
|
+
const { expect, assert } = require('chai')
|
|
7
3
|
|
|
4
|
+
const spynePluginMethods = new SpynePluginsMethods()
|
|
8
5
|
|
|
9
6
|
const methodsObj = {
|
|
10
|
-
myFn1: ()=>{
|
|
7
|
+
myFn1: () => {
|
|
11
8
|
return 'first method value'
|
|
12
9
|
},
|
|
13
10
|
|
|
14
|
-
myFn2: ()=>{
|
|
11
|
+
myFn2: () => {
|
|
15
12
|
return 'second method vaue'
|
|
16
13
|
}
|
|
17
14
|
|
|
@@ -19,85 +16,64 @@ const methodsObj = {
|
|
|
19
16
|
|
|
20
17
|
const dupeMethods = {
|
|
21
18
|
|
|
22
|
-
myFn1: ()=>{
|
|
19
|
+
myFn1: () => {
|
|
23
20
|
return 'this is a dupe method'
|
|
24
21
|
},
|
|
25
22
|
|
|
26
|
-
myFn4: ()=>{
|
|
23
|
+
myFn4: () => {
|
|
27
24
|
return 'second method vaue'
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
27
|
}
|
|
33
28
|
|
|
34
|
-
|
|
35
29
|
const methodsObjWrong = {
|
|
36
|
-
myStr1:
|
|
30
|
+
myStr1: 'This should be a valid method.',
|
|
37
31
|
|
|
38
|
-
myFn3: ()=>{
|
|
32
|
+
myFn3: () => {
|
|
39
33
|
return 'second method vaue'
|
|
40
34
|
}
|
|
41
35
|
}
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
37
|
const methodsArr = [
|
|
47
38
|
{
|
|
48
|
-
myFn1: ()=>{
|
|
39
|
+
myFn1: () => {
|
|
49
40
|
return 'first method value'
|
|
50
41
|
}
|
|
51
42
|
}
|
|
52
43
|
]
|
|
53
44
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
//console.log('plugin methods1 is ',{spynePluginMethods})
|
|
45
|
+
// console.log('plugin methods1 is ',{spynePluginMethods})
|
|
57
46
|
|
|
58
47
|
describe('should test spyne plugins methods', () => {
|
|
59
|
-
|
|
60
48
|
it('should test that SpynePluginsMethods exists', () => {
|
|
61
|
-
|
|
62
|
-
expect(spynePluginMethods).to.exist;
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('should get the plugin object', ()=>{
|
|
67
|
-
const pluginsMethodObj = spynePluginMethods.pluginMethodsObj
|
|
68
|
-
expect(pluginsMethodObj).to.be.an('object');
|
|
69
|
-
|
|
49
|
+
expect(spynePluginMethods).to.exist
|
|
70
50
|
})
|
|
71
51
|
|
|
72
|
-
it('should
|
|
73
|
-
const
|
|
74
|
-
expect(
|
|
52
|
+
it('should get the plugin object', () => {
|
|
53
|
+
const pluginsMethodObj = spynePluginMethods.pluginMethodsObj
|
|
54
|
+
expect(pluginsMethodObj).to.be.an('object')
|
|
75
55
|
})
|
|
76
56
|
|
|
77
|
-
it('should
|
|
78
|
-
const warnStr = spynePluginMethods.addMethods(
|
|
79
|
-
expect(warnStr).to.be.a('string')
|
|
57
|
+
it('should check if methodsObj is valid obj', () => {
|
|
58
|
+
const warnStr = spynePluginMethods.addMethods(methodsArr, true)
|
|
59
|
+
expect(warnStr).to.be.a('string')
|
|
80
60
|
})
|
|
81
61
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
spynePluginMethods.addMethods(methodsObj);
|
|
87
|
-
|
|
88
|
-
const pluginMethodsObj = spynePluginMethods.pluginMethodsObj;
|
|
89
|
-
const firstMethodVal =pluginMethodsObj.myFn1()
|
|
90
|
-
expect(firstMethodVal).to.equal(methodsObj.myFn1());
|
|
91
|
-
|
|
62
|
+
it('should return error for non method vals', () => {
|
|
63
|
+
const warnStr = spynePluginMethods.addMethods(methodsObjWrong, true)
|
|
64
|
+
expect(warnStr).to.be.a('string')
|
|
92
65
|
})
|
|
93
66
|
|
|
67
|
+
it('should add methods from key value pairs', () => {
|
|
68
|
+
spynePluginMethods.addMethods(methodsObj)
|
|
94
69
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
expect(warnStr).to.be.a('string');
|
|
99
|
-
|
|
70
|
+
const pluginMethodsObj = spynePluginMethods.pluginMethodsObj
|
|
71
|
+
const firstMethodVal = pluginMethodsObj.myFn1()
|
|
72
|
+
expect(firstMethodVal).to.equal(methodsObj.myFn1())
|
|
100
73
|
})
|
|
101
74
|
|
|
102
|
-
|
|
103
|
-
|
|
75
|
+
it('should capture already created methods', () => {
|
|
76
|
+
const warnStr = spynePluginMethods.addMethods(dupeMethods, true)
|
|
77
|
+
expect(warnStr).to.be.a('string')
|
|
78
|
+
})
|
|
79
|
+
})
|
|
@@ -1,148 +1,141 @@
|
|
|
1
|
-
import { spyneDocsDomStr } from '../mocks/spyne-docs.mocks'
|
|
2
|
-
import { ViewStreamSelector } from '../../spyne/views/view-stream-selector'
|
|
1
|
+
import { spyneDocsDomStr } from '../mocks/spyne-docs.mocks'
|
|
2
|
+
import { ViewStreamSelector } from '../../spyne/views/view-stream-selector'
|
|
3
3
|
|
|
4
|
-
import * as R from 'ramda'
|
|
4
|
+
import * as R from 'ramda'
|
|
5
5
|
|
|
6
6
|
describe('Dom Item Selector', () => {
|
|
7
7
|
beforeEach(function() {
|
|
8
|
-
document.body.insertAdjacentHTML('afterbegin', spyneDocsDomStr)
|
|
8
|
+
document.body.insertAdjacentHTML('afterbegin', spyneDocsDomStr)
|
|
9
9
|
}
|
|
10
|
-
)
|
|
10
|
+
)
|
|
11
11
|
|
|
12
12
|
// remove the html fixture from the DOM
|
|
13
13
|
afterEach(function() {
|
|
14
|
-
document.body.removeChild(document.getElementById('app'))
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('should return the same el', ()=>{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
it('should return array containing the same el', ()=>{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
expect(elNodesEqual).to.eq(true)
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
expect(elNodesEqual).to.eq(true);
|
|
40
|
-
});
|
|
41
|
-
|
|
14
|
+
document.body.removeChild(document.getElementById('app'))
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('should return the same el', () => {
|
|
18
|
+
const el = document.querySelector('ul#my-list')
|
|
19
|
+
const elNode = ViewStreamSelector(el)
|
|
20
|
+
const elNodesEqual = el.isEqualNode(elNode.el)
|
|
21
|
+
expect(elNodesEqual).to.eq(true)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('should return array containing the same el', () => {
|
|
25
|
+
const el = document.querySelector('body')
|
|
26
|
+
const liSelStr = 'ul#my-list'
|
|
27
|
+
const listEl = document.querySelector(liSelStr)
|
|
28
|
+
const elNode = ViewStreamSelector(el, liSelStr).arr
|
|
29
|
+
const elNodesEqual = listEl.isEqualNode(elNode[0])
|
|
30
|
+
expect(elNodesEqual).to.eq(true)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('should return the same el from selector', () => {
|
|
34
|
+
const el = document.querySelector('ul#my-list')
|
|
35
|
+
const el$ = ViewStreamSelector('ul#my-list')
|
|
36
|
+
const elNodesEqual = el.isEqualNode(el$.el)
|
|
37
|
+
expect(elNodesEqual).to.eq(true)
|
|
38
|
+
})
|
|
42
39
|
|
|
43
40
|
it('should return local li', () => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
expect(liList.el.length).to.eq(5)
|
|
48
|
-
})
|
|
41
|
+
const el = document.querySelector('ul#my-list')
|
|
42
|
+
const el$ = ViewStreamSelector('ul#my-list')
|
|
43
|
+
const liList = el$('li')
|
|
44
|
+
expect(liList.el.length).to.eq(5)
|
|
45
|
+
})
|
|
49
46
|
it('should add class to li', () => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
liList.addClass('foo')
|
|
54
|
-
|
|
55
|
-
expect(hasFooClassBool).to.eq(true)
|
|
56
|
-
})
|
|
47
|
+
const el = document.querySelector('ul#my-list')
|
|
48
|
+
const el$ = ViewStreamSelector('ul#my-list')
|
|
49
|
+
const liList = el$('li')
|
|
50
|
+
liList.addClass('foo')
|
|
51
|
+
const hasFooClassBool = liList.el[0].classList.contains('foo')
|
|
52
|
+
expect(hasFooClassBool).to.eq(true)
|
|
53
|
+
})
|
|
57
54
|
|
|
58
55
|
it('should remove class to li', () => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
liList.removeClass('has-svg')
|
|
63
|
-
|
|
64
|
-
expect(hasSvgClassBool).to.eq(false)
|
|
65
|
-
})
|
|
66
|
-
|
|
56
|
+
const el = document.querySelector('ul#my-list')
|
|
57
|
+
const el$ = ViewStreamSelector('ul#my-list')
|
|
58
|
+
const liList = el$('li')
|
|
59
|
+
liList.removeClass('has-svg')
|
|
60
|
+
const hasSvgClassBool = liList.el[0].classList.contains('has-svg')
|
|
61
|
+
expect(hasSvgClassBool).to.eq(false)
|
|
62
|
+
})
|
|
67
63
|
|
|
68
64
|
it('should set class foo bar', () => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
liList.setClass('foo bar')
|
|
73
|
-
//console.log('liList ',liList.el[0].className)
|
|
74
|
-
|
|
75
|
-
expect(isFooBarClassBool).to.eq(true)
|
|
76
|
-
})
|
|
77
|
-
|
|
65
|
+
const el = document.querySelector('ul#my-list')
|
|
66
|
+
const el$ = ViewStreamSelector('ul#my-list')
|
|
67
|
+
const liList = el$('li')
|
|
68
|
+
liList.setClass('foo bar')
|
|
69
|
+
// console.log('liList ',liList.el[0].className)
|
|
70
|
+
const isFooBarClassBool = liList.el[0].className === 'foo bar'
|
|
71
|
+
expect(isFooBarClassBool).to.eq(true)
|
|
72
|
+
})
|
|
78
73
|
|
|
79
74
|
it('should add inline css', () => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
liList.inlineCss = 'background:orange;'
|
|
84
|
-
|
|
85
|
-
expect(backgroundSetBool).to.eq(true)
|
|
86
|
-
})
|
|
75
|
+
const el = document.querySelector('ul#my-list')
|
|
76
|
+
const el$ = ViewStreamSelector('ul#my-list')
|
|
77
|
+
const liList = el$('li')
|
|
78
|
+
liList.inlineCss = 'background:orange;'
|
|
79
|
+
const backgroundSetBool = liList.el[0].style.getPropertyValue('background') === 'orange'
|
|
80
|
+
expect(backgroundSetBool).to.eq(true)
|
|
81
|
+
})
|
|
87
82
|
|
|
88
83
|
it('should add toogle Class', () => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
liList.toggleClass('foo', true)
|
|
93
|
-
|
|
94
|
-
expect(hasFooClassBool).to.eq(true)
|
|
95
|
-
})
|
|
84
|
+
const el = document.querySelector('ul#my-list')
|
|
85
|
+
const el$ = ViewStreamSelector('ul#my-list')
|
|
86
|
+
const liList = el$('li')
|
|
87
|
+
liList.toggleClass('foo', true)
|
|
88
|
+
const hasFooClassBool = liList.el[0].classList.contains('foo')
|
|
89
|
+
expect(hasFooClassBool).to.eq(true)
|
|
90
|
+
})
|
|
96
91
|
|
|
97
92
|
it('should toggle based on el selector', () => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
liList.setActiveItem('bar', 'li:nth-child(1)')
|
|
103
|
-
|
|
104
|
-
expect(hasBarClassBool).to.eq(true)
|
|
105
|
-
})
|
|
93
|
+
const el = document.querySelector('ul#my-list')
|
|
94
|
+
const el$ = ViewStreamSelector('ul#my-list')
|
|
95
|
+
const el1 = el.querySelector('li:nth-child(1)')
|
|
96
|
+
const liList = el$('li')
|
|
97
|
+
liList.setActiveItem('bar', 'li:nth-child(1)')
|
|
98
|
+
const hasBarClassBool = el1.classList.contains('bar')
|
|
99
|
+
expect(hasBarClassBool).to.eq(true)
|
|
100
|
+
})
|
|
106
101
|
|
|
107
102
|
it('should toggle based on element', () => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
liList.setActiveItem('bar', el1)
|
|
113
|
-
|
|
114
|
-
expect(hasBarClassBool).to.eq(true)
|
|
115
|
-
})
|
|
103
|
+
const el = document.querySelector('ul#my-list')
|
|
104
|
+
const el$ = ViewStreamSelector('ul#my-list')
|
|
105
|
+
const el1 = el.querySelector('li:nth-child(1)')
|
|
106
|
+
const liList = el$('li')
|
|
107
|
+
liList.setActiveItem('bar', el1)
|
|
108
|
+
const hasBarClassBool = el1.classList.contains('bar')
|
|
109
|
+
expect(hasBarClassBool).to.eq(true)
|
|
110
|
+
})
|
|
116
111
|
|
|
117
112
|
it('should setActiveItem based on el selector', () => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
liList.setActiveItem('bar','li:nth-child(1)')
|
|
123
|
-
|
|
124
|
-
expect(hasBarClassBool).to.eq(true)
|
|
125
|
-
})
|
|
113
|
+
const el = document.querySelector('ul#my-list')
|
|
114
|
+
const el$ = ViewStreamSelector('ul#my-list')
|
|
115
|
+
const el1 = el.querySelector('li:nth-child(1)')
|
|
116
|
+
const liList = el$('li')
|
|
117
|
+
liList.setActiveItem('bar', 'li:nth-child(1)')
|
|
118
|
+
const hasBarClassBool = el1.classList.contains('bar')
|
|
119
|
+
expect(hasBarClassBool).to.eq(true)
|
|
120
|
+
})
|
|
126
121
|
|
|
127
122
|
it('should check selector for node', () => {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
liList.setActiveItem('bar','li:nth-child(5)')
|
|
133
|
-
|
|
134
|
-
expect(hasBarClassBool).to.eq(false)
|
|
135
|
-
})
|
|
123
|
+
const el = document.querySelector('ul#my-list')
|
|
124
|
+
const el$ = ViewStreamSelector('ul#my-list')
|
|
125
|
+
const el1 = el.querySelector('li:nth-child(1)')
|
|
126
|
+
const liList = el$('li')
|
|
127
|
+
liList.setActiveItem('bar', 'li:nth-child(5)')
|
|
128
|
+
const hasBarClassBool = el1.classList.contains('bar')
|
|
129
|
+
expect(hasBarClassBool).to.eq(false)
|
|
130
|
+
})
|
|
136
131
|
|
|
137
132
|
it('should setActiveItem based on el', () => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
liList.setActiveItem('bar',el1)
|
|
143
|
-
|
|
144
|
-
expect(hasBarClassBool).to.eq(true)
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
});
|
|
133
|
+
const el = document.querySelector('ul#my-list')
|
|
134
|
+
const el$ = ViewStreamSelector('ul#my-list')
|
|
135
|
+
const el1 = el.querySelector('li:nth-child(1)')
|
|
136
|
+
const liList = el$('li')
|
|
137
|
+
liList.setActiveItem('bar', el1)
|
|
138
|
+
const hasBarClassBool = el1.classList.contains('bar')
|
|
139
|
+
expect(hasBarClassBool).to.eq(true)
|
|
140
|
+
})
|
|
141
|
+
})
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DomElementTemplate } from '../../spyne/views/dom-element-template'
|
|
2
|
+
|
|
3
|
+
describe('DomElementTemplate Proxy should not exist ', () => {
|
|
4
|
+
it('should not have a proxy method', () => {
|
|
5
|
+
expect(DomElementTemplate.hasOwnProperty('formatTemplateForProxyData')).to.be.false
|
|
6
|
+
})
|
|
7
|
+
})
|