jsf.js_next_gen 4.0.1-beta.4 → 4.0.1-beta.6
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/dist/window/faces-development.js +97 -68
- package/dist/window/faces-development.js.br +0 -0
- package/dist/window/faces-development.js.gz +0 -0
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +97 -68
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +1 -1
- package/src/main/typescript/impl/util/FileUtils.ts +1 -1
- package/src/main/typescript/impl/util/XhrQueueController.ts +3 -17
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +4 -4
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +95 -52
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -1
- package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/blank.css +15 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/test.js +15 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/test2.js +15 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +40 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +7 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +15 -0
- package/src/main/typescript/test/myfaces/{OnLoadSpec.ts → OnLoad.spec.ts} +2 -2
- package/src/main/typescript/test/xhrCore/ErrorChainTest.spec.ts +113 -0
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +9 -12
- package/target/impl/util/FileUtils.js +1 -1
- package/target/impl/util/FileUtils.js.map +1 -1
- package/target/impl/util/XhrQueueController.js +3 -18
- package/target/impl/util/XhrQueueController.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +2 -2
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +89 -45
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +138 -138
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +39 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +4 -0
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
- package/target/test/myfaces/OnLoad.spec.js +57 -0
- package/target/test/myfaces/OnLoad.spec.js.map +1 -0
- package/target/test/myfaces/OnLoadSpec.js +2 -2
- package/target/test/myfaces/OnLoadSpec.js.map +1 -1
- package/target/test/xhrCore/ErrorChainTest.spec.js +135 -0
- package/target/test/xhrCore/ErrorChainTest.spec.js.map +1 -0
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +8 -5
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -1
|
@@ -27,12 +27,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
27
27
|
const chai_1 = require("chai");
|
|
28
28
|
const mocha_1 = require("mocha");
|
|
29
29
|
const rxjs_1 = require("rxjs");
|
|
30
|
-
const
|
|
30
|
+
const umd_1 = require("mona-dish/dist/js/umd");
|
|
31
31
|
const tobago_with_header_1 = require("./markups/tobago-with-header");
|
|
32
32
|
const tobago_without_header_1 = require("./markups/tobago-without-header");
|
|
33
33
|
const jsdom = require("jsdom");
|
|
34
34
|
const { JSDOM } = jsdom;
|
|
35
|
-
var trim =
|
|
35
|
+
var trim = umd_1.Lang.trim;
|
|
36
36
|
global.window = {};
|
|
37
37
|
let dom = null;
|
|
38
38
|
(0, mocha_1.describe)('DOMQuery tests', function () {
|
|
@@ -70,10 +70,10 @@ let dom = null;
|
|
|
70
70
|
this.afterEach(function () {
|
|
71
71
|
});
|
|
72
72
|
(0, mocha_1.it)('basic init', function () {
|
|
73
|
-
let probe1 = new
|
|
74
|
-
let probe2 =
|
|
75
|
-
let probe3 = new
|
|
76
|
-
let probe4 = new
|
|
73
|
+
let probe1 = new umd_1.DomQuery(window.document.body);
|
|
74
|
+
let probe2 = umd_1.DomQuery.querySelectorAll("div");
|
|
75
|
+
let probe3 = new umd_1.DomQuery(probe1, probe2);
|
|
76
|
+
let probe4 = new umd_1.DomQuery(window.document.body, probe3);
|
|
77
77
|
(0, chai_1.expect)(probe1.length).to.be.eq(1);
|
|
78
78
|
(0, chai_1.expect)(probe2.length == 4).to.be.true;
|
|
79
79
|
(0, chai_1.expect)(probe3.length == 5).to.be.true;
|
|
@@ -81,10 +81,10 @@ let dom = null;
|
|
|
81
81
|
(0, chai_1.expect)(probe4.length == 6).to.be.true;
|
|
82
82
|
});
|
|
83
83
|
(0, mocha_1.it)('proper iterator api and rxjs mapping', function () {
|
|
84
|
-
let probe1 = new
|
|
85
|
-
let probe2 =
|
|
86
|
-
let o1 = (0, rxjs_1.from)(
|
|
87
|
-
let o2 = (0, rxjs_1.from)(
|
|
84
|
+
let probe1 = new umd_1.DomQuery(window.document.body);
|
|
85
|
+
let probe2 = umd_1.DomQuery.querySelectorAll("div");
|
|
86
|
+
let o1 = (0, rxjs_1.from)(umd_1.Stream.ofDataSource(probe1));
|
|
87
|
+
let o2 = (0, rxjs_1.from)(umd_1.Stream.ofDataSource(probe2));
|
|
88
88
|
let cnt1 = 0;
|
|
89
89
|
let isDQuery = false;
|
|
90
90
|
let cnt2 = 0;
|
|
@@ -93,17 +93,17 @@ let dom = null;
|
|
|
93
93
|
});
|
|
94
94
|
o2.subscribe((item) => {
|
|
95
95
|
cnt2++;
|
|
96
|
-
isDQuery = (item.length == 1) && (item instanceof
|
|
96
|
+
isDQuery = (item.length == 1) && (item instanceof umd_1.DomQuery);
|
|
97
97
|
});
|
|
98
98
|
(0, chai_1.expect)(probe1.length).to.be.eq(1);
|
|
99
99
|
(0, chai_1.expect)(probe2.length == 4).to.be.true;
|
|
100
100
|
(0, chai_1.expect)(isDQuery).to.be.true;
|
|
101
101
|
});
|
|
102
102
|
(0, mocha_1.it)('proper iterator api and rxjs mapping with observable', function () {
|
|
103
|
-
let probe1 = new
|
|
104
|
-
let probe2 =
|
|
105
|
-
let o1 = (0, rxjs_1.from)(
|
|
106
|
-
let o2 = (0, rxjs_1.from)(
|
|
103
|
+
let probe1 = new umd_1.DomQuery(window.document.body);
|
|
104
|
+
let probe2 = umd_1.DomQuery.querySelectorAll("div");
|
|
105
|
+
let o1 = (0, rxjs_1.from)(umd_1.Stream.ofDataSource(probe1));
|
|
106
|
+
let o2 = (0, rxjs_1.from)(umd_1.Stream.ofDataSource(probe2));
|
|
107
107
|
let cnt1 = 0;
|
|
108
108
|
let isDQuery = false;
|
|
109
109
|
let cnt2 = 0;
|
|
@@ -112,64 +112,64 @@ let dom = null;
|
|
|
112
112
|
});
|
|
113
113
|
o2.subscribe((item) => {
|
|
114
114
|
cnt2++;
|
|
115
|
-
isDQuery = (item.length == 1) && (item instanceof
|
|
115
|
+
isDQuery = (item.length == 1) && (item instanceof umd_1.DomQuery);
|
|
116
116
|
});
|
|
117
117
|
(0, chai_1.expect)(probe1.length).to.be.eq(1);
|
|
118
118
|
(0, chai_1.expect)(probe2.length == 4).to.be.true;
|
|
119
119
|
(0, chai_1.expect)(isDQuery).to.be.true;
|
|
120
120
|
});
|
|
121
121
|
(0, mocha_1.it)('domquery ops test filter', function () {
|
|
122
|
-
let probe2 =
|
|
122
|
+
let probe2 = umd_1.DomQuery.querySelectorAll("div");
|
|
123
123
|
probe2 = probe2.filter((item) => item.id.match((id) => id != "id_1"));
|
|
124
124
|
(0, chai_1.expect)(probe2.length == 3);
|
|
125
125
|
});
|
|
126
126
|
(0, mocha_1.it)('global eval test', function () {
|
|
127
|
-
let probe2 =
|
|
127
|
+
let probe2 = umd_1.DomQuery.querySelectorAll("div");
|
|
128
128
|
probe2 = probe2.filter((item) => item.id.match((id) => id != "id_1"));
|
|
129
129
|
(0, chai_1.expect)(probe2.length == 3);
|
|
130
130
|
});
|
|
131
131
|
(0, mocha_1.it)('must detach', function () {
|
|
132
|
-
let probe2 =
|
|
132
|
+
let probe2 = umd_1.DomQuery.querySelectorAll("div#id_1");
|
|
133
133
|
probe2.detach();
|
|
134
|
-
(0, chai_1.expect)(
|
|
135
|
-
probe2.appendTo(
|
|
136
|
-
(0, chai_1.expect)(
|
|
134
|
+
(0, chai_1.expect)(umd_1.DomQuery.querySelectorAll("div#id_1").isPresent()).to.be.false;
|
|
135
|
+
probe2.appendTo(umd_1.DomQuery.querySelectorAll("body"));
|
|
136
|
+
(0, chai_1.expect)(umd_1.DomQuery.querySelectorAll("div#id_1").isPresent()).to.be.true;
|
|
137
137
|
});
|
|
138
138
|
(0, mocha_1.it)('domquery ops test2 each', () => {
|
|
139
|
-
let probe2 =
|
|
140
|
-
|
|
139
|
+
let probe2 = umd_1.DomQuery.querySelectorAll("div#id_1");
|
|
140
|
+
umd_1.DomQuery.globalEval("document.getElementById('id_1').innerHTML = 'hello'");
|
|
141
141
|
(0, chai_1.expect)(probe2.html().value).to.eq("hello");
|
|
142
|
-
(0, chai_1.expect)(
|
|
143
|
-
|
|
142
|
+
(0, chai_1.expect)(umd_1.DomQuery.byId(document.head).innerHTML.indexOf("document.getElementById('id_1').innerHTML = 'hello'")).to.eq(-1);
|
|
143
|
+
umd_1.DomQuery.globalEval("document.getElementById('id_1').innerHTML = 'hello2'", "nonci");
|
|
144
144
|
(0, chai_1.expect)(probe2.html().value).to.eq("hello2");
|
|
145
145
|
});
|
|
146
146
|
(0, mocha_1.it)('domquery ops test2 with sticky eval code', () => {
|
|
147
|
-
let probe2 =
|
|
148
|
-
|
|
147
|
+
let probe2 = umd_1.DomQuery.querySelectorAll("div#id_1");
|
|
148
|
+
umd_1.DomQuery.globalEvalSticky("document.getElementById('id_1').innerHTML = 'hello'");
|
|
149
149
|
(0, chai_1.expect)(probe2.html().value).to.eq("hello");
|
|
150
|
-
(0, chai_1.expect)(
|
|
151
|
-
|
|
150
|
+
(0, chai_1.expect)(umd_1.DomQuery.byId(document.head).innerHTML.indexOf("document.getElementById('id_1').innerHTML = 'hello'")).not.to.eq(-1);
|
|
151
|
+
umd_1.DomQuery.globalEvalSticky("document.getElementById('id_1').innerHTML = 'hello2'", "nonci");
|
|
152
152
|
(0, chai_1.expect)(probe2.html().value).to.eq("hello2");
|
|
153
|
-
(0, chai_1.expect)(
|
|
153
|
+
(0, chai_1.expect)(umd_1.DomQuery.byId(document.head).innerHTML.indexOf("document.getElementById('id_1').innerHTML = 'hello2'")).not.to.eq(-1);
|
|
154
154
|
});
|
|
155
155
|
(0, mocha_1.it)('domquery ops test2 eachNode', function () {
|
|
156
|
-
let probe2 =
|
|
156
|
+
let probe2 = umd_1.DomQuery.querySelectorAll("div");
|
|
157
157
|
let noIter = 0;
|
|
158
158
|
probe2 = probe2.each((item, cnt) => {
|
|
159
|
-
(0, chai_1.expect)(item instanceof
|
|
159
|
+
(0, chai_1.expect)(item instanceof umd_1.DomQuery).to.be.true;
|
|
160
160
|
(0, chai_1.expect)(noIter == cnt).to.be.true;
|
|
161
161
|
noIter++;
|
|
162
162
|
});
|
|
163
163
|
(0, chai_1.expect)(noIter == 4).to.be.true;
|
|
164
164
|
});
|
|
165
165
|
(0, mocha_1.it)('domquery ops test2 byId', function () {
|
|
166
|
-
let probe2 =
|
|
166
|
+
let probe2 = umd_1.DomQuery.byId("id_1");
|
|
167
167
|
(0, chai_1.expect)(probe2.length == 1).to.be.true;
|
|
168
|
-
probe2 =
|
|
168
|
+
probe2 = umd_1.DomQuery.byTagName("div");
|
|
169
169
|
(0, chai_1.expect)(probe2.length == 4).to.be.true;
|
|
170
170
|
});
|
|
171
171
|
(0, mocha_1.it)('outerhtml and eval tests', function () {
|
|
172
|
-
let probe1 = new
|
|
172
|
+
let probe1 = new umd_1.DomQuery(window.document.body);
|
|
173
173
|
probe1.querySelectorAll("#id_1").outerHTML(`
|
|
174
174
|
<div id='barg'>
|
|
175
175
|
|
|
@@ -184,7 +184,7 @@ let dom = null;
|
|
|
184
184
|
(0, chai_1.expect)(window.document.body.innerHTML.indexOf("blarg") != -1).to.be.true;
|
|
185
185
|
});
|
|
186
186
|
(0, mocha_1.it)('attr test and eval tests', function () {
|
|
187
|
-
let probe1 = new
|
|
187
|
+
let probe1 = new umd_1.DomQuery(document);
|
|
188
188
|
probe1.querySelectorAll("div#id_2").attr("style").value = "border=1;";
|
|
189
189
|
let blarg = probe1.querySelectorAll("div#id_2").attr("booga").value;
|
|
190
190
|
let style = probe1.querySelectorAll("div#id_2").attr("style").value;
|
|
@@ -194,7 +194,7 @@ let dom = null;
|
|
|
194
194
|
(0, chai_1.expect)(nonexistent).to.be.eq(null);
|
|
195
195
|
});
|
|
196
196
|
(0, mocha_1.it)('style must work ', function () {
|
|
197
|
-
let probe1 = new
|
|
197
|
+
let probe1 = new umd_1.DomQuery(document);
|
|
198
198
|
let probe = probe1.querySelectorAll("div#id_2");
|
|
199
199
|
probe.style("border").value = "10px solid red";
|
|
200
200
|
probe.style("color").value = "blue";
|
|
@@ -204,7 +204,7 @@ let dom = null;
|
|
|
204
204
|
(0, chai_1.expect)(styleNodeLevel).to.eq('blue');
|
|
205
205
|
});
|
|
206
206
|
(0, mocha_1.it)('must perform addClass and hasClass correctly', function () {
|
|
207
|
-
let probe1 = new
|
|
207
|
+
let probe1 = new umd_1.DomQuery(document);
|
|
208
208
|
let element = probe1.querySelectorAll("div#id_2");
|
|
209
209
|
element.addClass("booga").addClass("Booga2");
|
|
210
210
|
let classdef = element.attr("class").value;
|
|
@@ -214,7 +214,7 @@ let dom = null;
|
|
|
214
214
|
(0, chai_1.expect)(element.hasClass("booga")).to.be.true;
|
|
215
215
|
});
|
|
216
216
|
(0, mocha_1.it)('must perform addClass and hasClass correctly 2', function () {
|
|
217
|
-
let probe1 = new
|
|
217
|
+
let probe1 = new umd_1.DomQuery(document);
|
|
218
218
|
let element = probe1.querySelectorAll(".blarg2");
|
|
219
219
|
element.addClass("booga").addClass("Booga2");
|
|
220
220
|
let classdef = element.attr("class").value;
|
|
@@ -225,34 +225,34 @@ let dom = null;
|
|
|
225
225
|
(0, chai_1.expect)(element.hasClass("blarg2")).to.be.true;
|
|
226
226
|
});
|
|
227
227
|
(0, mocha_1.it)('must perform addClass and hasClass correctly 2', function () {
|
|
228
|
-
let probe1 = new
|
|
228
|
+
let probe1 = new umd_1.DomQuery(document);
|
|
229
229
|
let element = probe1.querySelectorAll(".blarg2");
|
|
230
230
|
element.addClass("booga").addClass("Booga2");
|
|
231
231
|
(0, chai_1.expect)(probe1.querySelectorAll(".Booga2").length).eq(2);
|
|
232
232
|
});
|
|
233
233
|
(0, mocha_1.it)('must perform insert before and insert after correctly', function () {
|
|
234
|
-
let probe1 = new
|
|
235
|
-
let insert =
|
|
236
|
-
let insert2 =
|
|
234
|
+
let probe1 = new umd_1.DomQuery(document).querySelectorAll("#id_2");
|
|
235
|
+
let insert = umd_1.DomQuery.fromMarkup("<div id='insertedBefore'></div><div id='insertedBefore2'></div>");
|
|
236
|
+
let insert2 = umd_1.DomQuery.fromMarkup("<div id='insertedAfter'></div><div id='insertedAfter2'></div>");
|
|
237
237
|
probe1.insertBefore(insert);
|
|
238
238
|
probe1.insertAfter(insert2);
|
|
239
|
-
(0, chai_1.expect)(
|
|
240
|
-
(0, chai_1.expect)(
|
|
241
|
-
(0, chai_1.expect)(
|
|
242
|
-
(0, chai_1.expect)(
|
|
243
|
-
(0, chai_1.expect)(
|
|
239
|
+
(0, chai_1.expect)(umd_1.DomQuery.querySelectorAll("#insertedBefore").isPresent()).to.be.true;
|
|
240
|
+
(0, chai_1.expect)(umd_1.DomQuery.querySelectorAll("#insertedBefore2").isPresent()).to.be.true;
|
|
241
|
+
(0, chai_1.expect)(umd_1.DomQuery.querySelectorAll("#id_2").isPresent()).to.be.true;
|
|
242
|
+
(0, chai_1.expect)(umd_1.DomQuery.querySelectorAll("#insertedAfter").isPresent()).to.be.true;
|
|
243
|
+
(0, chai_1.expect)(umd_1.DomQuery.querySelectorAll("#insertedAfter2").isPresent()).to.be.true;
|
|
244
244
|
});
|
|
245
245
|
(0, mocha_1.it)('do not create new <html> tag on <header', function () {
|
|
246
|
-
const fromMarkupWithHeader =
|
|
247
|
-
const fromMarkupWithoutHeader =
|
|
246
|
+
const fromMarkupWithHeader = umd_1.DomQuery.fromMarkup(tobago_with_header_1.tobagoSheetWithHeader);
|
|
247
|
+
const fromMarkupWithoutHeader = umd_1.DomQuery.fromMarkup(tobago_without_header_1.tobagoSheetWithoutHeader);
|
|
248
248
|
(0, chai_1.expect)(fromMarkupWithHeader.tagName.value === "HTML").to.be.false;
|
|
249
249
|
(0, chai_1.expect)(fromMarkupWithoutHeader.tagName.value === "HTML").to.be.false;
|
|
250
250
|
});
|
|
251
251
|
(0, mocha_1.it)('do not falsely assume standard tag', function () {
|
|
252
|
-
const fromMarkup1 =
|
|
252
|
+
const fromMarkup1 = umd_1.DomQuery.fromMarkup(`
|
|
253
253
|
<head-mine>booga</head-mine>
|
|
254
254
|
`);
|
|
255
|
-
const fromMarkup2 =
|
|
255
|
+
const fromMarkup2 = umd_1.DomQuery.fromMarkup(`
|
|
256
256
|
<body_mine>booga</body_mine>
|
|
257
257
|
|
|
258
258
|
`);
|
|
@@ -262,38 +262,38 @@ let dom = null;
|
|
|
262
262
|
(0, chai_1.expect)(fromMarkup2.tagName.value === "BODY").to.be.false;
|
|
263
263
|
});
|
|
264
264
|
(0, mocha_1.it)('it must stream', function () {
|
|
265
|
-
let probe1 = new
|
|
266
|
-
let coll =
|
|
265
|
+
let probe1 = new umd_1.DomQuery(document).querySelectorAll("div");
|
|
266
|
+
let coll = umd_1.Stream.ofDomQuery(probe1).collect(new umd_1.ArrayCollector());
|
|
267
267
|
(0, chai_1.expect)(coll.length == 4).to.be.true;
|
|
268
|
-
coll =
|
|
268
|
+
coll = umd_1.LazyStream.ofDomQuery(probe1).collect(new umd_1.ArrayCollector());
|
|
269
269
|
(0, chai_1.expect)(coll.length == 4).to.be.true;
|
|
270
270
|
});
|
|
271
271
|
(0, mocha_1.it)('it must stream - DQ API (dynamically added)', function () {
|
|
272
|
-
let probe1 = new
|
|
272
|
+
let probe1 = new umd_1.DomQuery(document).querySelectorAll("div");
|
|
273
273
|
let coll = probe1.asArray;
|
|
274
274
|
(0, chai_1.expect)(coll.length == 4).to.be.true;
|
|
275
275
|
});
|
|
276
276
|
(0, mocha_1.it)('it must stream to a domquery', function () {
|
|
277
|
-
let probe1 = new
|
|
278
|
-
let coll =
|
|
277
|
+
let probe1 = new umd_1.DomQuery(document).querySelectorAll("div");
|
|
278
|
+
let coll = umd_1.Stream.ofDataSource(probe1).collect(new umd_1.DomQueryCollector());
|
|
279
279
|
(0, chai_1.expect)(coll.length == 4).to.be.true;
|
|
280
280
|
probe1.reset();
|
|
281
|
-
coll =
|
|
281
|
+
coll = umd_1.LazyStream.ofStreamDataSource(probe1).collect(new umd_1.DomQueryCollector());
|
|
282
282
|
(0, chai_1.expect)(coll.length == 4).to.be.true;
|
|
283
283
|
});
|
|
284
284
|
(0, mocha_1.it)('it must have parents', function () {
|
|
285
|
-
let probe1 = new
|
|
286
|
-
let coll =
|
|
285
|
+
let probe1 = new umd_1.DomQuery(document).querySelectorAll("div");
|
|
286
|
+
let coll = umd_1.Stream.ofDataSource(probe1.parentsWhileMatch("body")).collect(new umd_1.ArrayCollector());
|
|
287
287
|
(0, chai_1.expect)(coll.length == 1).to.be.true;
|
|
288
288
|
});
|
|
289
289
|
(0, mocha_1.it)("must have a working insertBefore and insertAfter", function () {
|
|
290
|
-
let probe1 = new
|
|
291
|
-
probe1.insertBefore(
|
|
292
|
-
probe1.insertAfter(
|
|
293
|
-
(0, chai_1.expect)(
|
|
294
|
-
|
|
295
|
-
(0, chai_1.expect)(
|
|
296
|
-
let innerHtml =
|
|
290
|
+
let probe1 = new umd_1.DomQuery(document).byId("id_2");
|
|
291
|
+
probe1.insertBefore(umd_1.DomQuery.fromMarkup(` <div id="id_x_0"></div><div id="id_x_1"></div>`));
|
|
292
|
+
probe1.insertAfter(umd_1.DomQuery.fromMarkup(` <div id="id_x_0_1"></div><div id="id_x_1_1"></div>`));
|
|
293
|
+
(0, chai_1.expect)(umd_1.DomQuery.querySelectorAll("div").length).to.eq(8);
|
|
294
|
+
umd_1.DomQuery.querySelectorAll("body").innerHTML = trim(umd_1.DomQuery.querySelectorAll("body").innerHTML.replace(/>\s*</gi, "><"));
|
|
295
|
+
(0, chai_1.expect)(umd_1.DomQuery.querySelectorAll("body").childNodes.length).to.eq(8);
|
|
296
|
+
let innerHtml = umd_1.DomQuery.querySelectorAll("body").innerHTML;
|
|
297
297
|
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") < innerHtml.indexOf("id_x_1")).to.be.true;
|
|
298
298
|
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") < innerHtml.indexOf("id_2")).to.be.true;
|
|
299
299
|
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > 0).to.be.true;
|
|
@@ -301,10 +301,10 @@ let dom = null;
|
|
|
301
301
|
(0, chai_1.expect)(innerHtml.indexOf("id_x_1_1") > innerHtml.indexOf("id_x_0_1")).to.be.true;
|
|
302
302
|
});
|
|
303
303
|
(0, mocha_1.it)("must have a working replace", function () {
|
|
304
|
-
let probe1 = new
|
|
305
|
-
probe1.replace(
|
|
306
|
-
(0, chai_1.expect)(
|
|
307
|
-
let innerHtml =
|
|
304
|
+
let probe1 = new umd_1.DomQuery(document).byId("id_1");
|
|
305
|
+
probe1.replace(umd_1.DomQuery.fromMarkup(` <div id="id_x_0"></div><div id="id_x_1"></div>`));
|
|
306
|
+
(0, chai_1.expect)(umd_1.DomQuery.querySelectorAll("div").length).to.eq(5);
|
|
307
|
+
let innerHtml = umd_1.DomQuery.querySelectorAll("body").innerHTML;
|
|
308
308
|
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > 0).to.be.true;
|
|
309
309
|
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") < innerHtml.indexOf("id_2")).to.be.true;
|
|
310
310
|
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") < innerHtml.indexOf("id_3")).to.be.true;
|
|
@@ -315,10 +315,10 @@ let dom = null;
|
|
|
315
315
|
(0, chai_1.expect)(innerHtml.indexOf("id_1") == -1).to.be.true;
|
|
316
316
|
});
|
|
317
317
|
(0, mocha_1.it)("must have a working replace - 2", function () {
|
|
318
|
-
let probe1 = new
|
|
319
|
-
probe1.replace(
|
|
320
|
-
(0, chai_1.expect)(
|
|
321
|
-
let innerHtml =
|
|
318
|
+
let probe1 = new umd_1.DomQuery(document).byId("id_2");
|
|
319
|
+
probe1.replace(umd_1.DomQuery.fromMarkup(` <div id="id_x_0"></div><div id="id_x_1"></div>`));
|
|
320
|
+
(0, chai_1.expect)(umd_1.DomQuery.querySelectorAll("div").length).to.eq(5);
|
|
321
|
+
let innerHtml = umd_1.DomQuery.querySelectorAll("body").innerHTML;
|
|
322
322
|
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > innerHtml.indexOf("id_1")).to.be.true;
|
|
323
323
|
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > 0).to.be.true;
|
|
324
324
|
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > innerHtml.indexOf("id_0")).to.be.true;
|
|
@@ -329,10 +329,10 @@ let dom = null;
|
|
|
329
329
|
(0, chai_1.expect)(innerHtml.indexOf("id_2") == -1).to.be.true;
|
|
330
330
|
});
|
|
331
331
|
(0, mocha_1.it)("must have a working replace - 3", function () {
|
|
332
|
-
let probe1 = new
|
|
333
|
-
probe1.replace(
|
|
334
|
-
(0, chai_1.expect)(
|
|
335
|
-
let innerHtml =
|
|
332
|
+
let probe1 = new umd_1.DomQuery(document).byId("id_4");
|
|
333
|
+
probe1.replace(umd_1.DomQuery.fromMarkup(` <div id="id_x_0"></div><div id="id_x_1"></div>`));
|
|
334
|
+
(0, chai_1.expect)(umd_1.DomQuery.querySelectorAll("div").length).to.eq(5);
|
|
335
|
+
let innerHtml = umd_1.DomQuery.querySelectorAll("body").innerHTML;
|
|
336
336
|
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > 0).to.be.true;
|
|
337
337
|
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > innerHtml.indexOf("id_1")).to.be.true;
|
|
338
338
|
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > innerHtml.indexOf("id_2")).to.be.true;
|
|
@@ -345,7 +345,7 @@ let dom = null;
|
|
|
345
345
|
(0, chai_1.expect)(innerHtml.indexOf("id_4") == -1).to.be.true;
|
|
346
346
|
});
|
|
347
347
|
(0, mocha_1.it)("must have a working input handling", function () {
|
|
348
|
-
|
|
348
|
+
umd_1.DomQuery.querySelectorAll("body").innerHTML = `<form id="blarg">
|
|
349
349
|
<div id="embed1">
|
|
350
350
|
<input type="text" id="id_1" name="id_1" value="id_1_val"></input>
|
|
351
351
|
<input type="text" id="id_2" name="id_2" value="id_2_val" disabled="disabled"> </input>
|
|
@@ -369,34 +369,34 @@ let dom = null;
|
|
|
369
369
|
</div>
|
|
370
370
|
</form>
|
|
371
371
|
`;
|
|
372
|
-
let length =
|
|
372
|
+
let length = umd_1.DomQuery.querySelectorAll("form").elements.length;
|
|
373
373
|
(0, chai_1.expect)(length == 8).to.be.true;
|
|
374
|
-
let length1 =
|
|
374
|
+
let length1 = umd_1.DomQuery.querySelectorAll("body").elements.length;
|
|
375
375
|
(0, chai_1.expect)(length1 == 8).to.be.true;
|
|
376
|
-
let length2 =
|
|
376
|
+
let length2 = umd_1.DomQuery.byId("embed1").elements.length;
|
|
377
377
|
(0, chai_1.expect)(length2 == 8).to.be.true;
|
|
378
|
-
let count =
|
|
378
|
+
let count = umd_1.Stream.ofDataSource(umd_1.DomQuery.byId("embed1").elements)
|
|
379
379
|
.map(item => item.disabled ? 1 : 0)
|
|
380
380
|
.reduce((val1, val2) => val1 + val2, 0);
|
|
381
381
|
(0, chai_1.expect)(count.value).to.eq(1);
|
|
382
|
-
|
|
382
|
+
umd_1.Stream.ofDataSource(umd_1.DomQuery.byId("embed1").elements)
|
|
383
383
|
.filter(item => item.disabled)
|
|
384
384
|
.each(item => item.disabled = false);
|
|
385
|
-
count =
|
|
385
|
+
count = umd_1.Stream.ofDataSource(umd_1.DomQuery.byId("embed1").elements)
|
|
386
386
|
.map(item => item.disabled ? 1 : 0)
|
|
387
387
|
.reduce((val1, val2) => val1 + val2, 0);
|
|
388
388
|
(0, chai_1.expect)(count.value).to.eq(0);
|
|
389
|
-
count =
|
|
389
|
+
count = umd_1.Stream.ofDataSource(umd_1.DomQuery.byId("embed1").elements)
|
|
390
390
|
.map(item => item.attr("checked").isPresent() ? 1 : 0)
|
|
391
391
|
.reduce((val1, val2) => val1 + val2, 0);
|
|
392
392
|
(0, chai_1.expect)(count.value).to.eq(1);
|
|
393
|
-
(0, chai_1.expect)(
|
|
394
|
-
|
|
395
|
-
(0, chai_1.expect)(
|
|
396
|
-
(0, chai_1.expect)(
|
|
397
|
-
|
|
398
|
-
(0, chai_1.expect)(
|
|
399
|
-
let cfg = new
|
|
393
|
+
(0, chai_1.expect)(umd_1.DomQuery.byId("id_1").inputValue.value == "id_1_val").to.be.true;
|
|
394
|
+
umd_1.DomQuery.byId("id_1").inputValue.value = "booga";
|
|
395
|
+
(0, chai_1.expect)(umd_1.DomQuery.byId("id_1").inputValue.value == "booga").to.be.true;
|
|
396
|
+
(0, chai_1.expect)(umd_1.DomQuery.byId("id_3").inputValue.value).to.eq("textareaVal");
|
|
397
|
+
umd_1.DomQuery.byId("id_3").inputValue.value = "hello world";
|
|
398
|
+
(0, chai_1.expect)(umd_1.DomQuery.byId("id_3").inputValue.value).to.eq("hello world");
|
|
399
|
+
let cfg = new umd_1.Config(umd_1.DomQuery.querySelectorAll("form").elements.encodeFormElement());
|
|
400
400
|
(0, chai_1.expect)(cfg.getIf("id_1").value[0]).to.eq("booga");
|
|
401
401
|
(0, chai_1.expect)(cfg.getIf("id_2").value[0]).to.eq("id_2_val");
|
|
402
402
|
(0, chai_1.expect)(cfg.getIf("id_3").value[0]).to.eq("hello world");
|
|
@@ -404,17 +404,17 @@ let dom = null;
|
|
|
404
404
|
(0, chai_1.expect)(cfg.getIf("val_5").value[0]).to.eq("akaka");
|
|
405
405
|
});
|
|
406
406
|
(0, mocha_1.it)("must have a proper loadScriptEval execution", function (done) {
|
|
407
|
-
|
|
407
|
+
umd_1.DomQuery.byTagName("body").loadScriptEval("./fixtures/test.js");
|
|
408
408
|
setTimeout(() => {
|
|
409
|
-
(0, chai_1.expect)(
|
|
409
|
+
(0, chai_1.expect)(umd_1.DomQuery.byId("id_1").innerHTML == "hello world").to.be.true;
|
|
410
410
|
done();
|
|
411
411
|
}, 100);
|
|
412
412
|
});
|
|
413
413
|
(0, mocha_1.it)("must have first etc working", function () {
|
|
414
|
-
(0, chai_1.expect)(
|
|
414
|
+
(0, chai_1.expect)(umd_1.DomQuery.querySelectorAll("div").first().id.value).to.eq("id_1");
|
|
415
415
|
});
|
|
416
416
|
(0, mocha_1.it)("runscript runcss", function (done) {
|
|
417
|
-
|
|
417
|
+
umd_1.DomQuery.byTagName("body").innerHTML = `
|
|
418
418
|
<div id="first"></div>
|
|
419
419
|
<div id="second"></div>
|
|
420
420
|
<div id="third"></div>
|
|
@@ -447,23 +447,23 @@ let dom = null;
|
|
|
447
447
|
|
|
448
448
|
<link rel="stylesheet" href="./fixtures/blank.css"></link>
|
|
449
449
|
`;
|
|
450
|
-
let content =
|
|
450
|
+
let content = umd_1.DomQuery.byTagName("body").runScripts().runCss();
|
|
451
451
|
(0, chai_1.expect)(content.byId("first").innerHTML).to.eq("hello world");
|
|
452
452
|
(0, chai_1.expect)(content.byId("second").innerHTML).to.eq("hello world");
|
|
453
453
|
(0, chai_1.expect)(content.byId("third").innerHTML).to.eq("hello world");
|
|
454
454
|
(0, chai_1.expect)(content.byId("fourth").innerHTML).to.eq("hello world");
|
|
455
|
-
(0, chai_1.expect)(
|
|
455
|
+
(0, chai_1.expect)(umd_1.DomQuery.byTagName("head")
|
|
456
456
|
.querySelectorAll("link[rel='stylesheet'][href='./fixtures/blank.css']").length).to.eq(1);
|
|
457
457
|
done();
|
|
458
458
|
});
|
|
459
459
|
//TODO defer does not work in jsdom
|
|
460
460
|
(0, mocha_1.it)("must have a proper loadScriptEval deferred", function (done) {
|
|
461
|
-
|
|
461
|
+
umd_1.DomQuery.byId(document.body).loadScriptEval("./fixtures/test2.js", 200);
|
|
462
462
|
setTimeout(() => {
|
|
463
|
-
(0, chai_1.expect)(
|
|
463
|
+
(0, chai_1.expect)(umd_1.DomQuery.byId("id_1").innerHTML == "hello world").to.be.false;
|
|
464
464
|
}, 100);
|
|
465
465
|
setTimeout(() => {
|
|
466
|
-
(0, chai_1.expect)(
|
|
466
|
+
(0, chai_1.expect)(umd_1.DomQuery.byId("id_1").innerHTML == "hello world").to.be.true;
|
|
467
467
|
done();
|
|
468
468
|
}, 1500);
|
|
469
469
|
});
|
|
@@ -472,7 +472,7 @@ let dom = null;
|
|
|
472
472
|
let listener = (evt) => {
|
|
473
473
|
clicked++;
|
|
474
474
|
};
|
|
475
|
-
let eventReceiver =
|
|
475
|
+
let eventReceiver = umd_1.DomQuery.byId("id_1");
|
|
476
476
|
eventReceiver.addEventListener("click", listener);
|
|
477
477
|
eventReceiver.click();
|
|
478
478
|
(0, chai_1.expect)(clicked).to.eq(1);
|
|
@@ -487,19 +487,19 @@ let dom = null;
|
|
|
487
487
|
return this.textContent;
|
|
488
488
|
},
|
|
489
489
|
});
|
|
490
|
-
let probe =
|
|
490
|
+
let probe = umd_1.DomQuery.byId("id_1");
|
|
491
491
|
probe.innerHTML = "<div>hello</div><div>world</div>";
|
|
492
492
|
(0, chai_1.expect)(probe.innerText()).to.eq("helloworld");
|
|
493
493
|
done();
|
|
494
494
|
});
|
|
495
495
|
(0, mocha_1.it)("it must handle textContent properly", function () {
|
|
496
|
-
let probe =
|
|
496
|
+
let probe = umd_1.DomQuery.byId("id_1");
|
|
497
497
|
probe.innerHTML = "<div>hello</div><div>world</div>";
|
|
498
498
|
(0, chai_1.expect)(probe.textContent()).to.eq("helloworld");
|
|
499
499
|
});
|
|
500
500
|
(0, mocha_1.it)("it must handle iterations properly", function () {
|
|
501
|
-
let probe =
|
|
502
|
-
let resArr =
|
|
501
|
+
let probe = umd_1.DomQuery.byTagName("div");
|
|
502
|
+
let resArr = umd_1.LazyStream.ofStreamDataSource(probe).collect(new umd_1.ArrayCollector());
|
|
503
503
|
(0, chai_1.expect)(resArr.length).to.eq(4);
|
|
504
504
|
probe.reset();
|
|
505
505
|
while (probe.hasNext()) {
|
|
@@ -507,20 +507,20 @@ let dom = null;
|
|
|
507
507
|
(0, chai_1.expect)(el.tagName.value.toLowerCase()).to.eq("div");
|
|
508
508
|
}
|
|
509
509
|
(0, chai_1.expect)(probe.next()).to.eq(null);
|
|
510
|
-
let probe2 =
|
|
511
|
-
resArr =
|
|
510
|
+
let probe2 = umd_1.DomQuery.byTagName("div").limits(2);
|
|
511
|
+
resArr = umd_1.LazyStream.ofStreamDataSource(probe2).collect(new umd_1.ArrayCollector());
|
|
512
512
|
(0, chai_1.expect)(resArr.length).to.eq(2);
|
|
513
513
|
});
|
|
514
514
|
(0, mocha_1.it)("it must handle subnodes properly", function () {
|
|
515
|
-
let probe =
|
|
515
|
+
let probe = umd_1.DomQuery.byTagName("div");
|
|
516
516
|
(0, chai_1.expect)(probe.subNodes(1, 3).length).to.eq(2);
|
|
517
|
-
probe =
|
|
517
|
+
probe = umd_1.DomQuery.byTagName("body").childNodes.subNodes(0, 2);
|
|
518
518
|
(0, chai_1.expect)(probe.length).to.eq(2);
|
|
519
|
-
probe =
|
|
519
|
+
probe = umd_1.DomQuery.byTagName("div").subNodes(2);
|
|
520
520
|
(0, chai_1.expect)(probe.length).to.eq(2);
|
|
521
521
|
});
|
|
522
522
|
(0, mocha_1.it)("it must ensure shadow dom creation works properly", function () {
|
|
523
|
-
let probe =
|
|
523
|
+
let probe = umd_1.DomQuery.byTagName("div");
|
|
524
524
|
try {
|
|
525
525
|
//probably not testable atm, mocha does not have shadow dom support
|
|
526
526
|
//we might be able to shim it in one way or the other
|
|
@@ -533,11 +533,11 @@ let dom = null;
|
|
|
533
533
|
}
|
|
534
534
|
});
|
|
535
535
|
(0, mocha_1.it)("parent must break shadow barriers", function () {
|
|
536
|
-
let probe =
|
|
536
|
+
let probe = umd_1.DomQuery.fromMarkup("<div id='shadowItem'>hello</div>'");
|
|
537
537
|
try {
|
|
538
538
|
//probably not testable atm, mocha does not have shadow dom support
|
|
539
539
|
//we might be able to shim it in one way or the other
|
|
540
|
-
let element =
|
|
540
|
+
let element = umd_1.DomQuery.byId("id_1").attachShadow();
|
|
541
541
|
element.append(probe);
|
|
542
542
|
(0, chai_1.expect)(probe.firstParent("#id_1").length > 0).to.eq(true);
|
|
543
543
|
}
|
|
@@ -548,18 +548,18 @@ let dom = null;
|
|
|
548
548
|
});
|
|
549
549
|
(0, mocha_1.it)('it must have a working wait for dom with mut observer and must detect condition after change', function () {
|
|
550
550
|
return __awaiter(this, void 0, void 0, function* () {
|
|
551
|
-
let probe =
|
|
551
|
+
let probe = umd_1.DomQuery.byId('id_1');
|
|
552
552
|
probe.innerHTML = 'true';
|
|
553
553
|
let ret = yield probe.waitUntilDom((element) => element.innerHTML.indexOf('true') != -1);
|
|
554
554
|
(0, chai_1.expect)(ret.isPresent());
|
|
555
|
-
probe =
|
|
555
|
+
probe = umd_1.DomQuery.byId('bosushsdhs');
|
|
556
556
|
ret = yield probe.waitUntilDom((element) => element.isAbsent());
|
|
557
557
|
(0, chai_1.expect)(ret.isAbsent());
|
|
558
558
|
});
|
|
559
559
|
});
|
|
560
560
|
(0, mocha_1.it)('it must have a working wait for dom with mut observer', function () {
|
|
561
561
|
return __awaiter(this, void 0, void 0, function* () {
|
|
562
|
-
let probe =
|
|
562
|
+
let probe = umd_1.DomQuery.byId('id_1');
|
|
563
563
|
setTimeout(() => probe.innerHTML = 'true', 300);
|
|
564
564
|
let ret = yield probe.waitUntilDom((element) => element.innerHTML.indexOf('true') != -1);
|
|
565
565
|
delete window.MutationObserver;
|
|
@@ -572,7 +572,7 @@ let dom = null;
|
|
|
572
572
|
});
|
|
573
573
|
(0, mocha_1.it)('it must have a timeout', function () {
|
|
574
574
|
return __awaiter(this, void 0, void 0, function* () {
|
|
575
|
-
let probe =
|
|
575
|
+
let probe = umd_1.DomQuery.byId('booga');
|
|
576
576
|
try {
|
|
577
577
|
setTimeout(() => probe.innerHTML = 'true', 300);
|
|
578
578
|
yield probe.waitUntilDom((element) => element.innerHTML.indexOf('true') != -1);
|
|
@@ -595,59 +595,59 @@ let dom = null;
|
|
|
595
595
|
});
|
|
596
596
|
});
|
|
597
597
|
(0, mocha_1.it)('must handle null inputs correctly', function () {
|
|
598
|
-
const dq = new
|
|
598
|
+
const dq = new umd_1.DomQuery(null);
|
|
599
599
|
(0, chai_1.expect)(dq.isAbsent()).to.eq(true);
|
|
600
600
|
});
|
|
601
601
|
(0, mocha_1.it)('concat must work as expected resulting', function () {
|
|
602
|
-
let probe =
|
|
603
|
-
let probe2 =
|
|
602
|
+
let probe = umd_1.DomQuery.querySelectorAll("div");
|
|
603
|
+
let probe2 = umd_1.DomQuery.querySelectorAll("body");
|
|
604
604
|
let result = probe.concat(probe2);
|
|
605
605
|
(0, chai_1.expect)(result.length).to.eq(probe.length + probe2.length);
|
|
606
606
|
//lets now check for filter double
|
|
607
|
-
probe2 =
|
|
607
|
+
probe2 = umd_1.DomQuery.querySelectorAll('div');
|
|
608
608
|
result = probe.concat(probe2);
|
|
609
609
|
(0, chai_1.expect)(result.length).to.eq(probe.length);
|
|
610
610
|
});
|
|
611
611
|
(0, mocha_1.it)('must handle match correctly', function () {
|
|
612
|
-
let probe =
|
|
613
|
-
let probe2 =
|
|
612
|
+
let probe = umd_1.DomQuery.querySelectorAll("div").first();
|
|
613
|
+
let probe2 = umd_1.DomQuery.querySelectorAll("body").first();
|
|
614
614
|
(0, chai_1.expect)(probe.matchesSelector("div")).to.eq(true);
|
|
615
615
|
(0, chai_1.expect)(probe2.matchesSelector("body")).to.eq(true);
|
|
616
616
|
(0, chai_1.expect)(probe2.matchesSelector("div")).to.eq(false);
|
|
617
617
|
});
|
|
618
618
|
(0, mocha_1.it)('must by recycleable', function () {
|
|
619
|
-
let probe =
|
|
620
|
-
let probe2 =
|
|
619
|
+
let probe = umd_1.DomQuery.querySelectorAll("div");
|
|
620
|
+
let probe2 = umd_1.DomQuery.querySelectorAll("body");
|
|
621
621
|
let res1 = probe.filter(item => item.matchesSelector("div"));
|
|
622
622
|
(0, chai_1.expect)(res1.length).to.eq(4);
|
|
623
623
|
let res2 = probe.filter(item => item.matchesSelector("div"));
|
|
624
624
|
(0, chai_1.expect)(res2.length).to.eq(4);
|
|
625
625
|
});
|
|
626
626
|
(0, mocha_1.it)('delete must work', function () {
|
|
627
|
-
let probe =
|
|
628
|
-
let probe2 =
|
|
627
|
+
let probe = umd_1.DomQuery.querySelectorAll("body");
|
|
628
|
+
let probe2 = umd_1.DomQuery.fromMarkup("<div id='deleteprobe1'>snafu</div>");
|
|
629
629
|
probe2.appendTo(probe);
|
|
630
630
|
(0, chai_1.expect)(probe.querySelectorAll("#deleteprobe1").isPresent()).to.eq(true);
|
|
631
631
|
probe2.delete();
|
|
632
632
|
(0, chai_1.expect)(probe.querySelectorAll("#deleteprobe1").isAbsent()).to.eq(true);
|
|
633
633
|
});
|
|
634
634
|
(0, mocha_1.it)('must work with rxjs and domquery', function () {
|
|
635
|
-
let probe =
|
|
636
|
-
let probe2 =
|
|
635
|
+
let probe = umd_1.DomQuery.querySelectorAll("div");
|
|
636
|
+
let probe2 = umd_1.DomQuery.querySelectorAll("div");
|
|
637
637
|
let probeCnt = 0;
|
|
638
638
|
let probe2Cnt = 0;
|
|
639
639
|
(0, rxjs_1.from)(probe).subscribe(el => probeCnt++);
|
|
640
|
-
(0, rxjs_1.from)(
|
|
640
|
+
(0, rxjs_1.from)(umd_1.Stream.ofDataSource(probe2)).subscribe(el => probe2Cnt++);
|
|
641
641
|
(0, chai_1.expect)(probeCnt).to.be.above(0);
|
|
642
642
|
(0, chai_1.expect)(probeCnt).to.eq(probe2Cnt);
|
|
643
643
|
});
|
|
644
644
|
(0, mocha_1.it)('must handle closest properly', function () {
|
|
645
|
-
let probe =
|
|
645
|
+
let probe = umd_1.DomQuery.byId("id_1");
|
|
646
646
|
probe.innerHTML = "<div id='inner_elem'>hello world<div id='inner_elem2'></div></div>";
|
|
647
|
-
let probe2 =
|
|
647
|
+
let probe2 = umd_1.DomQuery.byId("inner_elem");
|
|
648
648
|
(0, chai_1.expect)(probe2.closest("div#id_1").id.value).to.eq("id_1");
|
|
649
649
|
(0, chai_1.expect)(probe2.parent().closest("div").id.value).to.eq("id_1");
|
|
650
|
-
probe2 =
|
|
650
|
+
probe2 = umd_1.DomQuery.byId("inner_elem2");
|
|
651
651
|
(0, chai_1.expect)(probe2.closest("div").id.value).to.eq("inner_elem2");
|
|
652
652
|
(0, chai_1.expect)(probe2.closest("div#id_1").id.value).to.eq("id_1");
|
|
653
653
|
(0, chai_1.expect)(probe2.parent().parent().closest("div").id.value).to.eq("id_1");
|