Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
271 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
components | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#mocha { | ||
font: 12px "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
margin: 80px; | ||
} | ||
|
||
#mocha .test { | ||
display: block; | ||
margin: 1px; | ||
float: left; | ||
width: 25px; | ||
height: 25px; | ||
background: #f8f8f8; | ||
border-radius: 2px; | ||
-webkit-transform: scale(.2); | ||
-moz-transform: scale(.2); | ||
transform: scale(.2); | ||
-webkit-transition: -webkit-transform 200ms, background-color 150ms; | ||
-moz-transition: -moz-transform 200ms, background-color 150ms; | ||
transition: transform 200ms, background-color 150ms; | ||
} | ||
|
||
#mocha .fail.show:hover { | ||
background: #f00; | ||
} | ||
|
||
#mocha .test.show { | ||
background: #eee; | ||
-webkit-transform: scale(1); | ||
-moz-transform: scale(1); | ||
transform: scale(1); | ||
} | ||
|
||
#mocha .fail.show { | ||
background: #c00; | ||
} | ||
|
||
#mocha .test:hover { | ||
background: #ddd; | ||
} | ||
|
||
#mocha .errors { | ||
margin: 0; | ||
padding: 0; | ||
opacity: 0; | ||
float: left; | ||
width: 100%; | ||
-webkit-transition: opacity 500ms; | ||
-moz-transition: opacity 500ms; | ||
transition: opacity 500ms; | ||
} | ||
|
||
#mocha .errors.show { | ||
opacity: 1; | ||
} | ||
|
||
#mocha .errors li { | ||
margin: 50px 15px; | ||
list-style: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
|
||
|
||
/** | ||
* hasOwnProperty. | ||
*/ | ||
|
||
var has = Object.prototype.hasOwnProperty; | ||
|
||
/** | ||
* Require the given path. | ||
* | ||
* @param {String} path | ||
* @return {Object} exports | ||
* @api public | ||
*/ | ||
|
||
function require(path, parent, orig) { | ||
var resolved = require.resolve(path); | ||
|
||
// lookup failed | ||
if (null == resolved) { | ||
orig = orig || path; | ||
parent = parent || 'root'; | ||
var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); | ||
err.path = orig; | ||
err.parent = parent; | ||
err.require = true; | ||
throw err; | ||
} | ||
|
||
var module = require.modules[resolved]; | ||
|
||
// perform real require() | ||
// by invoking the module's | ||
// registered function | ||
if (!module.exports) { | ||
module.exports = {}; | ||
module.client = module.component = true; | ||
module.call(this, module.exports, require.relative(resolved), module); | ||
} | ||
|
||
return module.exports; | ||
} | ||
|
||
/** | ||
* Registered modules. | ||
*/ | ||
|
||
require.modules = {}; | ||
|
||
/** | ||
* Registered aliases. | ||
*/ | ||
|
||
require.aliases = {}; | ||
|
||
/** | ||
* Resolve `path`. | ||
* | ||
* Lookup: | ||
* | ||
* - PATH/index.js | ||
* - PATH.js | ||
* - PATH | ||
* | ||
* @param {String} path | ||
* @return {String} path or null | ||
* @api private | ||
*/ | ||
|
||
require.resolve = function(path) { | ||
if (path.charAt(0) === '/') path = path.slice(1); | ||
var index = path + '/index.js'; | ||
|
||
var paths = [ | ||
path, | ||
path + '.js', | ||
path + '.json', | ||
path + '/index.js', | ||
path + '/index.json' | ||
]; | ||
|
||
for (var i = 0; i < paths.length; i++) { | ||
var path = paths[i]; | ||
if (has.call(require.modules, path)) return path; | ||
} | ||
|
||
if (has.call(require.aliases, index)) { | ||
return require.aliases[index]; | ||
} | ||
}; | ||
|
||
/** | ||
* Normalize `path` relative to the current path. | ||
* | ||
* @param {String} curr | ||
* @param {String} path | ||
* @return {String} | ||
* @api private | ||
*/ | ||
|
||
require.normalize = function(curr, path) { | ||
var segs = []; | ||
|
||
if ('.' != path.charAt(0)) return path; | ||
|
||
curr = curr.split('/'); | ||
path = path.split('/'); | ||
|
||
for (var i = 0; i < path.length; ++i) { | ||
if ('..' == path[i]) { | ||
curr.pop(); | ||
} else if ('.' != path[i] && '' != path[i]) { | ||
segs.push(path[i]); | ||
} | ||
} | ||
|
||
return curr.concat(segs).join('/'); | ||
}; | ||
|
||
/** | ||
* Register module at `path` with callback `definition`. | ||
* | ||
* @param {String} path | ||
* @param {Function} definition | ||
* @api private | ||
*/ | ||
|
||
require.register = function(path, definition) { | ||
require.modules[path] = definition; | ||
}; | ||
|
||
/** | ||
* Alias a module definition. | ||
* | ||
* @param {String} from | ||
* @param {String} to | ||
* @api private | ||
*/ | ||
|
||
require.alias = function(from, to) { | ||
if (!has.call(require.modules, from)) { | ||
throw new Error('Failed to alias "' + from + '", it does not exist'); | ||
} | ||
require.aliases[to] = from; | ||
}; | ||
|
||
/** | ||
* Return a require function relative to the `parent` path. | ||
* | ||
* @param {String} parent | ||
* @return {Function} | ||
* @api private | ||
*/ | ||
|
||
require.relative = function(parent) { | ||
var p = require.normalize(parent, '..'); | ||
|
||
/** | ||
* lastIndexOf helper. | ||
*/ | ||
|
||
function lastIndexOf(arr, obj) { | ||
var i = arr.length; | ||
while (i--) { | ||
if (arr[i] === obj) return i; | ||
} | ||
return -1; | ||
} | ||
|
||
/** | ||
* The relative require() itself. | ||
*/ | ||
|
||
function localRequire(path) { | ||
var resolved = localRequire.resolve(path); | ||
return require(resolved, parent, path); | ||
} | ||
|
||
/** | ||
* Resolve relative to the parent. | ||
*/ | ||
|
||
localRequire.resolve = function(path) { | ||
var c = path.charAt(0); | ||
if ('/' == c) return path.slice(1); | ||
if ('.' == c) return require.normalize(p, path); | ||
|
||
// resolve deps by returning | ||
// the dep in the nearest "deps" | ||
// directory | ||
var segs = parent.split('/'); | ||
var i = lastIndexOf(segs, 'deps') + 1; | ||
if (!i) i = 0; | ||
path = segs.slice(0, i + 1).join('/') + '/deps/' + path; | ||
return path; | ||
}; | ||
|
||
/** | ||
* Check if module is defined at `path`. | ||
*/ | ||
|
||
localRequire.exists = function(path) { | ||
return has.call(require.modules, localRequire.resolve(path)); | ||
}; | ||
|
||
return localRequire; | ||
}; | ||
require.register("mocha-matrix/index.js", Function("exports, require, module", | ||
"\n/**\n * Expose `Matrix`.\n */\n\nmodule.exports = Matrix;\n\n/**\n * Initialize a new `Matrix` reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction Matrix(runner) {\n var root = document.getElementById('mocha');\n var errors = document.createElement('ul');\n errors.className = 'errors';\n var n = 0;\n\n var els = boxes(runner.total);\n\n for (var i = 0; i < els.length; i++) {\n root.appendChild(els[i]);\n }\n\n var i = 0;\n runner.on('pass', function(test){\n show(els[i++], 'test pass');\n });\n\n runner.on('fail', function(test, err){\n var id = 'error-' + ++n;\n var el = els[i++];\n el.href = '#' + id;\n show(el, 'test fail');\n\n var msg = err.stack || err.message;\n var pre = document.createElement('pre');\n text(pre, msg);\n\n var title = document.createElement('h3');\n title.setAttribute('id', id);\n text(title, test.fullTitle());\n\n var li = document.createElement('li');\n\n li.appendChild(title);\n li.appendChild(pre);\n\n errors.appendChild(li);\n });\n\n runner.on('end', function(){\n root.appendChild(errors);\n show(errors, 'errors');\n });\n\n function show(el, classname) {\n el.className = classname;\n setTimeout(function(){\n el.className = classname + ' show';\n }, 0);\n }\n}\n\n/**\n * Create `n` boxes.\n */\n\nfunction boxes(n) {\n var els = [];\n\n for (var i = 0; i < n; i++) {\n var el = document.createElement('a');\n el.className = 'test';\n els.push(el);\n }\n\n return els;\n}\n\n/**\n * Set `el` text to `str`.\n */\n\nfunction text(el, str) {\n if (el.textContent) {\n el.textContent = str;\n } else {\n el.innerText = str;\n }\n}\n\n/**\n * Listen on `event` with callback `fn`.\n */\n\nfunction on(el, event, fn) {\n if (el.addEventListener) {\n el.addEventListener(event, fn, false);\n } else {\n el.attachEvent('on' + event, fn);\n }\n}\n//@ sourceURL=mocha-matrix/index.js" | ||
)); | ||
|