mirror of
https://bitbucket.org/bellord13/kit.git
synced 2026-11-13 19:06:11 +03:00
fix
This commit is contained in:
+47
-25
@@ -30,8 +30,9 @@
|
||||
<div class="kit-logger"></div>
|
||||
</div>
|
||||
<script>
|
||||
kit.ready(['Collection', 'flexKit', 'loggerService'], function () {
|
||||
kit.ready(['Collection', 'flexKit', 'loggerService', 'support'], function () {
|
||||
|
||||
var support = kit.support;
|
||||
window.frameList = new kit.Collection(iframeList);
|
||||
|
||||
frameList.map(function (frameData) {
|
||||
@@ -39,9 +40,11 @@
|
||||
});
|
||||
|
||||
kit.service.logger.notice(' ');
|
||||
kit.service.logger.warning('FRAME LIST ...');
|
||||
kit.service.logger.warning('FRAME LIST <span id="total-unit-testing-counter">...<span>');
|
||||
kit.service.logger.notice(' ');
|
||||
|
||||
var totalCountTest = 0;
|
||||
var totalCountTestNode = document.getElementById('total-unit-testing-counter');
|
||||
//console.log(frameList);
|
||||
frameList.map(function (data) {
|
||||
data.iframe.onload = function() {
|
||||
@@ -54,45 +57,64 @@
|
||||
data.kit.ready([], function () {
|
||||
setTimeout(function () {
|
||||
var result = {};
|
||||
var countTest = 0;
|
||||
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);
|
||||
}
|
||||
|
||||
function pushResult(log){
|
||||
var acceptKeys = new kit.Collection(['fail', 'warn', 'pass']);
|
||||
acceptKeys.each(function (key) {
|
||||
if(!result.hasOwnProperty(key)) {
|
||||
result[key] = new kit.Collection();
|
||||
}
|
||||
if(!support.isObject(log.message)) {
|
||||
return;
|
||||
}
|
||||
if(log.message.hasOwnProperty(key)) {
|
||||
result[key].push(log);
|
||||
countTest++;
|
||||
totalCountTest++;
|
||||
if(totalCountTestNode) {
|
||||
totalCountTestNode.innerHTML = totalCountTest.toString();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
data.kit.service.logger.collection.map(function (log) {
|
||||
pr('pass', log);
|
||||
pr('warn', log);
|
||||
pr('fail', log);
|
||||
pushResult(log);
|
||||
});
|
||||
|
||||
|
||||
kit.service.logger.info(data.clName);
|
||||
|
||||
if(result.pass.count()){
|
||||
kit.service.logger.log(1, {
|
||||
kit.service.logger.success({
|
||||
pass: result.pass.count(),
|
||||
});
|
||||
}
|
||||
if(result.warn.count()) {
|
||||
kit.service.logger.log(1, {
|
||||
kit.service.logger.warning({
|
||||
warn: result.warn.count(),
|
||||
});
|
||||
result.warn.map(function (log) {
|
||||
log.lvl++;
|
||||
kit.service.logger.log(log);
|
||||
});
|
||||
}, result.warn.map(function (log) {
|
||||
return {
|
||||
expected: log.context.expected,
|
||||
actual: log.context.actual,
|
||||
message: log.message.warn,
|
||||
};
|
||||
}).toObject());
|
||||
}
|
||||
if(result.fail.count()) {
|
||||
kit.service.logger.log(1, {
|
||||
kit.service.logger.error({
|
||||
fail: result.fail.count(),
|
||||
});
|
||||
result.fail.map(function (log) {
|
||||
log.lvl++;
|
||||
kit.service.logger.__log(log);
|
||||
});
|
||||
}, result.fail.map(function (log) {
|
||||
return {
|
||||
expected: log.context.expected,
|
||||
actual: log.context.actual,
|
||||
message: log.message.fail,
|
||||
};
|
||||
}).toObject());
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user