@schukai/monster 3.121.0 → 4.0.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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.0","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"
|
1
|
+
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.0","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.0.1"}
|
@@ -2454,7 +2454,7 @@ function fetchData(url) {
|
|
2454
2454
|
self[isLoadingSymbol] = false;
|
2455
2455
|
delayWatch = true;
|
2456
2456
|
|
2457
|
-
if (response.status >= 200 && response.status < 300) {
|
2457
|
+
if (!(response.status >= 200 && response.status < 300)) {
|
2458
2458
|
throw new Error(`HTTP error! status: ${response.status}`);
|
2459
2459
|
}
|
2460
2460
|
|
@@ -58,19 +58,22 @@ describe('Select', function () {
|
|
58
58
|
|
59
59
|
describe('With fetch', function () {
|
60
60
|
|
61
|
-
beforeEach(() => {
|
61
|
+
beforeEach((done) => {
|
62
62
|
let mocks = document.getElementById('mocks');
|
63
63
|
mocks.innerHTML = html1;
|
64
64
|
|
65
65
|
global['fetch'] = function (url, options) {
|
66
|
-
|
67
66
|
let headers = new Map;
|
68
67
|
headers.set('content-type', 'application/json');
|
69
|
-
|
70
68
|
return new Promise((resolve, reject) => {
|
71
69
|
resolve({
|
70
|
+
ok:true,
|
71
|
+
status:200,
|
72
72
|
headers: headers,
|
73
73
|
text: function () {
|
74
|
+
|
75
|
+
|
76
|
+
|
74
77
|
return new Promise((resolve2, reject2) => {
|
75
78
|
|
76
79
|
let json = JSON.parse(`[
|
@@ -110,7 +113,7 @@ describe('Select', function () {
|
|
110
113
|
})
|
111
114
|
|
112
115
|
};
|
113
|
-
|
116
|
+
done()
|
114
117
|
|
115
118
|
})
|
116
119
|
|
@@ -126,12 +129,6 @@ describe('Select', function () {
|
|
126
129
|
mocks.innerHTML = html2;
|
127
130
|
});
|
128
131
|
|
129
|
-
afterEach(() => {
|
130
|
-
let mocks = document.getElementById('mocks');
|
131
|
-
mocks.innerHTML = "";
|
132
|
-
global['fetch'] = fetchReference;
|
133
|
-
})
|
134
|
-
|
135
132
|
describe('create from template', function () {
|
136
133
|
it('should contains monster-select', function () {
|
137
134
|
expect(document.getElementById('test2')).contain.html('<monster-select');
|
@@ -148,14 +145,14 @@ describe('Select', function () {
|
|
148
145
|
|
149
146
|
it('should have options', function (done) {
|
150
147
|
|
151
|
-
this.timeout(
|
148
|
+
this.timeout(5000)
|
152
149
|
|
153
150
|
let mocks = document.getElementById('mocks');
|
154
151
|
const select = document.createElement('monster-select');
|
155
|
-
select.setOption('url', 'https://monsterjs.org/assets/examples/countries.json')
|
152
|
+
select.setOption('url', 'https://monsterjs.org/assets/examples/countries.json') // url is not used in this test, see fetch mock
|
156
153
|
select.setOption('mapping.selector', '*')
|
157
|
-
select.setOption('mapping.labelTemplate', '${
|
158
|
-
select.setOption('mapping.valueTemplate', '${
|
154
|
+
select.setOption('mapping.labelTemplate', '${id}')
|
155
|
+
select.setOption('mapping.valueTemplate', '${id}')
|
159
156
|
|
160
157
|
select.addEventListener('monster-options-set', (e) => {
|
161
158
|
setTimeout(() => {
|
@@ -63,6 +63,8 @@ describe('Treeselect', function () {
|
|
63
63
|
return new Promise((resolve, reject) => {
|
64
64
|
resolve({
|
65
65
|
headers: headers,
|
66
|
+
ok:true,
|
67
|
+
status:200,
|
66
68
|
text: function () {
|
67
69
|
return new Promise((resolve2, reject2) => {
|
68
70
|
|
@@ -141,8 +143,8 @@ describe('Treeselect', function () {
|
|
141
143
|
treeselect.setOption('url', 'https://monsterjs.org/assets/examples/countries.json');
|
142
144
|
|
143
145
|
treeselect.setOption('mapping.selector', '*');
|
144
|
-
treeselect.setOption('mapping.labelTemplate', '${
|
145
|
-
treeselect.setOption('mapping.valueTemplate', '${
|
146
|
+
treeselect.setOption('mapping.labelTemplate', '${id}')
|
147
|
+
treeselect.setOption('mapping.valueTemplate', '${id}')
|
146
148
|
treeselect.addEventListener('monster-options-set', (e) => {
|
147
149
|
setTimeout(() => {
|
148
150
|
|