@schukai/monster 3.69.2 → 3.70.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +20 -4
- package/package.json +1 -1
- package/source/components/datatable/dataset.mjs +278 -202
- package/source/components/datatable/datasource/dom.mjs +1 -1
- package/source/components/datatable/datasource/rest.mjs +2 -2
- package/source/components/datatable/filter.mjs +1 -0
- package/source/components/datatable/save-button.mjs +1 -1
- package/source/components/datatable/style/datatable.pcss +1 -1
- package/source/components/datatable/style/filter-controls-defaults.pcss +1 -1
- package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +8 -17
- package/source/components/form/context-error.mjs +2 -0
- package/source/components/form/context-help.mjs +1 -0
- package/source/components/form/field-set.mjs +222 -225
- package/source/components/form/form.mjs +192 -545
- package/source/components/form/select.mjs +24 -9
- package/source/components/form/style/field-set.pcss +84 -7
- package/source/components/form/style/form.pcss +5 -3
- package/source/components/form/style/select.pcss +5 -4
- package/source/components/form/stylesheet/field-set.mjs +7 -14
- package/source/components/form/stylesheet/form.mjs +8 -17
- package/source/components/form/stylesheet/select.mjs +7 -14
- package/source/components/layout/style/collapse.pcss +0 -2
- package/source/components/layout/stylesheet/collapse.mjs +7 -14
- package/source/components/style/form.pcss +66 -3
- package/source/components/style/mixin/property.pcss +8 -1
- package/source/components/style/typography.pcss +4 -12
- package/source/components/stylesheet/form.mjs +8 -17
- package/source/components/stylesheet/mixin/form.mjs +7 -16
- package/source/components/stylesheet/mixin/property.mjs +6 -13
- package/source/components/stylesheet/typography.mjs +7 -16
- package/source/data/datasource/server/restapi.mjs +182 -180
- package/source/dom/customelement.mjs +4 -0
- package/source/dom/updater.mjs +1 -1
- package/source/types/tokenlist.mjs +2 -2
- package/test/cases/components/form/form.mjs +1 -182
- package/test/cases/components/host/details.mjs +1 -1
- package/test/cases/components/host/host.mjs +1 -1
- package/test/cases/components/host/overlay.mjs +1 -1
- package/test/cases/dom/customcontrol.mjs +1 -1
- package/test/cases/dom/customelement.mjs +2 -2
- package/source/components/style/mixin/form.pcss +0 -242
@@ -12,13 +12,13 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
import {
|
16
|
-
import {
|
17
|
-
import {
|
18
|
-
import {
|
19
|
-
import {
|
15
|
+
import {internalSymbol, instanceSymbol} from "../../../constants.mjs";
|
16
|
+
import {isObject, isFunction} from "../../../types/is.mjs";
|
17
|
+
import {Server} from "../server.mjs";
|
18
|
+
import {WriteError} from "./restapi/writeerror.mjs";
|
19
|
+
import {DataFetchError} from "./restapi/data-fetch-error.mjs";
|
20
20
|
|
21
|
-
export {
|
21
|
+
export {RestAPI};
|
22
22
|
|
23
23
|
/**
|
24
24
|
* @type {symbol}
|
@@ -27,7 +27,7 @@ export { RestAPI };
|
|
27
27
|
* @since 3.12.0
|
28
28
|
*/
|
29
29
|
const rawDataSymbol = Symbol.for(
|
30
|
-
|
30
|
+
"@schukai/monster/data/datasource/server/restapi/rawdata",
|
31
31
|
);
|
32
32
|
|
33
33
|
/**
|
@@ -41,138 +41,138 @@ const rawDataSymbol = Symbol.for(
|
|
41
41
|
* @summary The RestAPI is a class that binds a REST API server.
|
42
42
|
*/
|
43
43
|
class RestAPI extends Server {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
44
|
+
/**
|
45
|
+
*
|
46
|
+
* @param {Object} [options] options contains definitions for the datasource.
|
47
|
+
*/
|
48
|
+
constructor(options) {
|
49
|
+
super();
|
50
|
+
|
51
|
+
if (isObject(options)) {
|
52
|
+
this.setOptions(options);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* This method is called by the `instanceof` operator.
|
58
|
+
* @returns {symbol}
|
59
|
+
* @since 2.1.0
|
60
|
+
*/
|
61
|
+
static get [instanceSymbol]() {
|
62
|
+
return Symbol.for("@schukai/monster/data/datasource/server/restapi");
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* @property {Object} write={} Options
|
67
|
+
* @property {Object} write.init={} An options object containing any custom settings that you want to apply to the request. The parameters are identical to those of the {@link https://developer.mozilla.org/en-US/docs/Web/API/Request/Request|Request constructor}
|
68
|
+
* @property {string} write.init.method=POST
|
69
|
+
* @property {Object} write.init.headers Object containing any custom headers that you want to apply to the request.
|
70
|
+
* @property {string} write.responseCallback Callback function to be executed after the request has been completed.
|
71
|
+
* @property {string} write.acceptedStatus=[200,201]
|
72
|
+
* @property {string} write.url URL
|
73
|
+
* @property {Object} write.mapping the mapping is applied before writing.
|
74
|
+
* @property {String} write.mapping.transformer Transformer to select the appropriate entries
|
75
|
+
* @property {Monster.Data.Datasource~exampleCallback[]} write.mapping.callback with the help of the callback, the structures can be adjusted before writing.
|
76
|
+
* @property {Object} write.report
|
77
|
+
* @property {String} write.report.path Path to validations
|
78
|
+
* @property {Object} write.sheathing
|
79
|
+
* @property {Object} write.sheathing.object Object to be wrapped
|
80
|
+
* @property {string} write.sheathing.path Path to the data
|
81
|
+
* @property {Object} read={} Options
|
82
|
+
* @property {Object} read.init={} An options object containing any custom settings that you want to apply to the request. The parameters are identical to those of the {@link https://developer.mozilla.org/en-US/docs/Web/API/Request/Request|Request constructor}
|
83
|
+
* @property {string} read.init.method=GET
|
84
|
+
* @property {string} read.acceptedStatus=[200]
|
85
|
+
* @property {string} read.url URL
|
86
|
+
* @property {Object} read.mapping the mapping is applied after reading.
|
87
|
+
* @property {String} read.mapping.transformer Transformer to select the appropriate entries
|
88
|
+
* @property {Monster.Data.Datasource~exampleCallback[]} read.mapping.callback with the help of the callback, the structures can be adjusted after reading.
|
89
|
+
*/
|
90
|
+
get defaults() {
|
91
|
+
return Object.assign({}, super.defaults, {
|
92
|
+
write: {
|
93
|
+
init: {
|
94
|
+
method: "POST",
|
95
|
+
},
|
96
|
+
responseCallback: undefined,
|
97
|
+
acceptedStatus: [200, 201],
|
98
|
+
url: null,
|
99
|
+
mapping: {
|
100
|
+
transformer: undefined,
|
101
|
+
callbacks: [],
|
102
|
+
},
|
103
|
+
sheathing: {
|
104
|
+
object: undefined,
|
105
|
+
path: undefined,
|
106
|
+
},
|
107
|
+
report: {
|
108
|
+
path: undefined,
|
109
|
+
},
|
110
|
+
},
|
111
|
+
read: {
|
112
|
+
init: {
|
113
|
+
method: "GET",
|
114
|
+
},
|
115
|
+
responseCallback: undefined,
|
116
|
+
acceptedStatus: [200],
|
117
|
+
url: null,
|
118
|
+
mapping: {
|
119
|
+
transformer: undefined,
|
120
|
+
callbacks: [],
|
121
|
+
},
|
122
|
+
},
|
123
|
+
});
|
124
|
+
}
|
125
|
+
|
126
|
+
/**
|
127
|
+
* @return {Promise}
|
128
|
+
* @throws {Error} the options does not contain a valid json definition
|
129
|
+
* @throws {TypeError} value is not a object
|
130
|
+
* @throws {Error} the data cannot be read
|
131
|
+
*/
|
132
|
+
read() {
|
133
|
+
let init = this.getOption("read.init");
|
134
|
+
if (!isObject(init)) init = {};
|
135
|
+
if (!init["method"]) init["method"] = "GET";
|
136
|
+
|
137
|
+
let callback = this.getOption("read.responseCallback");
|
138
|
+
if (!callback)
|
139
|
+
callback = (obj) => {
|
140
|
+
this.set(this.transformServerPayload.call(this, obj));
|
141
|
+
};
|
142
|
+
|
143
|
+
return fetchData.call(this, init, "read", callback);
|
144
|
+
}
|
145
|
+
|
146
|
+
/**
|
147
|
+
* @return {Promise}
|
148
|
+
* @throws {WriteError} the data cannot be written
|
149
|
+
*/
|
150
|
+
write() {
|
151
|
+
let init = this.getOption("write.init");
|
152
|
+
if (!isObject(init)) init = {};
|
153
|
+
if (typeof init["headers"] !== "object") {
|
154
|
+
init["headers"] = {
|
155
|
+
"Content-Type": "application/json",
|
156
|
+
};
|
157
|
+
}
|
158
|
+
if (!init["method"]) init["method"] = "POST";
|
159
|
+
|
160
|
+
const obj = this.prepareServerPayload(this.get());
|
161
|
+
init["body"] = JSON.stringify(obj);
|
162
|
+
|
163
|
+
const callback = this.getOption("write.responseCallback");
|
164
|
+
return fetchData.call(this, init, "write", callback);
|
165
|
+
}
|
166
|
+
|
167
|
+
/**
|
168
|
+
* @return {RestAPI}
|
169
|
+
*/
|
170
|
+
getClone() {
|
171
|
+
return new RestAPI(
|
172
|
+
this[internalSymbol].getRealSubject()["options"].read,
|
173
|
+
this[internalSymbol].getRealSubject()["options"].write,
|
174
|
+
);
|
175
|
+
}
|
176
176
|
}
|
177
177
|
|
178
178
|
/**
|
@@ -183,45 +183,47 @@ class RestAPI extends Server {
|
|
183
183
|
* @returns {Promise<string>}
|
184
184
|
*/
|
185
185
|
function fetchData(init, key, callback) {
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
186
|
+
let response;
|
187
|
+
|
188
|
+
return fetch(this.getOption(`${key}.url`), init)
|
189
|
+
.then((resp) => {
|
190
|
+
response = resp;
|
191
|
+
|
192
|
+
const acceptedStatus = this.getOption(`${key}.acceptedStatus`, [200]).map(Number);
|
193
|
+
|
194
|
+
if (acceptedStatus.indexOf(resp.status) === -1) {
|
195
|
+
throw new DataFetchError(
|
196
|
+
`the response does not contain an accepted status (actual: ${resp.status}).`,
|
197
|
+
response,
|
198
|
+
);
|
199
|
+
}
|
200
|
+
|
201
|
+
return resp.text();
|
202
|
+
})
|
203
|
+
.then((body) => {
|
204
|
+
let obj;
|
205
|
+
|
206
|
+
try {
|
207
|
+
obj = JSON.parse(body);
|
208
|
+
|
209
|
+
response[rawDataSymbol] = obj;
|
210
|
+
} catch (e) {
|
211
|
+
if (body.length > 100) {
|
212
|
+
body = `${body.substring(0, 97)}...`;
|
213
|
+
}
|
214
|
+
|
215
|
+
throw new DataFetchError(
|
216
|
+
`the response does not contain a valid json (actual: ${body}).`,
|
217
|
+
response,
|
218
|
+
);
|
219
|
+
}
|
220
|
+
|
221
|
+
if (callback && isFunction(callback)) {
|
222
|
+
callback(obj);
|
223
|
+
}
|
224
|
+
|
225
|
+
return response;
|
226
|
+
}).catch((e) => {
|
227
|
+
throw e;
|
228
|
+
});
|
227
229
|
}
|
@@ -327,6 +327,7 @@ class CustomElement extends HTMLElement {
|
|
327
327
|
* @property {Object} templates Specifies the templates used by the control.
|
328
328
|
* @property {string} templates.main=undefined Specifies the main template used by the control.
|
329
329
|
* @property {Object} templateMapping Specifies the mapping of templates.
|
330
|
+
* @property {string} display=block Specifies the display mode of the control.
|
330
331
|
* @since 1.8.0
|
331
332
|
*/
|
332
333
|
get defaults() {
|
@@ -338,6 +339,7 @@ class CustomElement extends HTMLElement {
|
|
338
339
|
main: undefined,
|
339
340
|
},
|
340
341
|
templateMapping: {},
|
342
|
+
display: "block"
|
341
343
|
};
|
342
344
|
}
|
343
345
|
|
@@ -595,6 +597,8 @@ class CustomElement extends HTMLElement {
|
|
595
597
|
let elements;
|
596
598
|
let nodeList;
|
597
599
|
|
600
|
+
this.style.setProperty("display", this.getOption("display"));
|
601
|
+
|
598
602
|
// Extract options from attributes and set them
|
599
603
|
const AttributeOptions = getOptionsFromAttributes.call(this);
|
600
604
|
if (
|
package/source/dom/updater.mjs
CHANGED
@@ -44,7 +44,7 @@ import { findDocumentTemplate } from "./template.mjs";
|
|
44
44
|
export { Updater, addObjectWithUpdaterToElement };
|
45
45
|
|
46
46
|
/**
|
47
|
-
* The updater class connects an object with the
|
47
|
+
* The updater class connects an object with the DOM. In this way, structures and contents in the DOM can be
|
48
48
|
* programmatically adapted via attributes.
|
49
49
|
*
|
50
50
|
* For example, to include a string from an object, the attribute `data-monster-replace` can be used.
|
@@ -12,8 +12,8 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
import { isIterable, isString } from "
|
16
|
-
import { validateFunction, validateString } from "
|
15
|
+
import { isIterable, isString } from "./is.mjs";
|
16
|
+
import { validateFunction, validateString } from "./validate.mjs";
|
17
17
|
import { Base } from "./base.mjs";
|
18
18
|
|
19
19
|
export { TokenList };
|
@@ -10,13 +10,12 @@ import {storageObjectSymbol} from "../../../../source/data/datasource/storage.mj
|
|
10
10
|
let expect = chai.expect;
|
11
11
|
chai.use(chaiDom);
|
12
12
|
|
13
|
-
const global = getGlobal();
|
14
|
-
|
15
13
|
let html1 = `
|
16
14
|
<div id="test1">
|
17
15
|
<monster-form id="form1"></monster-form>
|
18
16
|
</div>
|
19
17
|
`;
|
18
|
+
|
20
19
|
let html2 = `
|
21
20
|
<div id="test2">
|
22
21
|
<monster-form id="form2"
|
@@ -37,27 +36,6 @@ let html2 = `
|
|
37
36
|
</monster-form>
|
38
37
|
</div>
|
39
38
|
`;
|
40
|
-
let html3 = `
|
41
|
-
<div id="test3">
|
42
|
-
<monster-form id="form3">
|
43
|
-
<div>
|
44
|
-
<div>
|
45
|
-
<input name="control1"
|
46
|
-
id="control1"
|
47
|
-
data-monster-attributes="value path:a"
|
48
|
-
data-monster-bind="path:a">
|
49
|
-
</div>
|
50
|
-
</div>
|
51
|
-
<div>
|
52
|
-
<input name="control2"
|
53
|
-
data-monster-attributes="value path:b"
|
54
|
-
data-monster-bind="path:b">
|
55
|
-
</div>
|
56
|
-
<button id="button1" data-monster-datasource-handler="write">Button</button>
|
57
|
-
|
58
|
-
</monster-form>
|
59
|
-
</div>
|
60
|
-
`;
|
61
39
|
|
62
40
|
describe('Form', function () {
|
63
41
|
|
@@ -81,165 +59,6 @@ describe('Form', function () {
|
|
81
59
|
localStorage.removeItem('test-key')
|
82
60
|
})
|
83
61
|
|
84
|
-
|
85
|
-
describe("register own datasources", function () {
|
86
|
-
|
87
|
-
const sym = Symbol.for('@schukai/monster/data/datasource/@@data');
|
88
|
-
|
89
|
-
let test3Datasource = class extends Datasource {
|
90
|
-
constructor() {
|
91
|
-
super();
|
92
|
-
}
|
93
|
-
|
94
|
-
read() {
|
95
|
-
this[sym].setSubject({a: "test3", b: "test3"})
|
96
|
-
return Promise.resolve();
|
97
|
-
}
|
98
|
-
|
99
|
-
get() {
|
100
|
-
const self = this;
|
101
|
-
return self[sym].getRealSubject();
|
102
|
-
}
|
103
|
-
|
104
|
-
}
|
105
|
-
|
106
|
-
beforeEach(() => {
|
107
|
-
let mocks = document.getElementById('mocks');
|
108
|
-
mocks.innerHTML = html3;
|
109
|
-
|
110
|
-
// register own datasource, after the form is loaded
|
111
|
-
// because in the wild, the form is parsed before the datasource is registered
|
112
|
-
form.registerDatasource('test3', test3Datasource);
|
113
|
-
|
114
|
-
|
115
|
-
});
|
116
|
-
|
117
|
-
it("should be able to register own datasources", function (done) {
|
118
|
-
let m = form.getDatasources('test3')
|
119
|
-
expect(m.get('test3')).is.a.equal(test3Datasource);
|
120
|
-
|
121
|
-
const testDatasource = new test3Datasource();
|
122
|
-
|
123
|
-
const formElement = document.getElementById('form3');
|
124
|
-
formElement.setOption("datasource", testDatasource);
|
125
|
-
formElement.refresh().then(() => {
|
126
|
-
const v = formElement.getValues()
|
127
|
-
expect(v).is.deep.equal({a: "test3", b: "test3"})
|
128
|
-
done();
|
129
|
-
}).catch(e => done(e))
|
130
|
-
|
131
|
-
|
132
|
-
})
|
133
|
-
|
134
|
-
|
135
|
-
})
|
136
|
-
|
137
|
-
describe("register and unregister datasources", function () {
|
138
|
-
const TestDatasource = class extends Datasource {
|
139
|
-
constructor() {
|
140
|
-
super();
|
141
|
-
}
|
142
|
-
}
|
143
|
-
|
144
|
-
it("should register new datasource", function () {
|
145
|
-
|
146
|
-
form.registerDatasource('test', TestDatasource);
|
147
|
-
let m = form.getDatasources('test')
|
148
|
-
expect(m.get('test')).is.a.equal(TestDatasource);
|
149
|
-
|
150
|
-
form.unregisterDatasource('test');
|
151
|
-
m = form.getDatasources('test')
|
152
|
-
|
153
|
-
expect(m.get('test')).to.be.undefined;
|
154
|
-
})
|
155
|
-
|
156
|
-
})
|
157
|
-
|
158
|
-
|
159
|
-
describe("example4-doc", function () {
|
160
|
-
|
161
|
-
it("should init button with click event", function (done) {
|
162
|
-
|
163
|
-
class MockDatasource extends Datasource {
|
164
|
-
|
165
|
-
constructor() {
|
166
|
-
super();
|
167
|
-
}
|
168
|
-
|
169
|
-
read() {
|
170
|
-
return Promise.resolve({});
|
171
|
-
}
|
172
|
-
|
173
|
-
write(data) {
|
174
|
-
// done();
|
175
|
-
}
|
176
|
-
|
177
|
-
[storageObjectSymbol]() {
|
178
|
-
return localStorage;
|
179
|
-
}
|
180
|
-
|
181
|
-
}
|
182
|
-
|
183
|
-
const form4 = document.createElement('monster-form');
|
184
|
-
const datasource4 = new MockDatasource();
|
185
|
-
expect(datasource4 instanceof Datasource).is.true;
|
186
|
-
form4.setOption('datasource', datasource4)
|
187
|
-
|
188
|
-
const input4 = document.createElement('input')
|
189
|
-
input4.setAttribute('name', 'field');
|
190
|
-
input4.setAttribute('data-monster-attributes', 'value path:headers.Host');
|
191
|
-
input4.setAttribute('data-monster-bind', 'path:headers.Host');
|
192
|
-
form4.appendChild(input4);
|
193
|
-
|
194
|
-
const button4 = document.createElement('monster-state-button');
|
195
|
-
button4.setOption('labels.button', 'click!')
|
196
|
-
button4.setAttribute('data-monster-datasource-handler', 'write')
|
197
|
-
button4.setOption('actions.click', () => {
|
198
|
-
|
199
|
-
})
|
200
|
-
|
201
|
-
form4.appendChild(button4);
|
202
|
-
|
203
|
-
document.getElementById('mocks').appendChild(form4);
|
204
|
-
|
205
|
-
new Processing().add(() => {
|
206
|
-
button4.click();
|
207
|
-
}
|
208
|
-
).run().then(() => {
|
209
|
-
done();
|
210
|
-
}).catch(e => done(e))
|
211
|
-
|
212
|
-
|
213
|
-
})
|
214
|
-
|
215
|
-
|
216
|
-
}
|
217
|
-
)
|
218
|
-
|
219
|
-
describe('document.createElement()', function () {
|
220
|
-
|
221
|
-
it('should contain objectlink', function (done) {
|
222
|
-
|
223
|
-
let mocks = document.getElementById('mocks');
|
224
|
-
const formControl = document.createElement('monster-form');
|
225
|
-
mocks.appendChild(formControl);
|
226
|
-
|
227
|
-
setTimeout(() => {
|
228
|
-
try {
|
229
|
-
expect(document.getElementById('mocks')).contain.html('<monster-form data-monster-objectlink="Symbol(@schukai/monster/dom/custom-element@@options-updater-link)"></monster-form>')
|
230
|
-
done();
|
231
|
-
} catch (e) {
|
232
|
-
return done(e);
|
233
|
-
}
|
234
|
-
|
235
|
-
|
236
|
-
}, 0)
|
237
|
-
|
238
|
-
|
239
|
-
});
|
240
|
-
|
241
|
-
});
|
242
|
-
|
243
62
|
describe('HTML-Templates', function () {
|
244
63
|
|
245
64
|
describe('create from template html1', function () {
|
@@ -55,7 +55,7 @@ describe('Details', function () {
|
|
55
55
|
try {
|
56
56
|
|
57
57
|
expect(document.getElementById('mocks')).contain.html(
|
58
|
-
'<monster-details id="details1" data-monster-objectlink="Symbol(@schukai/monster/dom/custom-element@@options-updater-link)" data-monster-button-label="Details"></monster-details>')
|
58
|
+
'<monster-details id="details1" style="display: block;" data-monster-objectlink="Symbol(@schukai/monster/dom/custom-element@@options-updater-link)" data-monster-button-label="Details"></monster-details>')
|
59
59
|
} catch (e) {
|
60
60
|
return done(e);
|
61
61
|
}
|
@@ -52,7 +52,7 @@ describe('Host', function () {
|
|
52
52
|
|
53
53
|
setTimeout(() => {
|
54
54
|
try {
|
55
|
-
expect(document.getElementById('mocks')).contain.html('<monster-host data-monster-objectlink="Symbol(@schukai/monster/dom/custom-element@@options-updater-link)"></monster-host>')
|
55
|
+
expect(document.getElementById('mocks')).contain.html('<monster-host style="display: block;" data-monster-objectlink="Symbol(@schukai/monster/dom/custom-element@@options-updater-link)"></monster-host>')
|
56
56
|
} catch (e) {
|
57
57
|
return done(e);
|
58
58
|
}
|