@schukai/monster 1.14.1 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG +14 -0
- package/README.md +5 -5
- package/dist/modules/constants.js +2 -2
- package/dist/modules/constraints/abstract.js +2 -2
- package/dist/modules/constraints/abstractoperator.js +2 -2
- package/dist/modules/constraints/andoperator.js +2 -2
- package/dist/modules/constraints/invalid.js +2 -2
- package/dist/modules/constraints/isarray.js +2 -2
- package/dist/modules/constraints/isobject.js +2 -2
- package/dist/modules/constraints/namespace.js +1 -1
- package/dist/modules/constraints/oroperator.js +2 -2
- package/dist/modules/constraints/valid.js +2 -2
- package/dist/modules/data/buildmap.js +2 -2
- package/dist/modules/data/diff.js +2 -2
- package/dist/modules/data/extend.js +2 -2
- package/dist/modules/data/namespace.js +1 -1
- package/dist/modules/data/pathfinder.js +2 -2
- package/dist/modules/data/pipe.js +2 -2
- package/dist/modules/data/transformer.js +2 -2
- package/dist/modules/dom/assembler.js +2 -2
- package/dist/modules/dom/attributes.js +2 -2
- package/dist/modules/dom/constants.js +2 -2
- package/dist/modules/dom/customcontrol.js +2 -2
- package/dist/modules/dom/customelement.js +2 -2
- package/dist/modules/dom/events.js +2 -2
- package/dist/modules/dom/locale.js +2 -2
- package/dist/modules/dom/namespace.js +1 -1
- package/dist/modules/dom/template.js +2 -2
- package/dist/modules/dom/theme.js +2 -2
- package/dist/modules/dom/updater.js +2 -2
- package/dist/modules/dom/util.js +2 -2
- package/dist/modules/i18n/locale.js +2 -2
- package/dist/modules/i18n/namespace.js +1 -1
- package/dist/modules/i18n/provider.js +2 -2
- package/dist/modules/i18n/providers/fetch.js +2 -2
- package/dist/modules/i18n/providers/namespace.js +1 -1
- package/dist/modules/i18n/translations.js +2 -2
- package/dist/modules/logging/handler/console.js +2 -2
- package/dist/modules/logging/handler/namespace.js +1 -1
- package/dist/modules/logging/handler.js +2 -2
- package/dist/modules/logging/logentry.js +2 -2
- package/dist/modules/logging/logger.js +2 -2
- package/dist/modules/logging/namespace.js +1 -1
- package/dist/modules/math/namespace.js +1 -1
- package/dist/modules/math/random.js +2 -2
- package/dist/modules/monster.js +1 -1
- package/dist/modules/namespace.js +1 -1
- package/dist/modules/text/formatter.js +2 -2
- package/dist/modules/text/namespace.js +1 -1
- package/dist/modules/types/base.js +2 -2
- package/dist/modules/types/basewithoptions.js +2 -2
- package/dist/modules/types/global.js +2 -2
- package/dist/modules/types/id.js +2 -2
- package/dist/modules/types/is.js +2 -2
- package/dist/modules/types/namespace.js +1 -1
- package/dist/modules/types/observer.js +2 -2
- package/dist/modules/types/observerlist.js +2 -2
- package/dist/modules/types/proxyobserver.js +2 -2
- package/dist/modules/types/queue.js +2 -2
- package/dist/modules/types/randomid.js +2 -2
- package/dist/modules/types/stack.js +2 -2
- package/dist/modules/types/tokenlist.js +2 -2
- package/dist/modules/types/typeof.js +2 -2
- package/dist/modules/types/uniquequeue.js +2 -2
- package/dist/modules/types/validate.js +2 -2
- package/dist/modules/types/version.js +2 -2
- package/dist/modules/util/clone.js +2 -2
- package/dist/modules/util/comparator.js +2 -2
- package/dist/modules/util/freeze.js +2 -2
- package/dist/modules/util/namespace.js +1 -1
- package/dist/monster.dev.js +1096 -844
- package/dist/monster.dev.js.map +1 -1
- package/dist/monster.js +3 -3
- package/package.json +1 -1
- package/source/constants.js +6 -5
- package/source/constraints/abstract.js +2 -2
- package/source/constraints/abstractoperator.js +3 -3
- package/source/constraints/andoperator.js +7 -7
- package/source/constraints/invalid.js +6 -6
- package/source/constraints/isarray.js +6 -6
- package/source/constraints/isobject.js +6 -6
- package/source/constraints/oroperator.js +8 -8
- package/source/constraints/valid.js +6 -6
- package/source/data/buildmap.js +15 -15
- package/source/data/diff.js +6 -6
- package/source/data/extend.js +55 -13
- package/source/data/pathfinder.js +6 -7
- package/source/data/pipe.js +5 -5
- package/source/data/transformer.js +5 -6
- package/source/dom/assembler.js +5 -5
- package/source/dom/attributes.js +26 -26
- package/source/dom/constants.js +1 -2
- package/source/dom/customcontrol.js +14 -50
- package/source/dom/customelement.js +125 -28
- package/source/dom/events.js +7 -7
- package/source/dom/locale.js +5 -5
- package/source/dom/template.js +7 -7
- package/source/dom/theme.js +6 -6
- package/source/dom/updater.js +35 -13
- package/source/dom/util.js +9 -9
- package/source/i18n/locale.js +7 -7
- package/source/i18n/provider.js +5 -5
- package/source/i18n/providers/fetch.js +10 -10
- package/source/i18n/translations.js +5 -5
- package/source/logging/handler/console.js +4 -4
- package/source/logging/handler.js +4 -4
- package/source/logging/logentry.js +4 -4
- package/source/logging/logger.js +4 -4
- package/source/math/random.js +5 -5
- package/source/namespace.js +1 -1
- package/source/text/formatter.js +4 -5
- package/source/types/base.js +4 -5
- package/source/types/basewithoptions.js +9 -8
- package/source/types/global.js +6 -6
- package/source/types/id.js +6 -6
- package/source/types/is.js +22 -22
- package/source/types/observer.js +5 -5
- package/source/types/observerlist.js +4 -4
- package/source/types/proxyobserver.js +32 -26
- package/source/types/queue.js +13 -7
- package/source/types/randomid.js +5 -5
- package/source/types/stack.js +11 -4
- package/source/types/tokenlist.js +4 -4
- package/source/types/typeof.js +5 -5
- package/source/types/uniquequeue.js +11 -4
- package/source/types/validate.js +22 -22
- package/source/types/version.js +9 -9
- package/source/util/clone.js +4 -4
- package/source/util/comparator.js +6 -6
- package/source/util/freeze.js +4 -4
- package/test/cases/data/extend.js +66 -13
- package/test/cases/dom/customcontrol.js +16 -2
- package/test/cases/dom/customelement.js +64 -6
- package/test/cases/monster.js +1 -1
- package/test/cases/types/proxyobserver.js +9 -0
- package/test/web/monster-dev.html +3 -3
- package/test/web/monster.html +2 -2
- package/test/web/test.html +3 -3
- package/test/web/tests.js +3 -3
@@ -1,5 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
+
import {PROPERTY_KEY_INTERNALDATA} from "../../../source/constants.js";
|
4
|
+
import {ATTRIBUTE_OPTIONS} from "../../../source/dom/constants.js";
|
3
5
|
import {getDocument} from "../../../source/dom/util.js";
|
4
6
|
import {initJSDOM} from "../../util/jsdom.js";
|
5
7
|
import chai from "chai"
|
@@ -14,6 +16,8 @@ let html1 = `
|
|
14
16
|
</div>
|
15
17
|
`;
|
16
18
|
|
19
|
+
const internalDataSymbol = Symbol.for(PROPERTY_KEY_INTERNALDATA);
|
20
|
+
|
17
21
|
describe('DOM', function () {
|
18
22
|
|
19
23
|
let CustomElement, registerCustomElement, TestComponent, document, TestComponent2;
|
@@ -80,7 +84,7 @@ describe('DOM', function () {
|
|
80
84
|
afterEach(() => {
|
81
85
|
let mocks = document.getElementById('mocks');
|
82
86
|
mocks.innerHTML = "";
|
83
|
-
})
|
87
|
+
})
|
84
88
|
|
85
89
|
describe('create', function () {
|
86
90
|
it('should return custom-element object', function () {
|
@@ -102,22 +106,76 @@ describe('DOM', function () {
|
|
102
106
|
it('document should contain monster-testclass2', function (done) {
|
103
107
|
let d = document.createElement('monster-testclass2');
|
104
108
|
document.getElementById('test1').appendChild(d);
|
105
|
-
|
109
|
+
|
106
110
|
// insert DOM run in extra process via setTimeout!
|
107
|
-
setTimeout(function(){
|
111
|
+
setTimeout(function () {
|
108
112
|
try {
|
109
113
|
expect(document.getElementsByTagName('monster-testclass2').length).is.equal(1);
|
110
114
|
expect(document.getElementsByTagName('monster-testclass2').item(0).shadowRoot.innerHTML).is.equal('<h1></h1><article><p>test</p></article>');
|
111
115
|
expect(document.getElementById('test1')).contain.html('<monster-testclass2 data-monster-objectlink="Symbol(monsterUpdater)"></monster-testclass2>');
|
112
|
-
} catch(e) {
|
116
|
+
} catch (e) {
|
113
117
|
done(e);
|
114
118
|
}
|
115
119
|
done();
|
116
|
-
},100);
|
117
|
-
|
120
|
+
}, 100);
|
121
|
+
|
118
122
|
});
|
119
123
|
});
|
120
124
|
|
125
|
+
describe('Options change', function () {
|
126
|
+
|
127
|
+
it('delegatesFocus should change from true to false', function () {
|
128
|
+
let element = document.createElement('monster-testclass')
|
129
|
+
|
130
|
+
const o = element[internalDataSymbol].realSubject;
|
131
|
+
expect(Object.is(element[internalDataSymbol].realSubject, o)).to.be.true;
|
132
|
+
|
133
|
+
expect(element[internalDataSymbol].realSubject.options.delegatesFocus).to.be.true;
|
134
|
+
expect(element[internalDataSymbol].subject.options.delegatesFocus).to.be.true;
|
135
|
+
expect(element.getOption('delegatesFocus')).to.be.true;
|
136
|
+
expect(Object.is(element[internalDataSymbol].realSubject, o)).to.be.true;
|
137
|
+
|
138
|
+
element.setAttribute(ATTRIBUTE_OPTIONS, JSON.stringify({delegatesFocus: false}));
|
139
|
+
expect(Object.is(element[internalDataSymbol].realSubject, o)).to.be.true;
|
140
|
+
|
141
|
+
expect(element.getOption('delegatesFocus')).to.be.false;
|
142
|
+
expect(element[internalDataSymbol].realSubject.options.delegatesFocus).to.be.false;
|
143
|
+
expect(Object.is(element[internalDataSymbol].realSubject, o)).to.be.true;
|
144
|
+
|
145
|
+
})
|
146
|
+
|
147
|
+
|
148
|
+
})
|
149
|
+
|
150
|
+
describe('setOptions()', function () {
|
151
|
+
[
|
152
|
+
['shadowMode', 'x1'],
|
153
|
+
['templates.main', 'x2'], // is explicitly set to undefined
|
154
|
+
['delegatesFocus', 'x4'],
|
155
|
+
].forEach(function (data) {
|
156
|
+
|
157
|
+
|
158
|
+
let key = data.shift()
|
159
|
+
let newValue = data.shift()
|
160
|
+
|
161
|
+
let text = key + ' should return ' + newValue;
|
162
|
+
if (newValue !== undefined) {
|
163
|
+
text = key + ' was not set, therefore default ' + newValue;
|
164
|
+
}
|
165
|
+
|
166
|
+
|
167
|
+
it(text, function () {
|
168
|
+
|
169
|
+
let d = document.createElement('monster-testclass');
|
170
|
+
expect(d.getOption(key)).to.be.not.equal(newValue);
|
171
|
+
let x = d.setOption(key, newValue);
|
172
|
+
expect(d.getOption(key)).to.be.equal(newValue);
|
173
|
+
})
|
174
|
+
|
175
|
+
|
176
|
+
})
|
177
|
+
});
|
178
|
+
|
121
179
|
describe('getOptions()', function () {
|
122
180
|
|
123
181
|
[
|
package/test/cases/monster.js
CHANGED
@@ -12,6 +12,15 @@ describe('ProxyObserver', function () {
|
|
12
12
|
expect(o).is.instanceOf(ProxyObserver);
|
13
13
|
});
|
14
14
|
});
|
15
|
+
|
16
|
+
describe('proxy objects', function () {
|
17
|
+
it('Proxy objects should not be recommitted', function () {
|
18
|
+
let o = new ProxyObserver({a:{b:true}});
|
19
|
+
o.getSubject().a.b=o.getSubject();
|
20
|
+
o.getSubject().a.b.a.b=false;
|
21
|
+
//expect(o.getSubject()===p.getSubject()).to.be.true;
|
22
|
+
});
|
23
|
+
});
|
15
24
|
|
16
25
|
describe('notify observer', function () {
|
17
26
|
it('should inform observer', function (done) {
|
@@ -10,13 +10,13 @@
|
|
10
10
|
crossorigin="anonymous"
|
11
11
|
referrerpolicy="no-referrer"></script>
|
12
12
|
|
13
|
-
<script src="https://monsterjs.org/dist/1.
|
13
|
+
<script src="https://monsterjs.org/dist/1.15.0/dist/monster.dev.js"></script>
|
14
14
|
|
15
15
|
</head>
|
16
16
|
<body>
|
17
17
|
<div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
|
18
|
-
<h1 style='margin-bottom: 0.1em;'>Monster 1.
|
19
|
-
<div id="lastupdate" style='font-size:0.7em'>last update So
|
18
|
+
<h1 style='margin-bottom: 0.1em;'>Monster 1.15.0</h1>
|
19
|
+
<div id="lastupdate" style='font-size:0.7em'>last update So 19. Sep 14:41:13 CEST 2021</div>
|
20
20
|
</div>
|
21
21
|
</body>
|
22
22
|
</html>
|
package/test/web/monster.html
CHANGED
@@ -14,8 +14,8 @@
|
|
14
14
|
</head>
|
15
15
|
<body>
|
16
16
|
<div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
|
17
|
-
<h1 style='margin-bottom: 0.1em;'>Monster 1.
|
18
|
-
<div id="lastupdate" style='font-size:0.7em'>last update So
|
17
|
+
<h1 style='margin-bottom: 0.1em;'>Monster 1.15.0</h1>
|
18
|
+
<div id="lastupdate" style='font-size:0.7em'>last update So 19. Sep 14:41:13 CEST 2021</div>
|
19
19
|
</div>
|
20
20
|
</body>
|
21
21
|
</html>
|
package/test/web/test.html
CHANGED
@@ -5,15 +5,15 @@
|
|
5
5
|
<title>Mocha Monster</title>
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
7
7
|
<link rel="stylesheet" href="mocha.css"/>
|
8
|
-
<script id="polyfill" src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.entries,Array.prototype.fill,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.map,Array.prototype.reduce,ArrayBuffer,
|
8
|
+
<script id="polyfill" src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.entries,Array.prototype.fill,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.map,Array.prototype.reduce,ArrayBuffer,DataView,document,DocumentFragment,Element,Event,globalThis,HTMLDocument,HTMLTemplateElement,Intl,JSON,Map,Math.log2,Number.isInteger,Object.assign,Object.defineProperty,Object.entries,Object.freeze,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.keys,Promise,Reflect,Reflect.defineProperty,Reflect.get,Reflect.getOwnPropertyDescriptor,Reflect.setPrototypeOf,Set,String.prototype.trim,Symbol,Symbol.for,Symbol.iterator,Uint8Array,URL,WeakMap,WeakSet"
|
9
9
|
crossorigin="anonymous"
|
10
10
|
referrerpolicy="no-referrer"></script>
|
11
11
|
|
12
12
|
</head>
|
13
13
|
<body>
|
14
14
|
<div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
|
15
|
-
<h1 style='margin-bottom: 0.1em;'>Monster 1.
|
16
|
-
<div id="lastupdate" style='font-size:0.7em'>last update So
|
15
|
+
<h1 style='margin-bottom: 0.1em;'>Monster 1.15.0</h1>
|
16
|
+
<div id="lastupdate" style='font-size:0.7em'>last update So 19. Sep 14:41:13 CEST 2021</div>
|
17
17
|
</div>
|
18
18
|
<div id="mocks"></div>
|
19
19
|
<div id="mocha"></div>
|