This commit is contained in:
2021-11-22 19:06:53 +03:00
parent cafa01c3a5
commit 5bd7b5ffb7
3 changed files with 58 additions and 49 deletions
+48 -29
View File
@@ -4,7 +4,7 @@
<div style="display: flex; flex-direction: column; align-items: center;">
<script>
var iframeList = [], iframe, i;
var iframeList = [], iframe;
</script>
<?php
$arFilesItems = glob(__DIR__ . '/*Test.php');
@@ -14,32 +14,21 @@
//echo "<a href=\"$file\"><b>$clName</b></a>";
?>
<script>
iframe = document.createElement("frame");
iframe.src = '<?=$file?>';
i = iframeList.push({
iframeList.push({
fileName: '<?=$file?>',
clName: '<?=$clName?>',
iframe: iframe,
// contentWindow: iframe.contentWindow,
//document: iframe.contentWindow.document
});
// if (iframeDoc.readyState == 'complete') {
// iframeDoc.body.style.backgroundColor = 'green';
// }
// iframe.onload = function() {
// var iframeDoc2 = iframe.contentWindow.document;
// iframeDoc2.body.style.backgroundColor = 'orange';
// }
</script>
<?
}
?>
</div>
<div class="kit-wrapper">
<div class="kit-logger"></div>
</div>
<script>
kit.ready(['Collection', 'flexKit', 'loggerService'], function () {
@@ -56,29 +45,59 @@
console.log(frameList);
frameList.map(function (data) {
data.iframe.onload = function() {
data.kit = data.iframe.contentWindow.kit;
//console.log('kit',kit);
data.window = data.iframe.contentWindow;
data.document = data.iframe.contentWindow.document;
data.kit = data.window.kit;
if(!data.kit) {
return;
}
data.kit.ready([], function () {
setTimeout(function () {
var log = [];
var log = [], result = {};
if(!data.kit.service.logger){
return;
}
function pr(key, log){
if(!result[key]) {
result[key] = new kit.Collection();
}
if(log.message[key]){
result[key].push(log);
}
}
data.kit.service.logger.collection.map(function (log) {
pr('pass', log);
pr('warn', log);
pr('fail', log);
});
kit.service.logger.info(data.clName);
if(data.kit.service.logger){
log = data.kit.service.logger.collection.map(function (log) {
if(result.pass.count()){
kit.service.logger.log(1, {
pass: result.pass.count(),
});
}
if(result.warn.count()) {
kit.service.logger.log(1, {
warn: result.warn.count(),
});
result.warn.map(function (log) {
log.lvl++;
kit.service.logger.log(log);
});
}
if(result.fail.count()) {
kit.service.logger.log(1, {
fail: result.fail.count(),
});
result.fail.map(function (log) {
log.lvl++;
kit.service.logger.__log(log);
});
}
}, 1000);
});
};
document.body.appendChild(data.iframe);
data.window = data.iframe.contentWindow;
data.document = data.iframe.contentWindow.document;
data.kit = data.window.kit;
})
});
</script>
<div class="kit-wrapper">
<div class="kit-logger"></div>
</div>
</script>
+7 -17
View File
@@ -26,29 +26,21 @@ kit.ready(['collection', 'testing', 'flexKit'], function () {
var unit = new kit.testing.Unit();
unit.logger.info('Коллекции by php collection: Array ( [10] => 10 [1] => 1 )');
unit.logger.notice(' ');
unit.logger.info('ARRAY');
unit.logger.notice(' ');
var assertSame = unit.assertSame.bind(unit);
var arr = [];
arr[10] = 100;
var collection = new kit.Collection(arr);
assertSame(1, collection.count(), 'Количество');
assertSame(true, collection.has(10), 'has (int) 10');
assertSame(true, collection.has('10'), 'has 10');
assertSame(false, collection.has('5'), 'has 5');
assertSame(2, collection.get(3, 2), 'get');
assertSame(100, collection.get(10, 2), 'get');
assertSame(undefined, collection.get(11), 'get');
assertSame(1, collection.count(), 'type array: Количество');
assertSame(true, collection.has(10), 'type array: has (int) 10');
assertSame(true, collection.has('10'), 'type array: has 10');
assertSame(false, collection.has('5'), 'type array: has 5');
assertSame(2, collection.get(3, 2), 'type array: get');
assertSame(100, collection.get(10, 2), 'type array: get');
assertSame(undefined, collection.get(11), 'type array: get');
unit.logger.info(' ');
unit.logger.info('Object');
unit.logger.info(' ');
var ob = {
a: 1,
b: 2,
@@ -232,8 +224,6 @@ kit.ready(['collection', 'testing', 'flexKit'], function () {
y = x.pluck('age');
assertSame('20-19-18', y.toArray().join('-'), 'pluck с проверкой сохранения порядка');
assertSame('10', 20, 'Спец ошибка');
});
</script>