@schukai/monster 1.12.0 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG +40 -1
- package/README.md +5 -5
- package/dist/modules/constants.js +2 -0
- 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 -0
- package/dist/modules/dom/customelement.js +2 -2
- package/dist/modules/dom/events.js +2 -2
- package/dist/modules/dom/locale.js +2 -0
- 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 -0
- package/dist/modules/i18n/namespace.js +2 -0
- package/dist/modules/i18n/provider.js +2 -0
- package/dist/modules/i18n/providers/fetch.js +2 -0
- package/dist/modules/i18n/providers/namespace.js +2 -0
- package/dist/modules/i18n/translations.js +2 -0
- 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 +2 -2
- 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 -0
- 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 +8692 -6669
- package/dist/monster.dev.js.map +1 -1
- package/dist/monster.js +3 -3
- package/package.json +1 -1
- package/source/constants.js +22 -0
- 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/namespace.js +2 -0
- 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/namespace.js +2 -0
- package/source/data/pathfinder.js +6 -7
- package/source/data/pipe.js +5 -5
- package/source/data/transformer.js +6 -6
- package/source/dom/assembler.js +5 -5
- package/source/dom/attributes.js +89 -45
- package/source/dom/constants.js +8 -9
- package/source/dom/customcontrol.js +301 -0
- package/source/dom/customelement.js +149 -31
- package/source/dom/events.js +58 -8
- package/source/dom/locale.js +59 -0
- package/source/dom/namespace.js +2 -0
- package/source/dom/template.js +7 -7
- package/source/dom/theme.js +6 -6
- package/source/dom/updater.js +38 -11
- package/source/dom/util.js +10 -10
- package/source/i18n/locale.js +322 -0
- package/source/i18n/namespace.js +15 -0
- package/source/i18n/provider.js +58 -0
- package/source/i18n/providers/fetch.js +121 -0
- package/source/i18n/providers/namespace.js +15 -0
- package/source/i18n/translations.js +209 -0
- 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/logging/namespace.js +2 -0
- package/source/math/namespace.js +2 -0
- package/source/math/random.js +5 -5
- package/source/monster.js +26 -16
- package/source/namespace.js +10 -8
- package/source/text/formatter.js +4 -5
- package/source/text/namespace.js +1 -1
- package/source/types/base.js +4 -7
- package/source/types/basewithoptions.js +97 -0
- package/source/types/global.js +6 -6
- package/source/types/id.js +6 -6
- package/source/types/is.js +22 -22
- package/source/types/namespace.js +3 -1
- 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/source/util/namespace.js +2 -0
- package/test/cases/data/extend.js +66 -13
- package/test/cases/dom/attributes.js +56 -1
- package/test/cases/dom/customcontrol.js +264 -0
- package/test/cases/dom/customelement.js +112 -51
- package/test/cases/dom/events.js +32 -14
- package/test/cases/dom/locale.js +44 -0
- package/test/cases/i18n/locale.js +80 -0
- package/test/cases/i18n/provider.js +15 -0
- package/test/cases/i18n/providers/fetch.js +65 -0
- package/test/cases/i18n/translations.js +57 -0
- package/test/cases/monster.js +3 -1
- package/test/cases/{util → text}/formatter.js +2 -0
- package/test/cases/types/basewithoptions.js +25 -0
- package/test/cases/types/proxyobserver.js +9 -0
- package/test/cases/{text → util}/clone.js +0 -0
- package/test/cases/{text → util}/comparator.js +0 -0
- package/test/util/jsdom.js +4 -0
- package/test/web/import.js +10 -3
- package/test/web/monster-dev.html +3 -3
- package/test/web/monster.html +3 -3
- package/test/web/test.html +3 -3
- package/test/web/tests.js +3 -3
package/test/cases/dom/events.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
import {expect} from "chai"
|
4
4
|
|
5
|
-
import {fireEvent} from "../../../source/dom/events.js";
|
5
|
+
import {fireEvent, findTargetElementFromEvent} from "../../../source/dom/events.js";
|
6
6
|
import {initJSDOM} from "../../util/jsdom.js";
|
7
7
|
|
8
8
|
describe('Events', function () {
|
@@ -11,6 +11,24 @@ describe('Events', function () {
|
|
11
11
|
initJSDOM();
|
12
12
|
})
|
13
13
|
|
14
|
+
describe('findTargetElementFromEvent()', function () {
|
15
|
+
|
16
|
+
it('find object', function (done) {
|
17
|
+
let container = document.createElement('div');
|
18
|
+
container.setAttribute('data-monster', 'hello');
|
19
|
+
let div = document.createElement('div');
|
20
|
+
container.appendChild(div);
|
21
|
+
div.addEventListener('click', (event) => {
|
22
|
+
|
23
|
+
let e = findTargetElementFromEvent(event, 'data-monster');
|
24
|
+
expect(e.getAttribute('data-monster')).to.be.equal('hello')
|
25
|
+
done();
|
26
|
+
})
|
27
|
+
fireEvent(div, 'click');
|
28
|
+
});
|
29
|
+
|
30
|
+
});
|
31
|
+
|
14
32
|
describe('fireEvent()', function () {
|
15
33
|
it('should fire a click event', function (done) {
|
16
34
|
let div = document.createElement('div');
|
@@ -19,7 +37,7 @@ describe('Events', function () {
|
|
19
37
|
})
|
20
38
|
fireEvent(div, 'click');
|
21
39
|
});
|
22
|
-
|
40
|
+
|
23
41
|
it('should fire a touch event', function (done) {
|
24
42
|
let div = document.createElement('div');
|
25
43
|
div.addEventListener('touch', () => {
|
@@ -27,36 +45,36 @@ describe('Events', function () {
|
|
27
45
|
})
|
28
46
|
fireEvent(div, 'touch');
|
29
47
|
});
|
30
|
-
|
48
|
+
|
31
49
|
it('should fire a touch event on collection', function (done) {
|
32
50
|
let div = document.createElement('div');
|
33
51
|
div.addEventListener('touch', () => {
|
34
52
|
done();
|
35
53
|
})
|
36
|
-
|
54
|
+
|
37
55
|
div.appendChild(document.createElement('div'));
|
38
56
|
let collection = div.querySelectorAll('div');
|
39
|
-
|
40
|
-
|
57
|
+
|
58
|
+
|
41
59
|
fireEvent(collection, 'touch');
|
42
60
|
});
|
43
|
-
|
61
|
+
|
44
62
|
it('should fire a touch event', function (done) {
|
45
63
|
let div = document.createElement('div');
|
46
64
|
div.addEventListener('touch', () => {
|
47
65
|
done();
|
48
66
|
})
|
49
|
-
|
67
|
+
|
50
68
|
div.appendChild(document.createElement('div'));
|
51
69
|
let collection = div.querySelectorAll('div');
|
52
|
-
|
53
|
-
|
70
|
+
|
71
|
+
|
54
72
|
fireEvent(collection, 'touch');
|
55
|
-
});
|
56
|
-
|
73
|
+
});
|
74
|
+
|
57
75
|
it('should throw error', function () {
|
58
|
-
expect(() =>
|
59
|
-
|
76
|
+
expect(() => fireEvent({}, 'touch')).to.throw(Error);
|
77
|
+
;
|
60
78
|
});
|
61
79
|
});
|
62
80
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
import {expect} from "chai"
|
4
|
+
|
5
|
+
import {
|
6
|
+
getLocaleOfDocument
|
7
|
+
} from "../../../source/dom/locale.js";
|
8
|
+
import {Template} from "../../../source/dom/template.js";
|
9
|
+
import {initJSDOM} from "../../util/jsdom.js";
|
10
|
+
|
11
|
+
describe('Attributes', function () {
|
12
|
+
before(function (done) {
|
13
|
+
initJSDOM().then(() => {
|
14
|
+
done()
|
15
|
+
});
|
16
|
+
});
|
17
|
+
|
18
|
+
describe('getLocaleOfDocument', function () {
|
19
|
+
|
20
|
+
|
21
|
+
[
|
22
|
+
["de"],
|
23
|
+
["sl-IT-nedis"],
|
24
|
+
["en-GB"],
|
25
|
+
|
26
|
+
].forEach(function (data) {
|
27
|
+
|
28
|
+
let a = data.shift()
|
29
|
+
|
30
|
+
|
31
|
+
it('return language ' + a, function () {
|
32
|
+
let html = document.getElementsByTagName('html');
|
33
|
+
let node = html.item(0);
|
34
|
+
|
35
|
+
node.setAttribute('lang', a);
|
36
|
+
expect(getLocaleOfDocument().toString()).to.be.equal(a);
|
37
|
+
})
|
38
|
+
|
39
|
+
});
|
40
|
+
|
41
|
+
|
42
|
+
});
|
43
|
+
|
44
|
+
})
|
@@ -0,0 +1,80 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
import {expect} from "chai"
|
4
|
+
import {parseLocale, Locale} from "../../../source/i18n/locale.js";
|
5
|
+
|
6
|
+
|
7
|
+
describe('Locale', function () {
|
8
|
+
|
9
|
+
describe('new instance', function () {
|
10
|
+
|
11
|
+
[
|
12
|
+
// language, region, script, variants, extlang, privateUse
|
13
|
+
// https://www.rfc-editor.org/rfc/rfc5646.html
|
14
|
+
['zh', undefined, 'Hant', undefined, undefined, undefined, 'zh-Hant'], // zh-Hant (Chinese written using the Traditional Chinese script)
|
15
|
+
['de', 'CH', undefined, '1901', undefined, undefined, 'de-CH-1901'], // de-CH-1901 (German as used in Switzerland using the 1901 variant [orthography])
|
16
|
+
['sl', 'IT', undefined, 'nedis', undefined, undefined, 'sl-IT-nedis'], // sl-IT-nedis (Slovenian as used in Italy, Nadiza dialect)
|
17
|
+
['hy', 'IT', 'Latn', 'arevela', undefined, undefined, 'hy-Latn-IT-arevela'], // hy-Latn-IT-arevela (Eastern Armenian written in Latin script, as used in Italy)
|
18
|
+
['zh', 'CN', 'Hans', undefined, undefined, undefined, 'zh-Hans-CN'], // zh-Hans-CN (Chinese written using the Simplified script as used in mainland China)
|
19
|
+
['sr', 'RS', 'Latn', undefined, undefined, undefined, 'sr-Latn-RS'], // sr-Latn-RS (Serbian written using the Latin script as used in Serbia)
|
20
|
+
|
21
|
+
].forEach(function (data) {
|
22
|
+
|
23
|
+
let a = data.shift()
|
24
|
+
let b = data.shift()
|
25
|
+
let c = data.shift()
|
26
|
+
let d = data.shift()
|
27
|
+
let e = data.shift()
|
28
|
+
let f = data.shift()
|
29
|
+
let g = data.shift()
|
30
|
+
|
31
|
+
it('new Locale(' + a + ',' + b + ',' + c + ',' + d + ',' + e + ',' + f + ') should return ' + g, function () {
|
32
|
+
|
33
|
+
expect(new Locale(a, b, c, d, e, f).toString()).is.equal(g)
|
34
|
+
});
|
35
|
+
});
|
36
|
+
|
37
|
+
});
|
38
|
+
|
39
|
+
describe('parseLocale()', function () {
|
40
|
+
|
41
|
+
[
|
42
|
+
|
43
|
+
// language, region, script, variants, extlang, privateUse
|
44
|
+
// https://www.rfc-editor.org/rfc/rfc5646.html
|
45
|
+
['zh', undefined, 'Hant', undefined, undefined, undefined, 'zh-Hant'], // zh-Hant (Chinese written using the Traditional Chinese script)
|
46
|
+
['de', 'CH', undefined, '1901', undefined, undefined, 'de-CH-1901'], // de-CH-1901 (German as used in Switzerland using the 1901 variant [orthography])
|
47
|
+
['sl', 'IT', undefined, 'nedis', undefined, undefined, 'sl-IT-nedis'], // sl-IT-nedis (Slovenian as used in Italy, Nadiza dialect)
|
48
|
+
['hy', 'IT', 'Latn', 'arevela', undefined, undefined, 'hy-Latn-IT-arevela'], // hy-Latn-IT-arevela (Eastern Armenian written in Latin script, as used in Italy)
|
49
|
+
['zh', 'CN', 'Hans', undefined, undefined, undefined, 'zh-Hans-CN'], // zh-Hans-CN (Chinese written using the Simplified script as used in mainland China)
|
50
|
+
['sr', 'RS', 'Latn', undefined, undefined, undefined, 'sr-Latn-RS'], // sr-Latn-RS (Serbian written using the Latin script as used in Serbia)
|
51
|
+
|
52
|
+
].forEach(function (data) {
|
53
|
+
|
54
|
+
let a = data.shift()
|
55
|
+
let b = data.shift()
|
56
|
+
let c = data.shift()
|
57
|
+
let d = data.shift()
|
58
|
+
let e = data.shift()
|
59
|
+
let f = data.shift()
|
60
|
+
let g = data.shift()
|
61
|
+
|
62
|
+
it('new Locale(' + a + ',' + b + ',' + c + ',' + d + ',' + e + ',' + f + ') should return ' + g, function () {
|
63
|
+
|
64
|
+
const locale = parseLocale(g)
|
65
|
+
expect(locale.localeString).to.be.equal(g);
|
66
|
+
expect(locale.language).to.be.equal(a);
|
67
|
+
expect(locale.region).to.be.equal(b);
|
68
|
+
expect(locale.script).to.be.equal(c);
|
69
|
+
expect(locale.variants).to.be.equal(d);
|
70
|
+
expect(locale.extlang).to.be.equal(e);
|
71
|
+
expect(locale.privateUse).to.be.equal(f);
|
72
|
+
|
73
|
+
expect(new Locale(a, b, c, d, e, f).toString()).is.equal(g)
|
74
|
+
});
|
75
|
+
});
|
76
|
+
|
77
|
+
});
|
78
|
+
|
79
|
+
|
80
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import {expect} from "chai"
|
2
|
+
import {Provider} from "../../../source/i18n/provider.js";
|
3
|
+
|
4
|
+
describe('Provider', function () {
|
5
|
+
|
6
|
+
describe('Instance and Init', function () {
|
7
|
+
|
8
|
+
it('create instance', function () {
|
9
|
+
expect((new Provider()).getTranslations('en')).is.instanceof(Promise);
|
10
|
+
});
|
11
|
+
|
12
|
+
});
|
13
|
+
|
14
|
+
|
15
|
+
});
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import {expect} from "chai"
|
2
|
+
|
3
|
+
|
4
|
+
import {Fetch} from "../../../../source/i18n/providers/fetch.js";
|
5
|
+
import {Translations} from "../../../../source/i18n/translations.js";
|
6
|
+
import {getGlobal} from "../../../../source/types/global.js";
|
7
|
+
|
8
|
+
|
9
|
+
const global = getGlobal();
|
10
|
+
let fetchReference;
|
11
|
+
|
12
|
+
|
13
|
+
describe('Translation Provider Fetch', function () {
|
14
|
+
|
15
|
+
|
16
|
+
afterEach(() => {
|
17
|
+
global['fetch'] = fetchReference;
|
18
|
+
});
|
19
|
+
|
20
|
+
beforeEach(() => {
|
21
|
+
|
22
|
+
fetchReference = global['fetch'];
|
23
|
+
global['fetch'] = function (url, options) {
|
24
|
+
return new Promise((resolve, reject) => {
|
25
|
+
resolve({
|
26
|
+
json: function () {
|
27
|
+
return {
|
28
|
+
a: "test"
|
29
|
+
}
|
30
|
+
}
|
31
|
+
});
|
32
|
+
})
|
33
|
+
|
34
|
+
};
|
35
|
+
|
36
|
+
})
|
37
|
+
|
38
|
+
describe('fetch mock data and create translation', function () {
|
39
|
+
|
40
|
+
it('fetch', function (done) {
|
41
|
+
|
42
|
+
let p = (new Fetch(new URL('http://example.com'))).getTranslations('en');
|
43
|
+
|
44
|
+
expect(p).is.instanceof(Promise);
|
45
|
+
|
46
|
+
p.then(r => {
|
47
|
+
|
48
|
+
try {
|
49
|
+
expect(r).is.instanceof(Translations);
|
50
|
+
done();
|
51
|
+
} catch (e) {
|
52
|
+
done(e);
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
}).catch(e => {
|
57
|
+
done(e);
|
58
|
+
})
|
59
|
+
|
60
|
+
});
|
61
|
+
|
62
|
+
});
|
63
|
+
|
64
|
+
|
65
|
+
});
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import {expect} from "chai"
|
2
|
+
import {parseLocale} from "../../../source/i18n/locale.js";
|
3
|
+
import {Translations} from "../../../source/i18n/translations.js";
|
4
|
+
|
5
|
+
describe('Translations', function () {
|
6
|
+
|
7
|
+
describe('Instance and Init', function () {
|
8
|
+
|
9
|
+
let translation;
|
10
|
+
|
11
|
+
beforeEach(() => {
|
12
|
+
translation = new Translations(parseLocale('en-GB'));
|
13
|
+
|
14
|
+
translation.assignTranslations({
|
15
|
+
test1: "abc",
|
16
|
+
test2: {'other': 'xyz'}
|
17
|
+
});
|
18
|
+
})
|
19
|
+
|
20
|
+
it('create instance', function () {
|
21
|
+
expect(new Translations(parseLocale('en-GB'))).is.instanceof(Translations);
|
22
|
+
});
|
23
|
+
|
24
|
+
it('init translations', function () {
|
25
|
+
expect(translation.assignTranslations({
|
26
|
+
test1: "abc",
|
27
|
+
test2: {'other': 'xyz'}
|
28
|
+
})).is.instanceof(Translations);
|
29
|
+
});
|
30
|
+
|
31
|
+
});
|
32
|
+
|
33
|
+
describe('getText', function () {
|
34
|
+
|
35
|
+
let translation;
|
36
|
+
|
37
|
+
beforeEach(() => {
|
38
|
+
translation = new Translations(parseLocale('en-GB'));
|
39
|
+
|
40
|
+
translation.assignTranslations({
|
41
|
+
test1: "abc",
|
42
|
+
test2: {'other': 'xyz'}
|
43
|
+
});
|
44
|
+
})
|
45
|
+
|
46
|
+
it('create, set and get en-GB', function () {
|
47
|
+
expect(translation.getText('test1')).is.equal('abc');
|
48
|
+
});
|
49
|
+
|
50
|
+
it('create, set and get en-GB with pluralrules', function () {
|
51
|
+
expect(translation.getText('test2')).is.equal('xyz')
|
52
|
+
});
|
53
|
+
|
54
|
+
});
|
55
|
+
|
56
|
+
|
57
|
+
});
|
package/test/cases/monster.js
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
|
2
|
+
|
1
3
|
import {expect} from "chai"
|
2
4
|
import {Monster,Version} from "../../source/types/version.js";
|
3
5
|
|
@@ -7,7 +9,7 @@ describe('Monster', function () {
|
|
7
9
|
let monsterVersion
|
8
10
|
|
9
11
|
/**#@+ dont touch, replaced by make with package.json version */
|
10
|
-
monsterVersion = new Version('1.
|
12
|
+
monsterVersion = new Version('1.15.0')
|
11
13
|
/**#@-*/
|
12
14
|
|
13
15
|
let m = Monster.getVersion();
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import {expect} from "chai"
|
4
|
+
import {BaseWithOptions} from "../../../source/types/basewithoptions.js";
|
5
|
+
|
6
|
+
|
7
|
+
describe('BaseWithOptions', function () {
|
8
|
+
|
9
|
+
describe('new BaseWithOptions', function () {
|
10
|
+
|
11
|
+
it('is instance of BaseWithOptions', function () {
|
12
|
+
expect(new BaseWithOptions).to.be.instanceOf(BaseWithOptions);
|
13
|
+
});
|
14
|
+
|
15
|
+
it('is instance of Object', function () {
|
16
|
+
expect(new BaseWithOptions).to.be.instanceOf(Object);
|
17
|
+
});
|
18
|
+
|
19
|
+
it('get option is true', function () {
|
20
|
+
expect(new BaseWithOptions({a: true}).getOption('a')).to.be.true;
|
21
|
+
});
|
22
|
+
|
23
|
+
})
|
24
|
+
|
25
|
+
})
|
@@ -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) {
|
File without changes
|
File without changes
|
package/test/util/jsdom.js
CHANGED
@@ -34,6 +34,8 @@ function initJSDOM() {
|
|
34
34
|
'self',
|
35
35
|
'HTMLCollection',
|
36
36
|
'NodeList',
|
37
|
+
'ElementInternals',
|
38
|
+
'HTMLFormElement',
|
37
39
|
'HTMLInputElement',
|
38
40
|
'HTMLSelectElement',
|
39
41
|
'HTMLTextAreaElement',
|
@@ -41,6 +43,7 @@ function initJSDOM() {
|
|
41
43
|
'Document',
|
42
44
|
'Node',
|
43
45
|
'Event',
|
46
|
+
'fetch',
|
44
47
|
'CustomEvent',
|
45
48
|
'Element',
|
46
49
|
'HTMLElement',
|
@@ -53,6 +56,7 @@ function initJSDOM() {
|
|
53
56
|
'HTMLTemplateElement',
|
54
57
|
'XMLSerializer',
|
55
58
|
'NodeFilter',
|
59
|
+
'navigator',
|
56
60
|
'InputEvent',
|
57
61
|
'CustomEvent'
|
58
62
|
].forEach(key => (g[key] = window[key]));
|
package/test/web/import.js
CHANGED
@@ -3,20 +3,26 @@ import "./prepare.js";
|
|
3
3
|
import "../cases/logging/logger.js";
|
4
4
|
import "../cases/logging/handler.js";
|
5
5
|
import "../cases/logging/logentry.js";
|
6
|
-
import "../cases/text/
|
7
|
-
import "../cases/text/clone.js";
|
6
|
+
import "../cases/text/formatter.js";
|
8
7
|
import "../cases/dom/updater.js";
|
9
8
|
import "../cases/dom/attributes.js";
|
10
9
|
import "../cases/dom/template.js";
|
11
10
|
import "../cases/dom/util.js";
|
11
|
+
import "../cases/dom/locale.js";
|
12
|
+
import "../cases/dom/customcontrol.js";
|
12
13
|
import "../cases/dom/assembler.js";
|
13
14
|
import "../cases/dom/theme.js";
|
14
15
|
import "../cases/dom/events.js";
|
15
16
|
import "../cases/dom/customelement.js";
|
17
|
+
import "../cases/i18n/providers/fetch.js";
|
18
|
+
import "../cases/i18n/translations.js";
|
19
|
+
import "../cases/i18n/locale.js";
|
20
|
+
import "../cases/i18n/provider.js";
|
16
21
|
import "../cases/types/queue.js";
|
17
22
|
import "../cases/types/observer.js";
|
18
23
|
import "../cases/types/global.js";
|
19
24
|
import "../cases/types/observerlist.js";
|
25
|
+
import "../cases/types/basewithoptions.js";
|
20
26
|
import "../cases/types/is.js";
|
21
27
|
import "../cases/types/proxyobserver.js";
|
22
28
|
import "../cases/types/uniquequeue.js";
|
@@ -34,7 +40,8 @@ import "../cases/constraint/invalid.js";
|
|
34
40
|
import "../cases/constraint/oroperator.js";
|
35
41
|
import "../cases/constraint/andoperator.js";
|
36
42
|
import "../cases/constraint/isarray.js";
|
37
|
-
import "../cases/util/
|
43
|
+
import "../cases/util/comparator.js";
|
44
|
+
import "../cases/util/clone.js";
|
38
45
|
import "../cases/data/pathfinder.js";
|
39
46
|
import "../cases/data/pipe.js";
|
40
47
|
import "../cases/data/extend.js";
|
@@ -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
@@ -9,13 +9,13 @@
|
|
9
9
|
crossorigin="anonymous"
|
10
10
|
referrerpolicy="no-referrer"></script>
|
11
11
|
|
12
|
-
<script src="
|
12
|
+
<script src="/monster/packages/monster/dist/monster.js"></script>
|
13
13
|
|
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,DataView,document,DocumentFragment,Element,Event,globalThis,HTMLDocument,JSON,Map,Math.log2,Number.isInteger,Object.defineProperty,Object.entries,Object.freeze,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,WeakMap,WeakSet"
|
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>
|