first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,58 @@
/* Reset base Console skin styles */
.yui3-skin-sam .yui3-testconsole .yui3-console-content,
.yui3-skin-sam .yui3-testconsole .yui3-console-bd,
.yui3-skin-sam .yui3-testconsole .yui3-console-entry,
.yui3-skin-sam .yui3-testconsole .yui3-console-ft,
.yui3-skin-sam .yui3-testconsole .yui3-console-ft .yui3-console-filters-categories,
.yui3-skin-sam .yui3-testconsole .yui3-console-ft .yui3-console-filters-sources,
.yui3-skin-sam .yui3-testconsole .yui3-console-hd {
background: none;
border: none;
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
}
.yui3-skin-sam .yui3-testconsole-content,
.yui3-skin-sam .yui3-testconsole .yui3-console-bd {
color: #333;
font: 13px/1.4 Helvetica, 'DejaVu Sans', 'Bitstream Vera Sans', Arial, sans-serif;
}
.yui3-skin-sam .yui3-testconsole-content {
border: 1px solid #afafaf;
}
.yui3-skin-sam .yui3-testconsole .yui3-console-entry {
border-bottom: 1px solid #eaeaea;
font-family: Menlo, Inconsolata, Consolas, 'DejaVu Mono', 'Bitstream Vera Sans Mono', monospace;
font-size: 11px;
}
.yui3-skin-sam .yui3-testconsole .yui3-console-ft {
border-top: 1px solid;
}
.yui3-skin-sam .yui3-testconsole .yui3-console-hd {
border-bottom: 1px solid;
*zoom: 1;
}
.yui3-skin-sam .yui3-testconsole.yui3-console-collapsed .yui3-console-hd {
border: none;
}
.yui3-skin-sam .yui3-testconsole .yui3-console-ft,
.yui3-skin-sam .yui3-testconsole .yui3-console-hd {
border-color: #cfcfcf;
}
.yui3-skin-sam .yui3-testconsole .yui3-testconsole-entry-fail {
background-color: #FFE0E0;
border-bottom-color: #FFC5C4;
}
.yui3-skin-sam .yui3-testconsole .yui3-testconsole-entry-pass {
background-color: #ECFFEA;
border-bottom-color: #D1FFCC;
}
@@ -0,0 +1 @@
.yui3-testconsole .yui3-console-entry{min-height:inherit;padding:5px}.yui3-testconsole .yui3-console-controls{display:none}.yui3-skin-sam .yui3-testconsole .yui3-console-content,.yui3-skin-sam .yui3-testconsole .yui3-console-bd,.yui3-skin-sam .yui3-testconsole .yui3-console-entry,.yui3-skin-sam .yui3-testconsole .yui3-console-ft,.yui3-skin-sam .yui3-testconsole .yui3-console-ft .yui3-console-filters-categories,.yui3-skin-sam .yui3-testconsole .yui3-console-ft .yui3-console-filters-sources,.yui3-skin-sam .yui3-testconsole .yui3-console-hd{background:0;border:0;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.yui3-skin-sam .yui3-testconsole-content,.yui3-skin-sam .yui3-testconsole .yui3-console-bd{color:#333;font:13px/1.4 Helvetica,'DejaVu Sans','Bitstream Vera Sans',Arial,sans-serif}.yui3-skin-sam .yui3-testconsole-content{border:1px solid #afafaf}.yui3-skin-sam .yui3-testconsole .yui3-console-entry{border-bottom:1px solid #eaeaea;font-family:Menlo,Inconsolata,Consolas,'DejaVu Mono','Bitstream Vera Sans Mono',monospace;font-size:11px}.yui3-skin-sam .yui3-testconsole .yui3-console-ft{border-top:1px solid}.yui3-skin-sam .yui3-testconsole .yui3-console-hd{border-bottom:1px solid;*zoom:1}.yui3-skin-sam .yui3-testconsole.yui3-console-collapsed .yui3-console-hd{border:0}.yui3-skin-sam .yui3-testconsole .yui3-console-ft,.yui3-skin-sam .yui3-testconsole .yui3-console-hd{border-color:#cfcfcf}.yui3-skin-sam .yui3-testconsole .yui3-testconsole-entry-fail{background-color:#ffe0e0;border-bottom-color:#ffc5c4}.yui3-skin-sam .yui3-testconsole .yui3-testconsole-entry-pass{background-color:#ecffea;border-bottom-color:#d1ffcc}#yui3-css-stamp.skin-sam-test-console{display:none}
@@ -0,0 +1,8 @@
.yui3-testconsole .yui3-console-entry {
min-height: inherit;
padding: 5px;
}
.yui3-testconsole .yui3-console-controls {
display: none;
}
@@ -0,0 +1,307 @@
YUI.add('test-console', function (Y, NAME) {
/**
Provides a specialized log console widget that's pre-configured to display YUI
Test output with no extra configuration.
@example
<div id="log" class="yui3-skin-sam"></div>
<script>
YUI().use('test-console', function (Y) {
// ... set up your test cases here ...
// Render the console inside the #log div, then run the tests.
new Y.Test.Console().render('#log');
Y.Test.Runner.run();
});
</script>
@module test-console
@namespace Test
@class Console
@extends Console
@constructor
@param {Object} [config] Config attributes.
@param {Object} [config.filters] Category filter configuration.
@since 3.5.0
**/
function TestConsole() {
TestConsole.superclass.constructor.apply(this, arguments);
}
Y.namespace('Test').Console = Y.extend(TestConsole, Y.Console, {
initializer: function (config) {
this.on('entry', this._onEntry);
this.plug(Y.Plugin.ConsoleFilters, {
category: Y.merge({
info : true,
pass : false,
fail : true,
status: false
}, (config && config.filters) || {}),
defaultVisibility: false,
source: {
TestRunner: true
}
});
Y.Test.Runner.on('complete', Y.bind(this._parseCoverage, this));
},
// -- Protected Coverage Parser ---------------------------------------------
/**
* Scans the coverage data to determine if it's an Istanbul coverage object.
* @method _isIstanbul
* @param {Object} json The coverage data to scan
* @return {Boolean} True if this is Istanbul Coverage
*/
_isIstanbul: function(json) {
var first = Y.Object.keys(json)[0],
ret = false;
if (json[first].s !== undefined && json[first].fnMap !== undefined) {
ret = true;
}
if (json.s !== undefined && json.fnMap !== undefined) {
ret = true;
}
return ret;
},
/**
* Parses and logs a summary of YUITest coverage data.
* @method parseYUITest
* @param {Object} coverage The YUITest Coverage JSON data
*/
parseYUITestCoverage: function (coverage) {
var cov = {
lines: {
hit: 0,
miss: 0,
total: 0,
percent: 0
},
functions: {
hit: 0,
miss: 0,
total: 0,
percent: 0
}
}, coverageLog;
Y.Object.each(coverage, function(info) {
cov.lines.total += info.coveredLines;
cov.lines.hit += info.calledLines;
cov.lines.miss += (info.coveredLines - info.calledLines);
cov.lines.percent = Math.floor((cov.lines.hit / cov.lines.total) * 100);
cov.functions.total += info.coveredFunctions;
cov.functions.hit += info.calledFunctions;
cov.functions.miss += (info.coveredFunctions - info.calledFunctions);
cov.functions.percent = Math.floor((cov.functions.hit / cov.functions.total) * 100);
});
coverageLog = 'Lines: Hit:' + cov.lines.hit + ' Missed:' + cov.lines.miss + ' Total:' + cov.lines.total + ' Percent:' + cov.lines.percent + '%\n';
coverageLog += 'Functions: Hit:' + cov.functions.hit + ' Missed:' + cov.functions.miss + ' Total:' + cov.functions.total + ' Percent:' + cov.functions.percent + '%';
this.log('Coverage: ' + coverageLog, 'info', 'TestRunner');
},
/**
* Generates a generic summary object used for Istanbul conversions.
* @method _blankSummary
* @return {Object} Generic summary object
*/
_blankSummary: function () {
return {
lines: {
total: 0,
covered: 0,
pct: 'Unknown'
},
statements: {
total: 0,
covered: 0,
pct: 'Unknown'
},
functions: {
total: 0,
covered: 0,
pct: 'Unknown'
},
branches: {
total: 0,
covered: 0,
pct: 'Unknown'
}
};
},
/**
* Calculates line numbers from statement coverage
* @method _addDerivedInfoForFile
* @private
* @param {Object} fileCoverage JSON coverage data
*/
_addDerivedInfoForFile: function (fileCoverage) {
var statementMap = fileCoverage.statementMap,
statements = fileCoverage.s,
lineMap;
if (!fileCoverage.l) {
fileCoverage.l = lineMap = {};
Y.Object.each(statements, function (value, st) {
var line = statementMap[st].start.line,
count = statements[st],
prevVal = lineMap[line];
if (typeof prevVal === 'undefined' || prevVal < count) {
lineMap[line] = count;
}
});
}
},
/**
* Generic percent calculator
* @method _percent
* @param {Number} covered The covered amount
* @param {Number} total The total
* @private
*/
_percent: function (covered, total) {
var tmp, pct = 100.00;
if (total > 0) {
tmp = 1000 * 100 * covered / total + 5;
pct = Math.floor(tmp / 10) / 100;
}
return pct;
},
/**
* Summarize simple properties in the coverage data
* @method _computSimpleTotals
* @private
* @param {Object} fileCoverage JSON coverage data
* @param {String} property The property to summarize
*/
_computeSimpleTotals: function (fileCoverage, property) {
var stats = fileCoverage[property],
ret = { total: 0, covered: 0 };
Y.Object.each(stats, function(val) {
ret.total += 1;
if (val) {
ret.covered += 1;
}
});
ret.pct = this._percent(ret.covered, ret.total);
return ret;
},
/**
* Noramlizes branch data from Istanbul
* @method _computeBranchTotals
* @private
* @param {Object} fileCoverage JSON coverage data
*/
_computeBranchTotals: function (fileCoverage) {
var stats = fileCoverage.b,
ret = { total: 0, covered: 0 };
Y.Object.each(stats, function (branches) {
var covered = Y.Array.filter(branches, function (num) { return num > 0; });
ret.total += branches.length;
ret.covered += covered.length;
});
ret.pct = this._percent(ret.covered, ret.total);
return ret;
},
/**
* Takes an Istanbul coverage object, normalizes it and prints a log with a summary
* @method parseInstanbul
* @param {Object} coverage The coverage object to normalize and log
*/
parseIstanbul: function (coverage) {
var self = this,
str = 'Coverage Report:\n';
Y.Object.each(coverage, function(fileCoverage, file) {
var ret = self._blankSummary();
self._addDerivedInfoForFile(fileCoverage);
ret.lines = self._computeSimpleTotals(fileCoverage, 'l');
ret.functions = self._computeSimpleTotals(fileCoverage, 'f');
ret.statements = self._computeSimpleTotals(fileCoverage, 's');
ret.branches = self._computeBranchTotals(fileCoverage);
str += file + ':\n';
Y.Array.each(['lines','functions','statements','branches'], function(key) {
str += ' ' + key +': ' + ret[key].covered + '/' + ret[key].total + ' : ' + ret[key].pct + '%\n';
});
});
this.log(str, 'info', 'TestRunner');
},
/**
* Parses YUITest or Istanbul coverage results if they are available and logs them.
* @method _parseCoverage
* @private
*/
_parseCoverage: function() {
var coverage = Y.Test.Runner.getCoverage();
if (!coverage) {
return;
}
if (this._isIstanbul(coverage)) {
this.parseIstanbul(coverage);
} else {
this.parseYUITestCoverage(coverage);
}
},
// -- Protected Event Handlers ---------------------------------------------
_onEntry: function (e) {
var msg = e.message;
if (msg.category === 'info'
&& /\s(?:case|suite)\s|yuitests\d+|began/.test(msg.message)) {
msg.category = 'status';
} else if (msg.category === 'fail') {
this.printBuffer();
}
}
}, {
NAME: 'testConsole',
ATTRS: {
entryTemplate: {
value:
'<div class="{entry_class} {cat_class} {src_class}">' +
'<div class="{entry_content_class}">{message}</div>' +
'</div>'
},
height: {
value: '350px'
},
newestOnTop: {
value: false
},
style: {
value: 'block'
},
width: {
value: Y.UA.ie && Y.UA.ie < 9 ? '100%' : 'inherit'
}
}
});
}, '3.18.1', {"requires": ["console-filters", "test", "array-extras"], "skinnable": true});
+1
View File
@@ -0,0 +1 @@
YUI.add("test-console",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}e.namespace("Test").Console=e.extend(n,e.Console,{initializer:function(t){this.on("entry",this._onEntry),this.plug(e.Plugin.ConsoleFilters,{category:e.merge({info:!0,pass:!1,fail:!0,status:!1},t&&t.filters||{}),defaultVisibility:!1,source:{TestRunner:!0}}),e.Test.Runner.on("complete",e.bind(this._parseCoverage,this))},_isIstanbul:function(t){var n=e.Object.keys(t)[0],r=!1;return t[n].s!==undefined&&t[n].fnMap!==undefined&&(r=!0),t.s!==undefined&&t.fnMap!==undefined&&(r=!0),r},parseYUITestCoverage:function(t){var n={lines:{hit:0,miss:0,total:0,percent:0},functions:{hit:0,miss:0,total:0,percent:0}},r;e.Object.each(t,function(e){n.lines.total+=e.coveredLines,n.lines.hit+=e.calledLines,n.lines.miss+=e.coveredLines-e.calledLines,n.lines.percent=Math.floor(n.lines.hit/n.lines.total*100),n.functions.total+=e.coveredFunctions,n.functions.hit+=e.calledFunctions,n.functions.miss+=e.coveredFunctions-e.calledFunctions,n.functions.percent=Math.floor(n.functions.hit/n.functions.total*100)}),r="Lines: Hit:"+n.lines.hit+" Missed:"+n.lines.miss+" Total:"+n.lines.total+" Percent:"+n.lines.percent+"%\n",r+="Functions: Hit:"+n.functions.hit+" Missed:"+n.functions.miss+" Total:"+n.functions.total+" Percent:"+n.functions.percent+"%",this.log("Coverage: "+r,"info","TestRunner")},_blankSummary:function(){return{lines:{total:0,covered:0,pct:"Unknown"},statements:{total:0,covered:0,pct:"Unknown"},functions:{total:0,covered:0,pct:"Unknown"},branches:{total:0,covered:0,pct:"Unknown"}}},_addDerivedInfoForFile:function(t){var n=t.statementMap,r=t.s,i;t.l||(t.l=i={},e.Object.each(r,function(e,t){var s=n[t].start.line,o=r[t],u=i[s];if(typeof u=="undefined"||u<o)i[s]=o}))},_percent:function(e,t){var n,r=100;return t>0&&(n=1e5*e/t+5,r=Math.floor(n/10)/100),r},_computeSimpleTotals:function(t,n){var r=t[n],i={total:0,covered:0};return e.Object.each(r,function(e){i.total+=1,e&&(i.covered+=1)}),i.pct=this._percent(i.covered,i.total),i},_computeBranchTotals:function(t){var n=t.b,r={total:0,covered:0};return e.Object.each(n,function(t){var n=e.Array.filter(t,function(e){return e>0});r.total+=t.length,r.covered+=n.length}),r.pct=this._percent(r.covered,r.total),r},parseIstanbul:function(t){var n=this,r="Coverage Report:\n";e.Object.each(t,function(t,i){var s=n._blankSummary();n._addDerivedInfoForFile(t),s.lines=n._computeSimpleTotals(t,"l"),s.functions=n._computeSimpleTotals(t,"f"),s.statements=n._computeSimpleTotals(t,"s"),s.branches=n._computeBranchTotals(t),r+=i+":\n",e.Array.each(["lines","functions","statements","branches"],function(e){r+=" "+e+": "+s[e].covered+"/"+s[e].total+" : "+s[e].pct+"%\n"})}),this.log(r,"info","TestRunner")},_parseCoverage:function(){var t=e.Test.Runner.getCoverage();if(!t)return;this._isIstanbul(t)?this.parseIstanbul(t):this.parseYUITestCoverage(t)},_onEntry:function(e){var t=e.message;t.category==="info"&&/\s(?:case|suite)\s|yuitests\d+|began/.test(t.message)?t.category="status":t.category==="fail"&&this.printBuffer()}},{NAME:"testConsole",ATTRS:{entryTemplate:{value:'<div class="{entry_class} {cat_class} {src_class}"><div class="{entry_content_class}">{message}</div></div>'},height:{value:"350px"},newestOnTop:{value:!1},style:{value:"block"},width:{value:e.UA.ie&&e.UA.ie<9?"100%":"inherit"}}})},"3.18.1",{requires:["console-filters","test","array-extras"],skinnable:!0});
@@ -0,0 +1,307 @@
YUI.add('test-console', function (Y, NAME) {
/**
Provides a specialized log console widget that's pre-configured to display YUI
Test output with no extra configuration.
@example
<div id="log" class="yui3-skin-sam"></div>
<script>
YUI().use('test-console', function (Y) {
// ... set up your test cases here ...
// Render the console inside the #log div, then run the tests.
new Y.Test.Console().render('#log');
Y.Test.Runner.run();
});
</script>
@module test-console
@namespace Test
@class Console
@extends Console
@constructor
@param {Object} [config] Config attributes.
@param {Object} [config.filters] Category filter configuration.
@since 3.5.0
**/
function TestConsole() {
TestConsole.superclass.constructor.apply(this, arguments);
}
Y.namespace('Test').Console = Y.extend(TestConsole, Y.Console, {
initializer: function (config) {
this.on('entry', this._onEntry);
this.plug(Y.Plugin.ConsoleFilters, {
category: Y.merge({
info : true,
pass : false,
fail : true,
status: false
}, (config && config.filters) || {}),
defaultVisibility: false,
source: {
TestRunner: true
}
});
Y.Test.Runner.on('complete', Y.bind(this._parseCoverage, this));
},
// -- Protected Coverage Parser ---------------------------------------------
/**
* Scans the coverage data to determine if it's an Istanbul coverage object.
* @method _isIstanbul
* @param {Object} json The coverage data to scan
* @return {Boolean} True if this is Istanbul Coverage
*/
_isIstanbul: function(json) {
var first = Y.Object.keys(json)[0],
ret = false;
if (json[first].s !== undefined && json[first].fnMap !== undefined) {
ret = true;
}
if (json.s !== undefined && json.fnMap !== undefined) {
ret = true;
}
return ret;
},
/**
* Parses and logs a summary of YUITest coverage data.
* @method parseYUITest
* @param {Object} coverage The YUITest Coverage JSON data
*/
parseYUITestCoverage: function (coverage) {
var cov = {
lines: {
hit: 0,
miss: 0,
total: 0,
percent: 0
},
functions: {
hit: 0,
miss: 0,
total: 0,
percent: 0
}
}, coverageLog;
Y.Object.each(coverage, function(info) {
cov.lines.total += info.coveredLines;
cov.lines.hit += info.calledLines;
cov.lines.miss += (info.coveredLines - info.calledLines);
cov.lines.percent = Math.floor((cov.lines.hit / cov.lines.total) * 100);
cov.functions.total += info.coveredFunctions;
cov.functions.hit += info.calledFunctions;
cov.functions.miss += (info.coveredFunctions - info.calledFunctions);
cov.functions.percent = Math.floor((cov.functions.hit / cov.functions.total) * 100);
});
coverageLog = 'Lines: Hit:' + cov.lines.hit + ' Missed:' + cov.lines.miss + ' Total:' + cov.lines.total + ' Percent:' + cov.lines.percent + '%\n';
coverageLog += 'Functions: Hit:' + cov.functions.hit + ' Missed:' + cov.functions.miss + ' Total:' + cov.functions.total + ' Percent:' + cov.functions.percent + '%';
this.log('Coverage: ' + coverageLog, 'info', 'TestRunner');
},
/**
* Generates a generic summary object used for Istanbul conversions.
* @method _blankSummary
* @return {Object} Generic summary object
*/
_blankSummary: function () {
return {
lines: {
total: 0,
covered: 0,
pct: 'Unknown'
},
statements: {
total: 0,
covered: 0,
pct: 'Unknown'
},
functions: {
total: 0,
covered: 0,
pct: 'Unknown'
},
branches: {
total: 0,
covered: 0,
pct: 'Unknown'
}
};
},
/**
* Calculates line numbers from statement coverage
* @method _addDerivedInfoForFile
* @private
* @param {Object} fileCoverage JSON coverage data
*/
_addDerivedInfoForFile: function (fileCoverage) {
var statementMap = fileCoverage.statementMap,
statements = fileCoverage.s,
lineMap;
if (!fileCoverage.l) {
fileCoverage.l = lineMap = {};
Y.Object.each(statements, function (value, st) {
var line = statementMap[st].start.line,
count = statements[st],
prevVal = lineMap[line];
if (typeof prevVal === 'undefined' || prevVal < count) {
lineMap[line] = count;
}
});
}
},
/**
* Generic percent calculator
* @method _percent
* @param {Number} covered The covered amount
* @param {Number} total The total
* @private
*/
_percent: function (covered, total) {
var tmp, pct = 100.00;
if (total > 0) {
tmp = 1000 * 100 * covered / total + 5;
pct = Math.floor(tmp / 10) / 100;
}
return pct;
},
/**
* Summarize simple properties in the coverage data
* @method _computSimpleTotals
* @private
* @param {Object} fileCoverage JSON coverage data
* @param {String} property The property to summarize
*/
_computeSimpleTotals: function (fileCoverage, property) {
var stats = fileCoverage[property],
ret = { total: 0, covered: 0 };
Y.Object.each(stats, function(val) {
ret.total += 1;
if (val) {
ret.covered += 1;
}
});
ret.pct = this._percent(ret.covered, ret.total);
return ret;
},
/**
* Noramlizes branch data from Istanbul
* @method _computeBranchTotals
* @private
* @param {Object} fileCoverage JSON coverage data
*/
_computeBranchTotals: function (fileCoverage) {
var stats = fileCoverage.b,
ret = { total: 0, covered: 0 };
Y.Object.each(stats, function (branches) {
var covered = Y.Array.filter(branches, function (num) { return num > 0; });
ret.total += branches.length;
ret.covered += covered.length;
});
ret.pct = this._percent(ret.covered, ret.total);
return ret;
},
/**
* Takes an Istanbul coverage object, normalizes it and prints a log with a summary
* @method parseInstanbul
* @param {Object} coverage The coverage object to normalize and log
*/
parseIstanbul: function (coverage) {
var self = this,
str = 'Coverage Report:\n';
Y.Object.each(coverage, function(fileCoverage, file) {
var ret = self._blankSummary();
self._addDerivedInfoForFile(fileCoverage);
ret.lines = self._computeSimpleTotals(fileCoverage, 'l');
ret.functions = self._computeSimpleTotals(fileCoverage, 'f');
ret.statements = self._computeSimpleTotals(fileCoverage, 's');
ret.branches = self._computeBranchTotals(fileCoverage);
str += file + ':\n';
Y.Array.each(['lines','functions','statements','branches'], function(key) {
str += ' ' + key +': ' + ret[key].covered + '/' + ret[key].total + ' : ' + ret[key].pct + '%\n';
});
});
this.log(str, 'info', 'TestRunner');
},
/**
* Parses YUITest or Istanbul coverage results if they are available and logs them.
* @method _parseCoverage
* @private
*/
_parseCoverage: function() {
var coverage = Y.Test.Runner.getCoverage();
if (!coverage) {
return;
}
if (this._isIstanbul(coverage)) {
this.parseIstanbul(coverage);
} else {
this.parseYUITestCoverage(coverage);
}
},
// -- Protected Event Handlers ---------------------------------------------
_onEntry: function (e) {
var msg = e.message;
if (msg.category === 'info'
&& /\s(?:case|suite)\s|yuitests\d+|began/.test(msg.message)) {
msg.category = 'status';
} else if (msg.category === 'fail') {
this.printBuffer();
}
}
}, {
NAME: 'testConsole',
ATTRS: {
entryTemplate: {
value:
'<div class="{entry_class} {cat_class} {src_class}">' +
'<div class="{entry_content_class}">{message}</div>' +
'</div>'
},
height: {
value: '350px'
},
newestOnTop: {
value: false
},
style: {
value: 'block'
},
width: {
value: Y.UA.ie && Y.UA.ie < 9 ? '100%' : 'inherit'
}
}
});
}, '3.18.1', {"requires": ["console-filters", "test", "array-extras"], "skinnable": true});