code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function close_tunnel(status) {
// Ignore if already closed
if (tunnel.state === Guacamole.Tunnel.State.CLOSED)
return;
// If connection closed abnormally, signal error.
if (status.code !== Guacamole.Status.Code.SUCCESS && tunnel.onerror)
tunnel.onerror(status);... | Closes this tunnel, signaling the given status and corresponding
message, which will be sent to the onerror handler if the status is
an error status.
@private
@param {Guacamole.Status} status The status causing the connection to
close; | close_tunnel | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
function getElement(value) {
var string = new String(value);
return string.length + "." + string;
} | Converts the given value to a length/string pair for use as an
element in a Guacamole instruction.
@private
@param value The value to convert.
@return {String} The converted value. | getElement | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
function attach(tunnel) {
// Set own functions to tunnel's functions
chained_tunnel.disconnect = tunnel.disconnect;
chained_tunnel.sendMessage = tunnel.sendMessage;
/**
* Fails the currently-attached tunnel, attaching a new tunnel if
* possible.
*
... | Sets the current tunnel.
@private
@param {Guacamole.Tunnel} tunnel The tunnel to set as the current tunnel. | attach | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
function fail_tunnel() {
// Get next tunnel
var next_tunnel = tunnels.shift();
// If there IS a next tunnel, try using it.
if (next_tunnel) {
tunnel.onerror = null;
tunnel.oninstruction = null;
tunnel.onstatechange = null;... | Fails the currently-attached tunnel, attaching a new tunnel if
possible.
@private
@return {Guacamole.Tunnel} The next tunnel, or null if there are no
more tunnels to try. | fail_tunnel | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
function commit_tunnel() {
tunnel.onstatechange = chained_tunnel.onstatechange;
tunnel.oninstruction = chained_tunnel.oninstruction;
tunnel.onerror = chained_tunnel.onerror;
} | Use the current tunnel from this point forward. Do not try any more
tunnels, even if the current tunnel fails.
@private | commit_tunnel | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
function every (arr, fn, thisObj) {
var scope = thisObj || global;
for (var i = 0, j = arr.length; i < j; ++i) {
if (!fn.call(scope, arr[i], i, arr)) {
return false;
}
}
return true;
} | Array every compatibility
@see bit.ly/5Fq1N2
@api public | every | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/expect.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/expect.js | MIT |
function indexOf (arr, o, i) {
if (Array.prototype.indexOf) {
return Array.prototype.indexOf.call(arr, o, i);
}
if (arr.length === undefined) {
return -1;
}
for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0
; i < j && arr[i] !== o; i++);
return j <= i ? -... | Array indexOf compatibility.
@see bit.ly/a5Dxa2
@api public | indexOf | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/expect.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/expect.js | MIT |
getOuterHTML = function(element) {
if ('outerHTML' in element) return element.outerHTML;
var ns = "http://www.w3.org/1999/xhtml";
var container = document.createElementNS(ns, '_');
var xmlSerializer = new XMLSerializer();
var html;
if (document.xmlVersion) {
return xmlSerializer.serializeT... | Array indexOf compatibility.
@see bit.ly/a5Dxa2
@api public | getOuterHTML | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/expect.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/expect.js | MIT |
isDOMElement = function (object) {
if (typeof HTMLElement === 'object') {
return object instanceof HTMLElement;
} else {
return object &&
typeof object === 'object' &&
object.nodeType === 1 &&
typeof object.nodeName === 'string';
}
} | Array indexOf compatibility.
@see bit.ly/a5Dxa2
@api public | isDOMElement | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/expect.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/expect.js | MIT |
function isArray(obj) {
return '[object Array]' == {}.toString.call(obj);
} | Check if `obj` is an array. | isArray | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function Hook(title, fn) {
Runnable.call(this, title, fn);
this.type = 'hook';
} | Initialize a new `Hook` with the given `title` and callback `fn`.
@param {String} title
@param {Function} fn
@api private | Hook | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function visit(obj) {
var suite;
for (var key in obj) {
if ('function' == typeof obj[key]) {
var fn = obj[key];
switch (key) {
case 'before':
suites[0].beforeAll(fn);
break;
case 'after':
suites[0].afterAll(fn);
break;
... | TDD-style interface:
exports.Array = {
'#indexOf()': {
'should return -1 when the value is not present': function(){
},
'should return the correct index when the value is present': function(){
}
}
}; | visit | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function image(name) {
return __dirname + '/../images/' + name + '.png';
} | Return image `name` path.
@param {String} name
@return {String}
@api private | image | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function Mocha(options) {
options = options || {};
this.files = [];
this.options = options;
this.grep(options.grep);
this.suite = new exports.Suite('', new exports.Context);
this.ui(options.ui);
this.bail(options.bail);
this.reporter(options.reporter);
if (null != options.timeout) this.timeout(options... | Setup mocha with `options`.
Options:
- `ui` name "bdd", "tdd", "exports" etc
- `reporter` reporter instance, defaults to `mocha.reporters.Dot`
- `globals` array of accepted globals
- `timeout` timeout in milliseconds
- `bail` bail on the first test failure
- `slow` milliseconds to wait before considering ... | Mocha | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function parse(str) {
var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str);
if (!match) return;
var n = parseFloat(match[1]);
var type = (match[2] || 'ms').toLowerCase();
switch (type) {
case 'years':
case 'year':
case 'y':
return n * y;
case... | Parse the given `str` and return milliseconds.
@param {String} str
@return {Number}
@api private | parse | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function short(ms) {
if (ms >= d) return Math.round(ms / d) + 'd';
if (ms >= h) return Math.round(ms / h) + 'h';
if (ms >= m) return Math.round(ms / m) + 'm';
if (ms >= s) return Math.round(ms / s) + 's';
return ms + 'ms';
} | Short format for `ms`.
@param {Number} ms
@return {String}
@api private | short | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function long(ms) {
return plural(ms, d, 'day')
|| plural(ms, h, 'hour')
|| plural(ms, m, 'minute')
|| plural(ms, s, 'second')
|| ms + ' ms';
} | Long format for `ms`.
@param {Number} ms
@return {String}
@api private | long | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function Base(runner) {
var self = this
, stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 }
, failures = this.failures = [];
if (!runner) return;
this.runner = runner;
runner.stats = stats;
runner.on('start', function(){
stats.start = new Date;
});
runner.on(... | Initialize a new `Base` reporter.
All other reporters generally
inherit from this reporter, providing
stats such as test duration, number
of tests passed / failed etc.
@param {Runner} runner
@api public | Base | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function pad(str, len) {
str = String(str);
return Array(len - str.length + 1).join(' ') + str;
} | Pad the given `str` to `len`.
@param {String} str
@param {String} len
@return {String}
@api private | pad | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function inlineDiff(err, escape) {
var msg = errorDiff(err, 'WordsWithSpace', escape);
// linenos
var lines = msg.split('\n');
if (lines.length > 4) {
var width = String(lines.length).length;
msg = lines.map(function(str, i){
return pad(++i, width) + ' |' + ' ' + str;
}).join('\n');
}
//... | Returns an inline diff between 2 strings with coloured ANSI output
@param {Error} Error with actual/expected
@return {String} Diff
@api private | inlineDiff | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function unifiedDiff(err, escape) {
var indent = ' ';
function cleanUp(line) {
if (escape) {
line = escapeInvisibles(line);
}
if (line[0] === '+') return indent + colorLines('diff added', line);
if (line[0] === '-') return indent + colorLines('diff removed', line);
if (line.match(/\@\... | Returns a unified diff between 2 strings
@param {Error} Error with actual/expected
@return {String} Diff
@api private | unifiedDiff | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function cleanUp(line) {
if (escape) {
line = escapeInvisibles(line);
}
if (line[0] === '+') return indent + colorLines('diff added', line);
if (line[0] === '-') return indent + colorLines('diff removed', line);
if (line.match(/\@\@/)) return null;
if (line.match(/\\ No newline/)) return n... | Returns a unified diff between 2 strings
@param {Error} Error with actual/expected
@return {String} Diff
@api private | cleanUp | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function notBlank(line) {
return line != null;
} | Returns a unified diff between 2 strings
@param {Error} Error with actual/expected
@return {String} Diff
@api private | notBlank | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function errorDiff(err, type, escape) {
var actual = escape ? escapeInvisibles(err.actual) : err.actual;
var expected = escape ? escapeInvisibles(err.expected) : err.expected;
return diff['diff' + type](actual, expected).map(function(str){
if (str.added) return colorLines('diff added', str.value);
if ... | Return a character diff for `err`.
@param {Error} err
@return {String}
@api private | errorDiff | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function escapeInvisibles(line) {
return line.replace(/\t/g, '<tab>')
.replace(/\r/g, '<CR>')
.replace(/\n/g, '<LF>\n');
} | Returns a string with all invisible characters in plain text
@param {String} line
@return {String}
@api private | escapeInvisibles | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function colorLines(name, str) {
return str.split('\n').map(function(str){
return color(name, str);
}).join('\n');
} | Color lines for `str`, using the color `name`.
@param {String} name
@param {String} str
@return {String}
@api private | colorLines | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function stringify(obj) {
if (obj instanceof RegExp) return obj.toString();
return JSON.stringify(obj, null, 2);
} | Stringify `obj`.
@param {Mixed} obj
@return {String}
@api private | stringify | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function sameType(a, b) {
a = Object.prototype.toString.call(a);
b = Object.prototype.toString.call(b);
return a == b;
} | Check that a / b have the same type.
@param {Object} a
@param {Object} b
@return {Boolean}
@api private | sameType | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function Doc(runner) {
Base.call(this, runner);
var self = this
, stats = this.stats
, total = runner.total
, indents = 2;
function indent() {
return Array(indents).join(' ');
}
runner.on('suite', function(suite){
if (suite.root) return;
++indents;
console.log('%s<section class... | Initialize a new `Doc` reporter.
@param {Runner} runner
@api public | Doc | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function indent() {
return Array(indents).join(' ');
} | Initialize a new `Doc` reporter.
@param {Runner} runner
@api public | indent | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function Dot(runner) {
Base.call(this, runner);
var self = this
, stats = this.stats
, width = Base.window.width * .75 | 0
, n = 0;
runner.on('start', function(){
process.stdout.write('\n ');
});
runner.on('pending', function(test){
process.stdout.write(color('pending', Base.symbols.do... | Initialize a new `Dot` matrix test reporter.
@param {Runner} runner
@api public | Dot | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function HTMLCov(runner) {
var jade = require('jade')
, file = __dirname + '/templates/coverage.jade'
, str = fs.readFileSync(file, 'utf8')
, fn = jade.compile(str, { filename: file })
, self = this;
JSONCov.call(this, runner, false);
runner.on('end', function(){
process.stdout.write(fn({
... | Initialize a new `JsCoverage` reporter.
@param {Runner} runner
@api public | HTMLCov | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function coverageClass(n) {
if (n >= 75) return 'high';
if (n >= 50) return 'medium';
if (n >= 25) return 'low';
return 'terrible';
} | Return coverage class for `n`.
@return {String}
@api private | coverageClass | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function hideSuitesWithout(classname) {
var suites = document.getElementsByClassName('suite');
for (var i = 0; i < suites.length; i++) {
var els = suites[i].getElementsByClassName(classname);
if (0 == els.length) suites[i].className += ' hidden';
}
} | Check for suites that do not have elements
with `classname`, and hide them. | hideSuitesWithout | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function on(el, event, fn) {
if (el.addEventListener) {
el.addEventListener(event, fn, false);
} else {
el.attachEvent('on' + event, fn);
}
} | Listen on `event` with callback `fn`. | on | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function JSONCov(runner, output) {
var self = this
, output = 1 == arguments.length ? true : output;
Base.call(this, runner);
var tests = []
, failures = []
, passes = [];
runner.on('test end', function(test){
tests.push(test);
});
runner.on('pass', function(test){
passes.push(test);... | Initialize a new `JsCoverage` reporter.
@param {Runner} runner
@param {Boolean} output
@api public | JSONCov | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function map(cov) {
var ret = {
instrumentation: 'node-jscoverage'
, sloc: 0
, hits: 0
, misses: 0
, coverage: 0
, files: []
};
for (var filename in cov) {
var data = coverage(filename, cov[filename]);
ret.files.push(data);
ret.hits += data.hits;
ret.misses += data.misse... | Map jscoverage data to a JSON structure
suitable for reporting.
@param {Object} cov
@return {Object}
@api private | map | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function coverage(filename, data) {
var ret = {
filename: filename,
coverage: 0,
hits: 0,
misses: 0,
sloc: 0,
source: {}
};
data.source.forEach(function(line, num){
num++;
if (data[num] === 0) {
ret.misses++;
ret.sloc++;
} else if (data[num] !== undefined) {
... | Map jscoverage data for a single source file
to a JSON structure suitable for reporting.
@param {String} filename name of the source file
@param {Object} data jscoverage coverage data
@return {Object}
@api private | coverage | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function clean(test) {
return {
title: test.title
, fullTitle: test.fullTitle()
, duration: test.duration
}
} | Return a plain-object representation of `test`
free of cyclic properties etc.
@param {Object} test
@return {Object}
@api private | clean | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function List(runner) {
Base.call(this, runner);
var self = this
, stats = this.stats
, total = runner.total;
runner.on('start', function(){
console.log(JSON.stringify(['start', { total: total }]));
});
runner.on('pass', function(test){
console.log(JSON.stringify(['pass', clean(test)]));
... | Initialize a new `List` test reporter.
@param {Runner} runner
@api public | List | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function clean(test) {
return {
title: test.title
, fullTitle: test.fullTitle()
, duration: test.duration
}
} | Return a plain-object representation of `test`
free of cyclic properties etc.
@param {Object} test
@return {Object}
@api private | clean | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function JSONReporter(runner) {
var self = this;
Base.call(this, runner);
var tests = []
, failures = []
, passes = [];
runner.on('test end', function(test){
tests.push(test);
});
runner.on('pass', function(test){
passes.push(test);
});
runner.on('fail', function(test){
failures.... | Initialize a new `JSON` reporter.
@param {Runner} runner
@api public | JSONReporter | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function clean(test) {
return {
title: test.title
, fullTitle: test.fullTitle()
, duration: test.duration
}
} | Return a plain-object representation of `test`
free of cyclic properties etc.
@param {Object} test
@return {Object}
@api private | clean | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function runway() {
var buf = Array(width).join('-');
return ' ' + color('runway', buf);
} | Initialize a new `Landing` reporter.
@param {Runner} runner
@api public | runway | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function List(runner) {
Base.call(this, runner);
var self = this
, stats = this.stats
, n = 0;
runner.on('start', function(){
console.log();
});
runner.on('test', function(test){
process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
});
runner.on('pending', function(te... | Initialize a new `List` test reporter.
@param {Runner} runner
@api public | List | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function Markdown(runner) {
Base.call(this, runner);
var self = this
, stats = this.stats
, level = 0
, buf = '';
function title(str) {
return Array(level).join('#') + ' ' + str;
}
function indent() {
return Array(level).join(' ');
}
function mapTOC(suite, obj) {
var ret = obj... | Initialize a new `Markdown` reporter.
@param {Runner} runner
@api public | Markdown | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function title(str) {
return Array(level).join('#') + ' ' + str;
} | Initialize a new `Markdown` reporter.
@param {Runner} runner
@api public | title | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function indent() {
return Array(level).join(' ');
} | Initialize a new `Markdown` reporter.
@param {Runner} runner
@api public | indent | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function mapTOC(suite, obj) {
var ret = obj;
obj = obj[suite.title] = obj[suite.title] || { suite: suite };
suite.suites.forEach(function(suite){
mapTOC(suite, obj);
});
return ret;
} | Initialize a new `Markdown` reporter.
@param {Runner} runner
@api public | mapTOC | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function stringifyTOC(obj, level) {
++level;
var buf = '';
var link;
for (var key in obj) {
if ('suite' == key) continue;
if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
if (key) buf += Array(level).join(' ') + link;
buf += stringifyTOC(obj... | Initialize a new `Markdown` reporter.
@param {Runner} runner
@api public | stringifyTOC | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function generateTOC(suite) {
var obj = mapTOC(suite, {});
return stringifyTOC(obj, 0);
} | Initialize a new `Markdown` reporter.
@param {Runner} runner
@api public | generateTOC | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function Min(runner) {
Base.call(this, runner);
runner.on('start', function(){
// clear screen
process.stdout.write('\u001b[2J');
// set cursor position
process.stdout.write('\u001b[1;3H');
});
runner.on('end', this.epilogue.bind(this));
} | Initialize a new `Min` minimal test reporter (best used with --watch).
@param {Runner} runner
@api public | Min | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function NyanCat(runner) {
Base.call(this, runner);
var self = this
, stats = this.stats
, width = Base.window.width * .75 | 0
, rainbowColors = this.rainbowColors = self.generateColors()
, colorIndex = this.colorIndex = 0
, numerOfLines = this.numberOfLines = 4
, trajectories = this.traject... | Initialize a new `Dot` matrix test reporter.
@param {Runner} runner
@api public | NyanCat | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function draw(color, n) {
write(' ');
write('\u001b[' + color + 'm' + n + '\u001b[0m');
write('\n');
} | Draw the "scoreboard" showing the number
of passes, failures and pending tests.
@api private | draw | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function indent() {
return Array(indents).join(' ')
} | Initialize a new `Spec` test reporter.
@param {Runner} runner
@api public | indent | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function TAP(runner) {
Base.call(this, runner);
var self = this
, stats = this.stats
, n = 1
, passes = 0
, failures = 0;
runner.on('start', function(){
var total = runner.grepTotal(runner.suite);
console.log('%d..%d', 1, total);
});
runner.on('test end', function(){
++n;
});
... | Initialize a new `TAP` reporter.
@param {Runner} runner
@api public | TAP | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function title(test) {
return test.fullTitle().replace(/#/g, '');
} | Return a TAP-safe title of `test`
@param {Object} test
@return {String}
@api private | title | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function XUnit(runner) {
Base.call(this, runner);
var stats = this.stats
, tests = []
, self = this;
runner.on('pass', function(test){
tests.push(test);
});
runner.on('fail', function(test){
tests.push(test);
});
runner.on('end', function(){
console.log(tag('testsuite', {
na... | Initialize a new `XUnit` reporter.
@param {Runner} runner
@api public | XUnit | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function test(test) {
var attrs = {
classname: test.parent.fullTitle()
, name: test.title
, time: test.duration / 1000
};
if ('failed' == test.state) {
var err = test.err;
attrs.message = escape(err.message);
console.log(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(e... | Output tag for the given `test.` | test | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function Runnable(title, fn) {
this.title = title;
this.fn = fn;
this.async = fn && fn.length;
this.sync = ! this.async;
this._timeout = 2000;
this._slow = 75;
this.timedOut = false;
} | Initialize a new `Runnable` with the given `title` and callback `fn`.
@param {String} title
@param {Function} fn
@api private | Runnable | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function multiple(err) {
if (emitted) return;
emitted = true;
self.emit('error', err || new Error('done() called multiple times'));
} | Run the test and invoke `fn(err)`.
@param {Function} fn
@api private | multiple | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function done(err) {
if (self.timedOut) return;
if (finished) return multiple(err);
self.clearTimeout();
self.duration = new Date - start;
finished = true;
fn(err);
} | Run the test and invoke `fn(err)`.
@param {Function} fn
@api private | done | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function Runner(suite) {
var self = this;
this._globals = [];
this.suite = suite;
this.total = suite.total();
this.failures = 0;
this.on('test end', function(test){ self.checkGlobals(test); });
this.on('hook end', function(hook){ self.checkGlobals(hook); });
this.grep(/.*/);
this.globals(this.globalPr... | Initialize a `Runner` for the given `suite`.
Events:
- `start` execution started
- `end` execution complete
- `suite` (suite) test suite execution started
- `suite end` (suite) all tests (and sub-suites) have finished
- `test` (test) test execution started
- `test end` (test) test completed
- `hoo... | Runner | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function next(i) {
var hook = hooks[i];
if (!hook) return fn();
if (self.failures && suite.bail()) return fn();
self.currentRunnable = hook;
hook.ctx.currentTest = self.test;
self.emit('hook', hook);
hook.on('error', function(err){
self.failHook(hook, err);
});
hook.run(fun... | Run hook `name` callbacks and then invoke `fn()`.
@param {String} name
@param {Function} function
@api private | next | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function next(suite) {
self.suite = suite;
if (!suite) {
self.suite = orig;
return fn();
}
self.hook(name, function(err){
if (err) {
self.suite = orig;
return fn(err);
}
next(suites.pop());
});
} | Run hook `name` for the given array of `suites`
in order, and callback `fn(err)`.
@param {String} name
@param {Array} suites
@param {Function} fn
@api private | next | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function next(err) {
// if we bail after first err
if (self.failures && suite._bail) return fn();
// next test
test = tests.shift();
// all done
if (!test) return fn();
// grep
var match = self._grep.test(test.fullTitle());
if (self._invert) match = !match;
if (!match) return ... | Run tests in the given `suite` and invoke
the callback `fn()` when complete.
@param {Suite} suite
@param {Function} fn
@api private | next | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function next() {
var curr = suite.suites[i++];
if (!curr) return done();
self.runSuite(curr, next);
} | Run the given `suite` and invoke the
callback `fn()` when complete.
@param {Suite} suite
@param {Function} fn
@api private | next | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function done() {
self.suite = suite;
self.hook('afterAll', function(){
self.emit('suite end', suite);
fn();
});
} | Run the given `suite` and invoke the
callback `fn()` when complete.
@param {Suite} suite
@param {Function} fn
@api private | done | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function filterLeaks(ok, globals) {
return filter(globals, function(key){
// Firefox and Chrome exposes iframes as index inside the window object
if (/^d+/.test(key)) return false;
// in firefox
// if runner runs in an iframe, this iframe's window.getInterface method not init at first
// it is as... | Filter leaks with the given globals flagged as `ok`.
@param {Array} ok
@param {Array} globals
@return {Array}
@api private | filterLeaks | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function Suite(title, ctx) {
this.title = title;
this.ctx = ctx;
this.suites = [];
this.tests = [];
this.pending = false;
this._beforeEach = [];
this._beforeAll = [];
this._afterEach = [];
this._afterAll = [];
this.root = !title;
this._timeout = 2000;
this._slow = 75;
this._bail = false;
} | Initialize a new `Suite` with the given
`title` and `ctx`.
@param {String} title
@param {Context} ctx
@api private | Suite | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function Test(title, fn) {
Runnable.call(this, title, fn);
this.pending = !fn;
this.type = 'test';
} | Initialize a new `Test` with the given `title` and callback `fn`.
@param {String} title
@param {Function} fn
@api private | Test | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
function highlight(js) {
return js
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
.replace(/('.*?')/gm, '<span class="string">$1</span>')
.replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
.replace(/(\d+)/gm, '<span class="numb... | Highlight the given string of `js`.
@param {String} js
@return {String}
@api private | highlight | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/mocha.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/mocha.js | MIT |
errorString = function( error ) {
var name, message,
errorString = error.toString();
if ( errorString.substring( 0, 7 ) === "[object" ) {
name = error.name ? error.name.toString() : "Error";
message = error.message ? error.message.toString() : "";
if ( name && message ) {
return name + ": " + messag... | Provides a normalized error string, correcting an issue
with IE 7 (and prior) where Error.prototype.toString is
not properly implemented
Based on http://es5.github.com/#x15.11.4.4
@param {String|Error} error
@return {String} error message | errorString | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
objectValues = function( obj ) {
// Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392.
/*jshint newcap: false */
var key, val,
vals = QUnit.is( "array", obj ) ? [] : {};
for ( key in obj ) {
if ( hasOwn.call( obj, key ) ) {
val = obj[key];
vals[key] = val === Object(val)... | Makes a clone of an object using only Array or Object as base,
and copies over the own enumerable properties.
@param {Object} obj
@return {Object} New object with only the own properties (recursively). | objectValues | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function validTest( test ) {
var include,
filter = config.filter && config.filter.toLowerCase(),
module = config.module && config.module.toLowerCase(),
fullName = ( test.module + ": " + test.testName ).toLowerCase();
// Internally-generated tests are always valid
if ( test.callback && test.callback.validTest ... | @return Boolean: true if this test should be ran | validTest | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function extractStacktrace( e, offset ) {
offset = offset === undefined ? 3 : offset;
var stack, include, i;
if ( e.stacktrace ) {
// Opera
return e.stacktrace.split( "\n" )[ offset + 3 ];
} else if ( e.stack ) {
// Firefox, Chrome
stack = e.stack.split( "\n" );
if (/^error$/i.test( stack[0] ) ) {
st... | @return Boolean: true if this test should be ran | extractStacktrace | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function sourceFromStacktrace( offset ) {
try {
throw new Error();
} catch ( e ) {
return extractStacktrace( e, offset );
}
} | @return Boolean: true if this test should be ran | sourceFromStacktrace | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function escapeText( s ) {
if ( !s ) {
return "";
}
s = s + "";
// Both single quotes and double quotes (for attributes)
return s.replace( /['"<>&]/g, function( s ) {
switch( s ) {
case "'":
return "'";
case "\"":
return """;
case "<":
return "<";
case ">":
return ">... | Escape text for attribute or text content. | escapeText | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function synchronize( callback, last ) {
config.queue.push( callback );
if ( config.autorun && !config.blocking ) {
process( last );
}
} | Escape text for attribute or text content. | synchronize | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function process( last ) {
function next() {
process( last );
}
var start = new Date().getTime();
config.depth = config.depth ? config.depth + 1 : 1;
while ( config.queue.length && !config.blocking ) {
if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate... | Escape text for attribute or text content. | process | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function next() {
process( last );
} | Escape text for attribute or text content. | next | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function saveGlobal() {
config.pollution = [];
if ( config.noglobals ) {
for ( var key in window ) {
if ( hasOwn.call( window, key ) ) {
// in Opera sometimes DOM element ids show up here, ignore them
if ( /^qunit-test-output/.test( key ) ) {
continue;
}
config.pollution.push( key );
}
... | Escape text for attribute or text content. | saveGlobal | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function checkPollution() {
var newGlobals,
deletedGlobals,
old = config.pollution;
saveGlobal();
newGlobals = diff( config.pollution, old );
if ( newGlobals.length > 0 ) {
QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") );
}
deletedGlobals = diff( old, config.pollution );
i... | Escape text for attribute or text content. | checkPollution | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function diff( a, b ) {
var i, j,
result = a.slice();
for ( i = 0; i < result.length; i++ ) {
for ( j = 0; j < b.length; j++ ) {
if ( result[i] === b[j] ) {
result.splice( i, 1 );
i--;
break;
}
}
}
return result;
} | Escape text for attribute or text content. | diff | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function extend( a, b ) {
for ( var prop in b ) {
if ( hasOwn.call( b, prop ) ) {
// Avoid "Member not found" error in IE8 caused by messing with window.constructor
if ( !( prop === "constructor" && a === window ) ) {
if ( b[ prop ] === undefined ) {
delete a[ prop ];
} else {
a[ prop ] = b[ ... | Escape text for attribute or text content. | extend | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function addEvent( elem, type, fn ) {
if ( elem.addEventListener ) {
// Standards-based browsers
elem.addEventListener( type, fn, false );
} else if ( elem.attachEvent ) {
// support: IE <9
elem.attachEvent( "on" + type, fn );
} else {
// Caller must ensure support for event listeners is present
throw... | @param {HTMLElement} elem
@param {string} type
@param {Function} fn | addEvent | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function addEvents( elems, type, fn ) {
var i = elems.length;
while ( i-- ) {
addEvent( elems[i], type, fn );
}
} | @param {Array|NodeList} elems
@param {string} type
@param {Function} fn | addEvents | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function hasClass( elem, name ) {
return (" " + elem.className + " ").indexOf(" " + name + " ") > -1;
} | @param {Array|NodeList} elems
@param {string} type
@param {Function} fn | hasClass | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function addClass( elem, name ) {
if ( !hasClass( elem, name ) ) {
elem.className += (elem.className ? " " : "") + name;
}
} | @param {Array|NodeList} elems
@param {string} type
@param {Function} fn | addClass | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function removeClass( elem, name ) {
var set = " " + elem.className + " ";
// Class name may appear multiple times
while ( set.indexOf(" " + name + " ") > -1 ) {
set = set.replace(" " + name + " " , " ");
}
// If possible, trim it for prettiness, but not necessarily
elem.className = typeof set.trim === "functio... | @param {Array|NodeList} elems
@param {string} type
@param {Function} fn | removeClass | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function id( name ) {
return defined.document && document.getElementById && document.getElementById( name );
} | @param {Array|NodeList} elems
@param {string} type
@param {Function} fn | id | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function registerLoggingCallback( key ) {
return function( callback ) {
config[key].push( callback );
};
} | @param {Array|NodeList} elems
@param {string} type
@param {Function} fn | registerLoggingCallback | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function runLoggingCallbacks( key, scope, args ) {
var i, callbacks;
if ( QUnit.hasOwnProperty( key ) ) {
QUnit[ key ].call(scope, args );
} else {
callbacks = config[ key ];
for ( i = 0; i < callbacks.length; i++ ) {
callbacks[ i ].call( scope, args );
}
}
} | @param {Array|NodeList} elems
@param {string} type
@param {Function} fn | runLoggingCallbacks | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function inArray( elem, array ) {
if ( array.indexOf ) {
return array.indexOf( elem );
}
for ( var i = 0, length = array.length; i < length; i++ ) {
if ( array[ i ] === elem ) {
return i;
}
}
return -1;
} | @param {Array|NodeList} elems
@param {string} type
@param {Function} fn | inArray | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function Test( settings ) {
extend( this, settings );
this.assertions = [];
this.testNumber = ++Test.count;
} | @param {Array|NodeList} elems
@param {string} type
@param {Function} fn | Test | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function run() {
// each of these can by async
synchronize(function() {
test.setup();
});
synchronize(function() {
test.run();
});
synchronize(function() {
test.teardown();
});
synchronize(function() {
test.finish();
});
} | Expose the current test environment.
@deprecated since 1.12.0: Use QUnit.config.current.testEnvironment instead. | run | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function bindCallbacks( o, callbacks, args ) {
var prop = QUnit.objectType( o );
if ( prop ) {
if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) {
return callbacks[ prop ].apply( callbacks, args );
} else {
return callbacks[ prop ]; // or undefined
}
}
} | @deprecated since 1.0.0, replaced with error pushes since 1.3.0
Kept to avoid TypeErrors for undefined methods. | bindCallbacks | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function useStrictEquality( b, a ) {
/*jshint eqeqeq:false */
if ( b instanceof a.constructor || a instanceof b.constructor ) {
// to catch short annotation VS 'new' annotation of a
// declaration
// e.g. var i = 1;
// var j = new Number(1);
return a == b;
} else {
return a ===... | @deprecated since 1.0.0, replaced with error pushes since 1.3.0
Kept to avoid TypeErrors for undefined methods. | useStrictEquality | javascript | alibaba/f2etest | f2etest-web/public/demo/lib/qunit-1.14.0.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/demo/lib/qunit-1.14.0.js | MIT |
function jscoverage_init(w) {
try {
// in Safari, "import" is a syntax error
Components.utils['import']('resource://app/modules/jscoverage.jsm');
jscoverage_isInvertedMode = true;
return;
}
catch (e) {}
// check if we are in inverted mode
if (w.opener) {
try {
if (w.opener.top._$jsc... | Initializes the _$jscoverage object in a window. This should be the first
function called in the page.
@param w this should always be the global window object | jscoverage_init | javascript | alibaba/f2etest | f2etest-web/public/jscover/jscoverage.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js | MIT |
function jscoverage_createRequest() {
// Note that the IE7 XMLHttpRequest does not support file URL's.
// http://xhab.blogspot.com/2006/11/ie7-support-for-xmlhttprequest.html
// http://blogs.msdn.com/ie/archive/2006/12/06/file-uris-in-windows.aspx
//#JSCOVERAGE_IF
if (window.ActiveXObject) {
return new Acti... | Initializes the _$jscoverage object in a window. This should be the first
function called in the page.
@param w this should always be the global window object | jscoverage_createRequest | javascript | alibaba/f2etest | f2etest-web/public/jscover/jscoverage.js | https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.