mirror of
https://github.com/chaijs/chai
synced 2024-11-15 00:07:11 +00:00
remove old docs
This commit is contained in:
parent
ae27ec567f
commit
bcbbdd35d4
44 changed files with 0 additions and 13330 deletions
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
title: Language Guide
|
||||
weight: 0
|
||||
template: code-index
|
||||
---
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"locals": {
|
||||
"title": "Chai",
|
||||
"googleanalytics": "UA-26183904-6",
|
||||
"mixpanel": "d5e84615dbd02dbc359b0f76d0ed7cf5",
|
||||
"ghuser": "logicalparadox",
|
||||
"ghbaseurl": "",
|
||||
"ghproject": "chai",
|
||||
"tweeturl": "http://chaijs.com",
|
||||
"tweetvia": "jakeluer",
|
||||
"tweetrelated": "jakeluer",
|
||||
"version": "0.1.3",
|
||||
"hasdownloads": false,
|
||||
"description": "Chai is a BDD / TDD assertion library for [node](http://nodejs.org) and the browser that can be delightfully paired with any javascript testing framework."
|
||||
},
|
||||
"plugins": [
|
||||
{ "name": "code"
|
||||
, "files": [
|
||||
{ "name": "expect"
|
||||
, "title": "expect / should [bdd]"
|
||||
, "file": "../../lib/assertion.js"
|
||||
, "description": "The BDD style allows you to write your assertions in a natural, self-describing manner." }
|
||||
, { "name": "assert"
|
||||
, "title": "assert [tdd]"
|
||||
, "file": "../../lib/interface/assert.js"
|
||||
, "description": "The TDD style allows you to write your assertions using the classic 'assert dot' notation." }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
---
|
||||
title: Contributing
|
||||
weight: 10
|
||||
render-file: false
|
||||
---
|
||||
|
||||
### Developing
|
||||
|
||||
Please avoid making changes to the browser versions of chai if you are developing in the browser. All
|
||||
changes to the library are to be made to `lib/*` and then packaged for the browser using the `make`
|
||||
command.
|
||||
|
||||
### Testing
|
||||
|
||||
Tests are written in `exports` style on [mocha test framework](http://visionmedia.github.com/mocha/).
|
||||
There is a test file for each of the interfaces. The tests for `expect` and `assert` must pass in node.js
|
||||
and in the browser, whereas the should tests only need to pass on node.js.
|
||||
|
||||
Browsers tests are currently known to pass in Chrome 16 and Firefox 8. Please let me know if you can test
|
||||
in other browsers or other version.
|
||||
|
||||
#### Server Side Testing
|
||||
|
||||
It's quite simple...
|
||||
|
||||
make test
|
||||
|
||||
|
||||
#### Browser Side Testing
|
||||
|
||||
It's also quite simple. Open up `test/browser/index.html` in your nearest browser.
|
||||
|
||||
|
||||
### Building
|
||||
|
||||
If you have made changes to any of the components, you must rebuild the browser package.
|
||||
|
||||
$ make
|
||||
|
||||
### Contributors
|
||||
|
||||
project: chai
|
||||
commits: 278
|
||||
files : 71
|
||||
authors:
|
||||
211 Jake Luer 75.9%
|
||||
53 Veselin Todorov 19.1%
|
||||
5 Juliusz Gonera 1.8%
|
||||
3 Jeff Barczewski 1.1%
|
||||
2 Jo Liss 0.7%
|
||||
1 Vinay Pulim 0.4%
|
||||
1 Jakub Nešetřil 0.4%
|
||||
1 John Firebaugh 0.4%
|
||||
1 Domenic Denicola 0.4%
|
|
@ -1,10 +0,0 @@
|
|||
---
|
||||
title: Getting Help
|
||||
weight: 8
|
||||
render-file: false
|
||||
---
|
||||
|
||||
If you have questions or issues, please use this projects
|
||||
[Github Issues](https://github.com/logicalparadox/chai/issues). You can also keep up to date
|
||||
on the [Google Group](http://groups.google.com/group/chaijs) or ping [@jakeluer](http://twitter.com/jakeluer)
|
||||
directly on Twitter. Chai developers can also be found on Freenode IRC in #letstest.js.
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
title: Installation
|
||||
weight: 0
|
||||
render-file: false
|
||||
---
|
||||
|
||||
Chai is available for both node.js and the browser using any
|
||||
test framework you like.
|
||||
|
||||
### Node.js
|
||||
|
||||
Package is available through [npm](http://npmjs.org):
|
||||
|
||||
npm install chai
|
||||
|
||||
Recommend adding it to package.json devDependancies.
|
||||
|
||||
### Browser
|
||||
|
||||
Include the chai browser build in your testing suite.
|
||||
|
||||
<script src="chai.js" type="text/javascript"></script>
|
||||
|
||||
Currently supports all modern browsers: IE 9+, Chrome 7+, FireFox 4+, Safari 5+.
|
||||
|
||||
Want to know if your browser is compatible? Run the [online test suite](/support/tests/).
|
||||
|
||||
The latest tagged version will also be available for hot-linking at [http://chaijs.com/chai.js](/chai.js).
|
|
@ -1,19 +0,0 @@
|
|||
---
|
||||
title: Plugins
|
||||
weight: 7
|
||||
render-file: false
|
||||
---
|
||||
|
||||
### Available Plugins
|
||||
|
||||
The Chai community is growing! Plugins allow developers to expand Chai's available
|
||||
assertions. Here is what the community has come up with so far:
|
||||
|
||||
* [chai-spies](https://github.com/logicalparadox/chai-spies) is a basic spy implementation for chai. It's also
|
||||
a good resource for building chai plugins that work in both node.js and the browser.
|
||||
* [chai-jquery](https://github.com/jfirebaugh/chai-jquery) by [@jfirebaugh](https://github.com/jfirebaugh)
|
||||
provides deep jQuery integration with chai `should` and `expect`.
|
||||
* [jack](https://github.com/vesln/jack) by [@vesln](https://github.com/vesln) is a mock/stub library that
|
||||
can be used as a stand-alone or with chai.
|
||||
* [sinon-chai](https://github.com/domenic/sinon-chai) by [@domenic](https://github.com/domenic) extends chai with
|
||||
assertions for the Sinon.js mocking framework.
|
|
@ -1,48 +0,0 @@
|
|||
---
|
||||
title: Assertion Styles
|
||||
weight: 5
|
||||
render-file: false
|
||||
---
|
||||
|
||||
### Expect
|
||||
|
||||
The `expect` style is server/browser BDD style assert language.
|
||||
|
||||
var expect = require('chai').expect
|
||||
, foo = 'bar'
|
||||
, beverages = { tea: [ 'chai', 'matcha', 'oolong' ] };
|
||||
|
||||
expect(foo).to.be.a('string');
|
||||
expect(foo).to.equal('bar');
|
||||
expect(foo).to.have.length(3);
|
||||
expect(beverages).to.have.property('tea').with.length(3);
|
||||
|
||||
### Should
|
||||
|
||||
The `should` style was inspired by [should.js](https://github.com/visionmedia/should.js)
|
||||
and is completely API compatible.
|
||||
|
||||
var should = require('chai').should() //actually call the the function
|
||||
, foo = 'bar'
|
||||
, beverages = { tea: [ 'chai', 'matcha', 'oolong' ] };
|
||||
|
||||
foo.should.be.a('string');
|
||||
foo.should.equal('bar');
|
||||
foo.should.have.length(3);
|
||||
beverages.should.have.property('tea').with.length(3);
|
||||
|
||||
Notice that the `expect` require is just a reference to the `expect` function, whereas
|
||||
with the `should` require, the function is being executed.
|
||||
|
||||
### Assert
|
||||
|
||||
The `assert` style is like the node.js included assert utility with few extras.
|
||||
|
||||
var assert = require('chai').assert
|
||||
, foo = 'bar'
|
||||
, beverages = { tea: [ 'chai', 'matcha', 'oolong' ] };
|
||||
|
||||
assert.typeOf(foo, 'string', 'foo is a string');
|
||||
assert.equal(foo, 'bar', 'foo equal `bar`');
|
||||
assert.length(foo, 3, 'foo`s value has a length of 3');
|
||||
assert.length(beverages.tea, 3, 'beverages has 3 types of tea');
|
|
@ -1,4 +0,0 @@
|
|||
---
|
||||
title: Home
|
||||
weight: 0
|
||||
---
|
|
@ -1,6 +0,0 @@
|
|||
---
|
||||
title: Test Coverage
|
||||
weight: 20
|
||||
render-file: false
|
||||
template: page
|
||||
---
|
|
@ -1,6 +0,0 @@
|
|||
---
|
||||
title: Test Suite
|
||||
weight: 10
|
||||
render-file: false
|
||||
template: page
|
||||
---
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,114 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Language Guide - Chai
|
||||
</title>
|
||||
<script type="text/javascript">var ghuser = 'logicalparadox'
|
||||
, ghproject = 'chai';
|
||||
|
||||
</script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
|
||||
<script src="/public/js/jq-mousewheel.js"></script>
|
||||
<script src="/public/js/antiscroll.js"></script>
|
||||
<script src="/public/js/prettify.js"></script>
|
||||
<script src="/public/js/main.js"></script>
|
||||
<link rel="stylesheet" href="/public/css/antiscroll.css" type="text/css" media="all">
|
||||
<link rel="stylesheet" href="/public/css/main.css" type="text/css" media="all">
|
||||
<link href="http://fonts.googleapis.com/css?family=Lato:300|Redressed" rel="stylesheet" type="text/css">
|
||||
<script type="text/javascript">var mpq = [];
|
||||
mpq.push(["init", "d5e84615dbd02dbc359b0f76d0ed7cf5"]);
|
||||
(function(){var b,a,e,d,c;b=document.createElement("script");b.type="text/javascript";
|
||||
b.async=true;b.src=(document.location.protocol==="https:"?"https:":"http:")+
|
||||
"//api.mixpanel.com/site_media/js/api/mixpanel.js";a=document.getElementsByTagName("script")[0];
|
||||
a.parentNode.insertBefore(b,a);e=function(f){return function(){mpq.push(
|
||||
[f].concat(Array.prototype.slice.call(arguments,0)))}};d=["init","track","track_links",
|
||||
"track_forms","register","register_once","identify","name_tag","set_config"];for(c=0;c<
|
||||
d.length;c++){mpq[d[c]]=e(d[c])}})();
|
||||
</script>
|
||||
<script type="text/javascript">var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-26183904-6']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<ul class="pages">
|
||||
<li><a href="/">Home</a>
|
||||
</li>
|
||||
<li><a href="/support/tests/">Test Suite</a>
|
||||
</li>
|
||||
<li><a href="/support/coverage/">Test Coverage</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="code">
|
||||
<li class="header"><a href="/code/">Language Guide</a>
|
||||
</li>
|
||||
<li><a href="/code/expect.html">expect / should [bdd]</a>
|
||||
</li>
|
||||
<li><a href="/code/assert.html">assert [tdd]</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<header>
|
||||
<h1><a href="/"><img src="/public/img/chai-logo.png" title="Chai"></a>
|
||||
</h1>
|
||||
<div class="description"><p>Chai is a BDD / TDD assertion library for <a href="http://nodejs.org">node</a> and the browser that can be delightfully paired with any javascript testing framework.</p>
|
||||
|
||||
</div>
|
||||
<div class="gh">
|
||||
<h4>Latest Update to Github
|
||||
</h4>
|
||||
<div id="commit"><span id="latestCommitTime">Loading...</span><a id="latestCommitURL"></a>
|
||||
</div>
|
||||
<div id="latestCommitMessage">Loading...
|
||||
</div>
|
||||
<div id="buttons">
|
||||
<div class="btn">
|
||||
<iframe src="http://markdotto.github.com/github-buttons/github-btn.html?user=logicalparadox&repo=chai&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110px" height="20px">
|
||||
</iframe>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<iframe src="http://markdotto.github.com/github-buttons/github-btn.html?user=logicalparadox&repo=chai&type=fork&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110px" height="20px">
|
||||
</iframe>
|
||||
</div>
|
||||
<div class="btn"><a href="htts://twitter.com/share" data-via="jakeluer" data-url="http://chaijs.com" data-related="jakeluer" class="twitter-share-button">Tweet</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div id="links"><a id="repoIssues" href="https://github.com/logicalparadox/chai/issues">GitHub Issues</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<section id="content">
|
||||
<h1>Language Guide
|
||||
</h1>
|
||||
<article>
|
||||
<div class="header">
|
||||
</div>
|
||||
<div class="files">
|
||||
<h3><a href="/code/expect.html">expect / should [bdd]</a>
|
||||
</h3>
|
||||
<p><p>The BDD style allows you to write your assertions in a natural, self-describing manner.</p>
|
||||
|
||||
</p>
|
||||
<h3><a href="/code/assert.html">assert [tdd]</a>
|
||||
</h3>
|
||||
<p><p>The TDD style allows you to write your assertions using the classic 'assert dot' notation.</p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
<footer>
|
||||
<div class="branding">Chai is <a href="http://alogicalparadox.com">a logical paradox</a>. site generated by
|
||||
<a href="http://codexjs.com">codex.</a>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
|
@ -1,256 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Home - Chai
|
||||
</title>
|
||||
<script type="text/javascript">var ghuser = 'logicalparadox'
|
||||
, ghproject = 'chai';
|
||||
|
||||
</script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
|
||||
<script src="/public/js/jq-mousewheel.js"></script>
|
||||
<script src="/public/js/antiscroll.js"></script>
|
||||
<script src="/public/js/prettify.js"></script>
|
||||
<script src="/public/js/main.js"></script>
|
||||
<link rel="stylesheet" href="/public/css/antiscroll.css" type="text/css" media="all">
|
||||
<link rel="stylesheet" href="/public/css/main.css" type="text/css" media="all">
|
||||
<link href="http://fonts.googleapis.com/css?family=Lato:300|Redressed" rel="stylesheet" type="text/css">
|
||||
<script type="text/javascript">var mpq = [];
|
||||
mpq.push(["init", "d5e84615dbd02dbc359b0f76d0ed7cf5"]);
|
||||
(function(){var b,a,e,d,c;b=document.createElement("script");b.type="text/javascript";
|
||||
b.async=true;b.src=(document.location.protocol==="https:"?"https:":"http:")+
|
||||
"//api.mixpanel.com/site_media/js/api/mixpanel.js";a=document.getElementsByTagName("script")[0];
|
||||
a.parentNode.insertBefore(b,a);e=function(f){return function(){mpq.push(
|
||||
[f].concat(Array.prototype.slice.call(arguments,0)))}};d=["init","track","track_links",
|
||||
"track_forms","register","register_once","identify","name_tag","set_config"];for(c=0;c<
|
||||
d.length;c++){mpq[d[c]]=e(d[c])}})();
|
||||
</script>
|
||||
<script type="text/javascript">var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-26183904-6']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<ul class="sections">
|
||||
<li><a href="#installation" class="scroll">Installation</a>
|
||||
</li>
|
||||
<li><a href="#styles" class="scroll">Assertion Styles</a>
|
||||
</li>
|
||||
<li><a href="#plugins" class="scroll">Plugins</a>
|
||||
</li>
|
||||
<li><a href="#help" class="scroll">Getting Help</a>
|
||||
</li>
|
||||
<li><a href="#contributor" class="scroll">Contributing</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="pages">
|
||||
<li><a href="/support/tests/">Test Suite</a>
|
||||
</li>
|
||||
<li><a href="/support/coverage/">Test Coverage</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="code">
|
||||
<li class="header"><a href="/code/">Language Guide</a>
|
||||
</li>
|
||||
<li><a href="/code/expect.html">expect / should [bdd]</a>
|
||||
</li>
|
||||
<li><a href="/code/assert.html">assert [tdd]</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<header>
|
||||
<h1><a href="/"><img src="/public/img/chai-logo.png" title="Chai"></a>
|
||||
</h1>
|
||||
<div class="description"><p>Chai is a BDD / TDD assertion library for <a href="http://nodejs.org">node</a> and the browser that can be delightfully paired with any javascript testing framework.</p>
|
||||
|
||||
</div>
|
||||
<div class="gh">
|
||||
<h4>Latest Update to Github
|
||||
</h4>
|
||||
<div id="commit"><span id="latestCommitTime">Loading...</span><a id="latestCommitURL"></a>
|
||||
</div>
|
||||
<div id="latestCommitMessage">Loading...
|
||||
</div>
|
||||
<div id="buttons">
|
||||
<div class="btn">
|
||||
<iframe src="http://markdotto.github.com/github-buttons/github-btn.html?user=logicalparadox&repo=chai&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110px" height="20px">
|
||||
</iframe>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<iframe src="http://markdotto.github.com/github-buttons/github-btn.html?user=logicalparadox&repo=chai&type=fork&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110px" height="20px">
|
||||
</iframe>
|
||||
</div>
|
||||
<div class="btn"><a href="htts://twitter.com/share" data-via="jakeluer" data-url="http://chaijs.com" data-related="jakeluer" class="twitter-share-button">Tweet</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div id="links"><a id="repoIssues" href="https://github.com/logicalparadox/chai/issues">GitHub Issues</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<section id="content">
|
||||
<article>
|
||||
<h1 id="installation-section"><a name="installation">Installation</a>
|
||||
</h1>
|
||||
<section><p>Chai is available for both node.js and the browser using any
|
||||
test framework you like.
|
||||
|
||||
</p>
|
||||
<h3>Node.js</h3>
|
||||
<p>Package is available through <a href="http://npmjs.org">npm</a>:
|
||||
|
||||
</p>
|
||||
<pre><code>npm install chai</code></pre>
|
||||
<p>Recommend adding it to package.json devDependancies.
|
||||
|
||||
</p>
|
||||
<h3>Browser</h3>
|
||||
<p>Include the chai browser build in your testing suite.
|
||||
|
||||
</p>
|
||||
<pre><code><script src="chai.js" type="text/javascript"></script></code></pre>
|
||||
<p>Currently supports all modern browsers: IE 9+, Chrome 7+, FireFox 4+, Safari 5+.
|
||||
|
||||
</p>
|
||||
<p>Want to know if your browser is compatible? Run the <a href="/support/tests/">online test suite</a>.
|
||||
|
||||
</p>
|
||||
<p>The latest tagged version will also be available for hot-linking at <a href="/chai.js"><a href="http://chaijs.com/chai.js">http://chaijs.com/chai.js</a></a>.
|
||||
</p>
|
||||
|
||||
</section>
|
||||
<h1 id="styles-section"><a name="styles">Assertion Styles</a>
|
||||
</h1>
|
||||
<section><h3>Expect</h3>
|
||||
<p>The <code>expect</code> style is server/browser BDD style assert language.
|
||||
|
||||
</p>
|
||||
<pre><code> <span class="keyword">var</span> expect = <span class="keyword">require</span>(<span class="string">'chai'</span>).expect
|
||||
, foo = <span class="string">'bar'</span>
|
||||
, beverages = { tea: [ <span class="string">'chai'</span>, <span class="string">'matcha'</span>, <span class="string">'oolong'</span> ] };
|
||||
|
||||
expect(foo).to.be.a(<span class="string">'string'</span>);
|
||||
expect(foo).to.equal(<span class="string">'bar'</span>);
|
||||
expect(foo).to.have.length(<span class="number">3</span>);
|
||||
expect(beverages).to.have.property(<span class="string">'tea'</span>).with.length(<span class="number">3</span>);</code></pre>
|
||||
<h3>Should</h3>
|
||||
<p>The <code>should</code> style was inspired by <a href="https://github.com/visionmedia/should.js">should.js</a>
|
||||
and is completely API compatible.
|
||||
|
||||
</p>
|
||||
<pre><code> <span class="keyword">var</span> should = <span class="keyword">require</span>(<span class="string">'chai'</span>).should() <span class="comment">//actually call the the function</span>
|
||||
, foo = <span class="string">'bar'</span>
|
||||
, beverages = { tea: [ <span class="string">'chai'</span>, <span class="string">'matcha'</span>, <span class="string">'oolong'</span> ] };
|
||||
|
||||
foo.should.be.a(<span class="string">'string'</span>);
|
||||
foo.should.equal(<span class="string">'bar'</span>);
|
||||
foo.should.have.length(<span class="number">3</span>);
|
||||
beverages.should.have.property(<span class="string">'tea'</span>).with.length(<span class="number">3</span>);</code></pre>
|
||||
<p>Notice that the <code>expect</code> require is just a reference to the <code>expect</code> function, whereas
|
||||
with the <code>should</code> require, the function is being executed.
|
||||
|
||||
</p>
|
||||
<h3>Assert</h3>
|
||||
<p>The <code>assert</code> style is like the node.js included assert utility with few extras.
|
||||
|
||||
</p>
|
||||
<pre><code> <span class="keyword">var</span> assert = <span class="keyword">require</span>(<span class="string">'chai'</span>).assert
|
||||
, foo = <span class="string">'bar'</span>
|
||||
, beverages = { tea: [ <span class="string">'chai'</span>, <span class="string">'matcha'</span>, <span class="string">'oolong'</span> ] };
|
||||
|
||||
assert.typeOf(foo, <span class="string">'string'</span>, <span class="string">'foo is a string'</span>);
|
||||
assert.equal(foo, <span class="string">'bar'</span>, <span class="string">'foo equal `bar`'</span>);
|
||||
assert.length(foo, <span class="number">3</span>, <span class="string">'foo`s value has a length of 3'</span>);
|
||||
assert.length(beverages.tea, <span class="number">3</span>, <span class="string">'beverages has 3 types of tea'</span>);</code></pre>
|
||||
|
||||
</section>
|
||||
<h1 id="plugins-section"><a name="plugins">Plugins</a>
|
||||
</h1>
|
||||
<section><h3>Available Plugins</h3>
|
||||
<p>The Chai community is growing! Plugins allow developers to expand Chai's available
|
||||
assertions. Here is what the community has come up with so far:
|
||||
|
||||
</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/logicalparadox/chai-spies">chai-spies</a> is a basic spy implementation for chai. It's also
|
||||
a good resource for building chai plugins that work in both node.js and the browser.</li>
|
||||
<li><a href="https://github.com/jfirebaugh/chai-jquery">chai-jquery</a> by <a href="https://github.com/jfirebaugh">@jfirebaugh</a>
|
||||
provides deep jQuery integration with chai <code>should</code> and <code>expect</code>.</li>
|
||||
<li><a href="https://github.com/vesln/jack">jack</a> by <a href="https://github.com/vesln">@vesln</a> is a mock/stub library that
|
||||
can be used as a stand-alone or with chai.</li>
|
||||
<li><a href="https://github.com/domenic/sinon-chai">sinon-chai</a> by <a href="https://github.com/domenic">@domenic</a> extends chai with
|
||||
assertions for the Sinon.js mocking framework.</li>
|
||||
</ul>
|
||||
|
||||
</section>
|
||||
<h1 id="help-section"><a name="help">Getting Help</a>
|
||||
</h1>
|
||||
<section><p>If you have questions or issues, please use this projects
|
||||
<a href="https://github.com/logicalparadox/chai/issues">Github Issues</a>. You can also keep up to date
|
||||
on the <a href="http://groups.google.com/group/chaijs">Google Group</a> or ping <a href="http://twitter.com/jakeluer">@jakeluer</a>
|
||||
directly on Twitter. Chai developers can also be found on Freenode IRC in #letstest.js.
|
||||
</p>
|
||||
|
||||
</section>
|
||||
<h1 id="contributor-section"><a name="contributor">Contributing</a>
|
||||
</h1>
|
||||
<section><h3>Developing</h3>
|
||||
<p>Please avoid making changes to the browser versions of chai if you are developing in the browser. All
|
||||
changes to the library are to be made to <code>lib/*</code> and then packaged for the browser using the <code>make</code>
|
||||
command.
|
||||
|
||||
</p>
|
||||
<h3>Testing</h3>
|
||||
<p>Tests are written in <code>exports</code> style on <a href="http://visionmedia.github.com/mocha/">mocha test framework</a>.
|
||||
There is a test file for each of the interfaces. The tests for <code>expect</code> and <code>assert</code> must pass in node.js
|
||||
and in the browser, whereas the should tests only need to pass on node.js.
|
||||
|
||||
</p>
|
||||
<p>Browsers tests are currently known to pass in Chrome 16 and Firefox 8. Please let me know if you can test
|
||||
in other browsers or other version.
|
||||
|
||||
</p>
|
||||
<h4>Server Side Testing</h4>
|
||||
<p>It's quite simple...
|
||||
|
||||
</p>
|
||||
<pre><code> make test</code></pre>
|
||||
<h4>Browser Side Testing</h4>
|
||||
<p>It's also quite simple. Open up <code>test/browser/index.html</code> in your nearest browser.
|
||||
|
||||
|
||||
</p>
|
||||
<h3>Building</h3>
|
||||
<p>If you have made changes to any of the components, you must rebuild the browser package.
|
||||
|
||||
</p>
|
||||
<pre><code> $ make</code></pre>
|
||||
<h3>Contributors</h3>
|
||||
<pre><code> commits: 252
|
||||
files : 71
|
||||
authors:
|
||||
192 Jake Luer 76.2%
|
||||
53 Veselin Todorov 21.0%
|
||||
3 Jeff Barczewski 1.2%
|
||||
1 Vinay Pulim 0.4%
|
||||
1 Jo Liss 0.4%
|
||||
1 Domenic Denicola 0.4%
|
||||
1 John Firebaugh 0.4%</code></pre>
|
||||
|
||||
</section>
|
||||
</article>
|
||||
</section>
|
||||
<footer>
|
||||
<div class="branding">Chai is <a href="http://alogicalparadox.com">a logical paradox</a>. site generated by
|
||||
<a href="http://codexjs.com">codex.</a>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
|
@ -1,47 +0,0 @@
|
|||
.antiscroll-wrap {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.antiscroll-scrollbar {
|
||||
background: #666;
|
||||
background: rgba(0, 0, 0, .6);
|
||||
-webkit-border-radius: 7px;
|
||||
-moz-border-radius: 7px;
|
||||
border-radius: 7px;
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
|
||||
-webkit-transition: linear 300ms opacity;
|
||||
-moz-transition: linear 300ms opacity;
|
||||
-o-transition: linear 300ms opacity;
|
||||
}
|
||||
|
||||
.antiscroll-scrollbar-shown {
|
||||
opacity: 1;
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
|
||||
}
|
||||
|
||||
.antiscroll-scrollbar-horizontal {
|
||||
height: 7px;
|
||||
margin-left: 2px;
|
||||
bottom: 2px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.antiscroll-scrollbar-vertical {
|
||||
width: 7px;
|
||||
margin-top: 2px;
|
||||
right: 2px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.antiscroll-inner {
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.antiscroll-inner::-webkit-scrollbar, .antiscroll-inner::scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
|
@ -1,673 +0,0 @@
|
|||
html,
|
||||
body,
|
||||
div,
|
||||
span,
|
||||
applet,
|
||||
object,
|
||||
iframe,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
p,
|
||||
blockquote,
|
||||
pre,
|
||||
a,
|
||||
abbr,
|
||||
acronym,
|
||||
address,
|
||||
big,
|
||||
cite,
|
||||
code,
|
||||
del,
|
||||
dfn,
|
||||
em,
|
||||
img,
|
||||
ins,
|
||||
kbd,
|
||||
q,
|
||||
s,
|
||||
samp,
|
||||
small,
|
||||
strike,
|
||||
strong,
|
||||
sub,
|
||||
sup,
|
||||
tt,
|
||||
var,
|
||||
dl,
|
||||
dt,
|
||||
dd,
|
||||
ol,
|
||||
ul,
|
||||
li,
|
||||
fieldset,
|
||||
form,
|
||||
label,
|
||||
legend,
|
||||
table,
|
||||
caption,
|
||||
tbody,
|
||||
tfoot,
|
||||
thead,
|
||||
tr,
|
||||
th,
|
||||
td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
font-weight: inherit;
|
||||
font-style: inherit;
|
||||
font-family: inherit;
|
||||
font-size: 100%;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
body {
|
||||
line-height: 1;
|
||||
color: #000;
|
||||
background: #fff;
|
||||
}
|
||||
ol,
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
table {
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
caption,
|
||||
th,
|
||||
td {
|
||||
text-align: left;
|
||||
font-weight: normal;
|
||||
vertical-align: middle;
|
||||
}
|
||||
a img {
|
||||
border: none;
|
||||
}
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin-bottom: 0.75em;
|
||||
line-height: 1.5;
|
||||
}
|
||||
h2 {
|
||||
font-size: 1.5em;
|
||||
margin-bottom: 0.75em;
|
||||
line-height: 1;
|
||||
}
|
||||
h3 {
|
||||
font-size: 1.25em;
|
||||
margin-bottom: 1em;
|
||||
line-height: 1.2;
|
||||
}
|
||||
h4 {
|
||||
font-size: 1.125em;
|
||||
margin-bottom: 1.33em;
|
||||
line-height: 1.33;
|
||||
}
|
||||
h5 {
|
||||
font-weight: bold;
|
||||
}
|
||||
h5,
|
||||
h6 {
|
||||
font-size: 1em;
|
||||
margin-bottom: 1.5em;
|
||||
line-height: 1.5;
|
||||
}
|
||||
p,
|
||||
address {
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
article ul {
|
||||
list-style: disc;
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
article ul li {
|
||||
margin-left: 1.5em;
|
||||
}
|
||||
code {
|
||||
font-family: "Bitstream Vera Sans Mono", "Courier", monospace;
|
||||
}
|
||||
body {
|
||||
font: 13px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
background-color: #fcfaf4;
|
||||
}
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4 {
|
||||
font-family: "Redressed", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
a {
|
||||
color: #a32931;
|
||||
text-decoration: none;
|
||||
}
|
||||
h1 {
|
||||
color: #784942;
|
||||
font-size: 3em;
|
||||
}
|
||||
h1 > a {
|
||||
color: #784942;
|
||||
}
|
||||
h3 {
|
||||
color: #9e7522;
|
||||
font-size: 2em;
|
||||
margin-top: 1em;
|
||||
zoom: 1;
|
||||
}
|
||||
h3:before,
|
||||
h3:after {
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
h3:after {
|
||||
clear: both;
|
||||
}
|
||||
h3 > a {
|
||||
color: #9e7522;
|
||||
}
|
||||
h4 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
pre {
|
||||
background: #fff;
|
||||
}
|
||||
em {
|
||||
font-style: italic;
|
||||
font-weight: bold;
|
||||
}
|
||||
header,
|
||||
section#content,
|
||||
footer {
|
||||
width: 740px;
|
||||
margin-left: 220px;
|
||||
}
|
||||
.box-wrap {
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
.box,
|
||||
.box .antiscroll-inner {
|
||||
max-height: 340px;
|
||||
width: 140px;
|
||||
}
|
||||
header {
|
||||
zoom: 1;
|
||||
margin-top: 50px;
|
||||
}
|
||||
header:before,
|
||||
header:after {
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
header:after {
|
||||
clear: both;
|
||||
}
|
||||
header h1 {
|
||||
font-size: 65px;
|
||||
}
|
||||
header h1 a {
|
||||
display: block;
|
||||
width: 193px;
|
||||
height: 217px;
|
||||
margin: 0px auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
header .description {
|
||||
color: #666;
|
||||
margin-bottom: 1.2em;
|
||||
font-size: 22px;
|
||||
font-family: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
header .gh {
|
||||
zoom: 1;
|
||||
background: #faf4e8;
|
||||
border: 1px solid #e9ce99;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
padding: 10px;
|
||||
position: relative;
|
||||
min-height: 90px;
|
||||
}
|
||||
header .gh:before,
|
||||
header .gh:after {
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
header .gh:after {
|
||||
clear: both;
|
||||
}
|
||||
header .gh h4 {
|
||||
text-shadow: 1px 1px 0px #fff;
|
||||
margin-bottom: 10px;
|
||||
color: #666;
|
||||
}
|
||||
header .gh h4 #latestCommitURL {
|
||||
font-size: 11px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
header .gh #commit {
|
||||
font-size: 10px;
|
||||
margin-right: 10px;
|
||||
line-height: 18px;
|
||||
padding: 0px 5px;
|
||||
background: #fefcf8;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
float: left;
|
||||
color: #e0bb71;
|
||||
}
|
||||
header .gh #commit a {
|
||||
color: #e0bb71;
|
||||
font-style: italic;
|
||||
}
|
||||
header .gh #latestCommitMessage {
|
||||
line-height: 20px;
|
||||
text-shadow: 1px 1px 0px #fff;
|
||||
}
|
||||
header .gh #buttons {
|
||||
margin-top: 10px;
|
||||
zoom: 1;
|
||||
}
|
||||
header .gh #buttons:before,
|
||||
header .gh #buttons:after {
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
header .gh #buttons:after {
|
||||
clear: both;
|
||||
}
|
||||
header .gh #buttons .btn {
|
||||
float: left;
|
||||
}
|
||||
header .gh #clone {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
left: 10px;
|
||||
}
|
||||
header .gh #clone .fork {
|
||||
display: inline-block;
|
||||
padding: 0.5em 1em;
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #a02830), color-stop(1, #93252c));
|
||||
background: -webkit-linear-gradient(top, #a02830 0%, #93252c 100%);
|
||||
background: -moz-linear-gradient(top, #a02830 0%, #93252c 100%);
|
||||
background: linear-gradient(top, #a02830 0%, #93252c 100%);
|
||||
border: 1px solid #7a1f25;
|
||||
font: 11px/normal helvetica, arial, freesans, clean, sans-serif;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
text-shadow: 1px 1px 0px #bb2f38;
|
||||
font-weight: bold;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
float: left;
|
||||
display: inline-block;
|
||||
}
|
||||
header .gh #clone .fork:hover {
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #eb3b00), color-stop(1, #c30));
|
||||
background: -webkit-linear-gradient(top, #eb3b00 0%, #c30 100%);
|
||||
background: -moz-linear-gradient(top, #eb3b00 0%, #c30 100%);
|
||||
background: linear-gradient(top, #eb3b00 0%, #c30 100%);
|
||||
color: #fff;
|
||||
text-shadow: -1px -1px 0px #992600;
|
||||
border: 1px solid #ad2b00;
|
||||
}
|
||||
header .gh #clone .clone {
|
||||
color: #666;
|
||||
float: left;
|
||||
display: inline-block;
|
||||
margin-left: 15px;
|
||||
background: #f7e6be;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
padding: 0px 15px;
|
||||
font: 11px "Bitstream Vera Sans Mono", "Courier", monospace;
|
||||
line-height: 25px;
|
||||
max-width: 545px;
|
||||
overflow: hidden;
|
||||
}
|
||||
header .gh #links {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
font-size: 11px;
|
||||
line-height: 18px;
|
||||
}
|
||||
header .gh #links a {
|
||||
color: #a32931;
|
||||
padding: 0px 10px;
|
||||
}
|
||||
header .gh #links a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
section#content {
|
||||
margin-top: 50px;
|
||||
margin-bottom: 50px;
|
||||
min-height: 350px;
|
||||
}
|
||||
section#content h1 {
|
||||
padding-top: 10px;
|
||||
margin-top: 85px;
|
||||
}
|
||||
section#content h2 {
|
||||
padding-top: 15px;
|
||||
margin-top: 25px;
|
||||
}
|
||||
section#content p code {
|
||||
padding: 3px 5px;
|
||||
background: #f6ebd4;
|
||||
}
|
||||
nav {
|
||||
position: fixed;
|
||||
top: 65px;
|
||||
left: 30px;
|
||||
width: 140px;
|
||||
}
|
||||
nav ul {
|
||||
list-style: none;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
nav ul li {
|
||||
margin-left: 0px;
|
||||
margin-right: 12px;
|
||||
text-align: right;
|
||||
}
|
||||
nav ul li.keepcase a {
|
||||
text-transform: none !important;
|
||||
}
|
||||
nav ul li.header {
|
||||
font-weight: bold;
|
||||
}
|
||||
nav ul li a {
|
||||
color: #666;
|
||||
font-family: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
text-transform: lowercase;
|
||||
}
|
||||
nav ul li a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
footer {
|
||||
margin-top: 100px;
|
||||
padding-top: 25px;
|
||||
margin-bottom: 50px;
|
||||
border-top: 1px solid #9e7522;
|
||||
color: #808080;
|
||||
text-transform: lowercase;
|
||||
}
|
||||
pre {
|
||||
padding: 15px;
|
||||
margin: 15px;
|
||||
border: 1px solid #e6e6e6;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.code-wrap {
|
||||
zoom: 1;
|
||||
}
|
||||
.code-wrap ::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
.code-wrap ::-webkit-scrollbar-button:vertical {
|
||||
border-width: 0px;
|
||||
}
|
||||
.code-wrap ::-webkit-scrollbar-button:start:decrement,
|
||||
.code-wrap ::-webkit-scrollbar-button:end:increment {
|
||||
display: none;
|
||||
}
|
||||
.code-wrap ::-webkit-scrollbar-button:vertical:start:increment,
|
||||
.code-wrap ::-webkit-scrollbar-button:vertical:end:decrement {
|
||||
display: none;
|
||||
}
|
||||
.code-wrap ::-webkit-scrollbar-button:vertical:increment {
|
||||
border-width: 0px;
|
||||
}
|
||||
.code-wrap ::-webkit-scrollbar-button:vertical:decrement {
|
||||
border-width: 0px;
|
||||
}
|
||||
.code-wrap ::-webkit-scrollbar-track:vertical {
|
||||
border-width: 0px;
|
||||
}
|
||||
.code-wrap ::-webkit-scrollbar-track-piece:vertical:start {
|
||||
border-width: 0px;
|
||||
}
|
||||
.code-wrap ::-webkit-scrollbar-track-piece:vertical:end {
|
||||
border-width: 0px;
|
||||
}
|
||||
.code-wrap ::-webkit-scrollbar-track-piece {
|
||||
display: none;
|
||||
}
|
||||
.code-wrap ::-webkit-scrollbar-thumb:vertical {
|
||||
height: 50px;
|
||||
background-color: #e6e6e6;
|
||||
-webkit-border-radius: 8px;
|
||||
-moz-border-radius: 8px;
|
||||
-webkit-border-radius: 8px;
|
||||
-moz-border-radius: 8px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.code-wrap ::-webkit-scrollbar-corner:vertical {
|
||||
display: none;
|
||||
}
|
||||
.code-wrap ::-webkit-scrollbar-resizer:vertical {
|
||||
display: none;
|
||||
}
|
||||
.code-wrap:before,
|
||||
.code-wrap:after {
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
.code-wrap:after {
|
||||
clear: both;
|
||||
}
|
||||
pre.source {
|
||||
max-height: 350px;
|
||||
overflow-y: auto;
|
||||
font-size: 11px;
|
||||
border: 1px solid #a32931;
|
||||
}
|
||||
.codeblock {
|
||||
position: relative;
|
||||
border-top: 1px dotted #e9ce99;
|
||||
margin-top: 85px;
|
||||
}
|
||||
.codeblock h1 {
|
||||
color: #a32931;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
.codeblock code {
|
||||
padding: 3px 5px;
|
||||
background: #f6ebd4;
|
||||
}
|
||||
.ctx h3 {
|
||||
color: #e9ce99;
|
||||
}
|
||||
.tags {
|
||||
padding: 15px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.tags span {
|
||||
margin-right: 3px;
|
||||
}
|
||||
.tags span.type {
|
||||
font-weight: bold;
|
||||
}
|
||||
.tags span.types {
|
||||
font-style: italic;
|
||||
}
|
||||
.view-source {
|
||||
display: inline-block;
|
||||
padding: 0.5em 1em;
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #555438), color-stop(1, #4e4d33));
|
||||
background: -webkit-linear-gradient(top, #555438 0%, #4e4d33 100%);
|
||||
background: -moz-linear-gradient(top, #555438 0%, #4e4d33 100%);
|
||||
background: linear-gradient(top, #555438 0%, #4e4d33 100%);
|
||||
border: 1px solid #41412b;
|
||||
font: 11px/normal helvetica, arial, freesans, clean, sans-serif;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
text-shadow: 1px 1px 0px #6d6c47;
|
||||
font-weight: bold;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
right: 0px;
|
||||
}
|
||||
.view-source:hover {
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #3c7ec0), color-stop(1, #3570aa));
|
||||
background: -webkit-linear-gradient(top, #3c7ec0 0%, #3570aa 100%);
|
||||
background: -moz-linear-gradient(top, #3c7ec0 0%, #3570aa 100%);
|
||||
background: linear-gradient(top, #3c7ec0 0%, #3570aa 100%);
|
||||
color: #fff;
|
||||
text-shadow: -1px -1px 0px #285480;
|
||||
border: 1px solid #2d5f91;
|
||||
}
|
||||
pre .str,
|
||||
code .str {
|
||||
color: #65b042;
|
||||
/* string - green */
|
||||
}
|
||||
pre .kwd,
|
||||
code .kwd {
|
||||
color: #e28964;
|
||||
/* keyword - dark pink */
|
||||
}
|
||||
pre .com,
|
||||
code .com {
|
||||
color: #aeaeae;
|
||||
font-style: italic;
|
||||
/* comment - gray */
|
||||
}
|
||||
pre .typ,
|
||||
code .typ {
|
||||
color: #89bdff;
|
||||
/* type - light blue */
|
||||
}
|
||||
pre .lit,
|
||||
code .lit {
|
||||
color: #3387cc;
|
||||
/* literal - blue */
|
||||
}
|
||||
pre .pun,
|
||||
code .pun {
|
||||
color: #000;
|
||||
/* punctuation - white */
|
||||
}
|
||||
pre .pln,
|
||||
code .pln {
|
||||
color: #000;
|
||||
/* plaintext - white */
|
||||
}
|
||||
pre .tag,
|
||||
code .tag {
|
||||
color: #89bdff;
|
||||
/* html/xml tag - light blue */
|
||||
}
|
||||
pre .atn,
|
||||
code .atn {
|
||||
color: #bdb76b;
|
||||
/* html/xml attribute name - khaki */
|
||||
}
|
||||
pre .atv,
|
||||
code .atv {
|
||||
color: #65b042;
|
||||
/* html/xml attribute value - green */
|
||||
}
|
||||
pre .dec,
|
||||
code .dec {
|
||||
color: #3387cc;
|
||||
/* decimal - blue */
|
||||
}
|
||||
pre.prettyprint,
|
||||
code.prettyprint {
|
||||
background-color: #fff;
|
||||
}
|
||||
pre.prettyprint {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
ol.linenums {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
color: #aeaeae;
|
||||
/* IE indents via margin-left */
|
||||
}
|
||||
li.L0,
|
||||
li.L1,
|
||||
li.L2,
|
||||
li.L3,
|
||||
li.L4,
|
||||
li.L5,
|
||||
li.L6,
|
||||
li.L7,
|
||||
li.L8,
|
||||
li.L9 {
|
||||
list-style-type: none;
|
||||
}
|
||||
li.L1,
|
||||
li.L3,
|
||||
li.L5,
|
||||
li.L7,
|
||||
li.L9 {
|
||||
background-color: #fff;
|
||||
}
|
||||
@media print {
|
||||
pre .str,
|
||||
code .str {
|
||||
color: #060;
|
||||
}
|
||||
pre .kwd,
|
||||
code .kwd {
|
||||
color: #006;
|
||||
font-weight: bold;
|
||||
}
|
||||
pre .com,
|
||||
code .com {
|
||||
color: #600;
|
||||
font-style: italic;
|
||||
}
|
||||
pre .typ,
|
||||
code .typ {
|
||||
color: #404;
|
||||
font-weight: bold;
|
||||
}
|
||||
pre .lit,
|
||||
code .lit {
|
||||
color: #044;
|
||||
}
|
||||
pre .pun,
|
||||
code .pun {
|
||||
color: #440;
|
||||
}
|
||||
pre .pln,
|
||||
code .pln {
|
||||
color: #000;
|
||||
}
|
||||
pre .tag,
|
||||
code .tag {
|
||||
color: #006;
|
||||
font-weight: bold;
|
||||
}
|
||||
pre .atn,
|
||||
code .atn {
|
||||
color: #404;
|
||||
}
|
||||
pre .atv,
|
||||
code .atv {
|
||||
color: #060;
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 27 KiB |
|
@ -1,403 +0,0 @@
|
|||
|
||||
(function ($) {
|
||||
|
||||
/**
|
||||
* Augment jQuery prototype.
|
||||
*/
|
||||
|
||||
$.fn.antiscroll = function (options) {
|
||||
return this.each(function () {
|
||||
if ($(this).data('antiscroll')) {
|
||||
$(this).data('antiscroll').destroy();
|
||||
}
|
||||
|
||||
$(this).data('antiscroll', new $.Antiscroll(this, options));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose constructor.
|
||||
*/
|
||||
|
||||
$.Antiscroll = Antiscroll;
|
||||
|
||||
/**
|
||||
* Antiscroll pane constructor.
|
||||
*
|
||||
* @param {Element|jQuery} main pane
|
||||
* @parma {Object} options
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Antiscroll (el, opts) {
|
||||
this.el = $(el);
|
||||
this.options = opts || {};
|
||||
this.padding = undefined == this.options.padding ? 2 : this.options.padding;
|
||||
this.inner = this.el.find('.antiscroll-inner');
|
||||
this.inner.css({
|
||||
'width': '+=' + scrollbarSize()
|
||||
, 'height': '+=' + scrollbarSize()
|
||||
});
|
||||
|
||||
if (this.inner.get(0).scrollWidth > this.el.width()) {
|
||||
this.horizontal = new Scrollbar.Horizontal(this);
|
||||
}
|
||||
|
||||
if (this.inner.get(0).scrollHeight > this.el.height()) {
|
||||
this.vertical = new Scrollbar.Vertical(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up.
|
||||
*
|
||||
* @return {Antiscroll} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Antiscroll.prototype.destroy = function () {
|
||||
if (this.horizontal) {
|
||||
this.horizontal.destroy();
|
||||
}
|
||||
if (this.vertical) {
|
||||
this.vertical.destroy();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scrolbar constructor.
|
||||
*
|
||||
* @param {Element|jQuery} element
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Scrollbar (pane) {
|
||||
this.pane = pane;
|
||||
this.pane.el.append(this.el);
|
||||
this.innerEl = this.pane.inner.get(0);
|
||||
|
||||
this.dragging = false;
|
||||
this.enter = false;
|
||||
this.shown = false;
|
||||
|
||||
// hovering
|
||||
this.pane.el.mouseenter($.proxy(this, 'mouseenter'));
|
||||
this.pane.el.mouseleave($.proxy(this, 'mouseleave'));
|
||||
|
||||
// dragging
|
||||
this.el.mousedown($.proxy(this, 'mousedown'));
|
||||
|
||||
// scrolling
|
||||
this.pane.inner.scroll($.proxy(this, 'scroll'));
|
||||
|
||||
// wheel -optional-
|
||||
this.pane.inner.bind('mousewheel', $.proxy(this, 'mousewheel'));
|
||||
|
||||
// show
|
||||
var initialDisplay = this.pane.options.initialDisplay;
|
||||
|
||||
if (initialDisplay !== false) {
|
||||
this.show();
|
||||
this.hiding = setTimeout($.proxy(this, 'hide'), parseInt(initialDisplay, 10) || 3000);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Cleans up.
|
||||
*
|
||||
* @return {Scrollbar} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.destroy = function () {
|
||||
this.el.remove();
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon mouseenter.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.mouseenter = function () {
|
||||
this.enter = true;
|
||||
this.show();
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon mouseleave.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.mouseleave = function () {
|
||||
this.enter = false;
|
||||
|
||||
if (!this.dragging) {
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called upon wrap scroll.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.scroll = function () {
|
||||
if (!this.shown) {
|
||||
this.show();
|
||||
if (!this.enter && !this.dragging) {
|
||||
this.hiding = setTimeout($.proxy(this, 'hide'), 1500);
|
||||
}
|
||||
}
|
||||
|
||||
this.update();
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon scrollbar mousedown.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.mousedown = function (ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
this.dragging = true;
|
||||
|
||||
this.startPageY = ev.pageY - parseInt(this.el.css('top'), 10);
|
||||
this.startPageX = ev.pageX - parseInt(this.el.css('left'), 10);
|
||||
|
||||
// prevent crazy selections on IE
|
||||
document.onselectstart = function () { return false; };
|
||||
|
||||
var pane = this.pane
|
||||
, move = $.proxy(this, 'mousemove')
|
||||
, self = this
|
||||
|
||||
$(document)
|
||||
.mousemove(move)
|
||||
.mouseup(function () {
|
||||
self.dragging = false;
|
||||
document.onselectstart = null;
|
||||
|
||||
$(document).unbind('mousemove', move);
|
||||
|
||||
if (!self.enter) {
|
||||
self.hide();
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
/**
|
||||
* Show scrollbar.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.show = function (duration) {
|
||||
if (!this.shown) {
|
||||
this.update();
|
||||
this.el.addClass('antiscroll-scrollbar-shown');
|
||||
if (this.hiding) {
|
||||
clearTimeout(this.hiding);
|
||||
this.hiding = null;
|
||||
}
|
||||
this.shown = true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Hide scrollbar.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.hide = function () {
|
||||
if (this.shown) {
|
||||
// check for dragging
|
||||
this.el.removeClass('antiscroll-scrollbar-shown');
|
||||
this.shown = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Horizontal scrollbar constructor
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Horizontal = function (pane) {
|
||||
this.el = $('<div class="antiscroll-scrollbar antiscroll-scrollbar-horizontal">');
|
||||
Scrollbar.call(this, pane);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherits from Scrollbar.
|
||||
*/
|
||||
|
||||
inherits(Scrollbar.Horizontal, Scrollbar);
|
||||
|
||||
/**
|
||||
* Updates size/position of scrollbar.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Horizontal.prototype.update = function () {
|
||||
var paneWidth = this.pane.el.width()
|
||||
, trackWidth = paneWidth - this.pane.padding * 2
|
||||
, innerEl = this.pane.inner.get(0)
|
||||
|
||||
this.el
|
||||
.css('width', trackWidth * paneWidth / innerEl.scrollWidth)
|
||||
.css('left', trackWidth * innerEl.scrollLeft / innerEl.scrollWidth)
|
||||
}
|
||||
|
||||
/**
|
||||
* Called upon drag.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Horizontal.prototype.mousemove = function (ev) {
|
||||
var trackWidth = this.pane.el.width() - this.pane.padding * 2
|
||||
, pos = ev.pageX - this.startPageX
|
||||
, barWidth = this.el.width()
|
||||
, innerEl = this.pane.inner.get(0)
|
||||
|
||||
// minimum top is 0, maximum is the track height
|
||||
var y = Math.min(Math.max(pos, 0), trackWidth - barWidth)
|
||||
|
||||
innerEl.scrollLeft = (innerEl.scrollWidth - this.pane.el.width())
|
||||
* y / (trackWidth - barWidth)
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon container mousewheel.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Horizontal.prototype.mousewheel = function (ev, delta, x, y) {
|
||||
if ((x < 0 && 0 == this.pane.inner.get(0).scrollLeft) ||
|
||||
(x > 0 && (this.innerEl.scrollLeft + this.pane.el.width()
|
||||
== this.innerEl.scrollWidth))) {
|
||||
ev.preventDefault();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Vertical scrollbar constructor
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Vertical = function (pane) {
|
||||
this.el = $('<div class="antiscroll-scrollbar antiscroll-scrollbar-vertical">');
|
||||
Scrollbar.call(this, pane);
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherits from Scrollbar.
|
||||
*/
|
||||
|
||||
inherits(Scrollbar.Vertical, Scrollbar);
|
||||
|
||||
/**
|
||||
* Updates size/position of scrollbar.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Vertical.prototype.update = function () {
|
||||
var paneHeight = this.pane.el.height()
|
||||
, trackHeight = paneHeight - this.pane.padding * 2
|
||||
, innerEl = this.innerEl
|
||||
|
||||
this.el
|
||||
.css('height', trackHeight * paneHeight / innerEl.scrollHeight)
|
||||
.css('top', trackHeight * innerEl.scrollTop / innerEl.scrollHeight)
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon drag.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Vertical.prototype.mousemove = function (ev) {
|
||||
var paneHeight = this.pane.el.height()
|
||||
, trackHeight = paneHeight - this.pane.padding * 2
|
||||
, pos = ev.pageY - this.startPageY
|
||||
, barHeight = this.el.height()
|
||||
, innerEl = this.innerEl
|
||||
|
||||
// minimum top is 0, maximum is the track height
|
||||
var y = Math.min(Math.max(pos, 0), trackHeight - barHeight)
|
||||
|
||||
innerEl.scrollTop = (innerEl.scrollHeight - paneHeight)
|
||||
* y / (trackHeight - barHeight)
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon container mousewheel.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Vertical.prototype.mousewheel = function (ev, delta, x, y) {
|
||||
if ((y > 0 && 0 == this.innerEl.scrollTop) ||
|
||||
(y < 0 && (this.innerEl.scrollTop + this.pane.el.height()
|
||||
== this.innerEl.scrollHeight))) {
|
||||
ev.preventDefault();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Cross-browser inheritance.
|
||||
*
|
||||
* @param {Function} constructor
|
||||
* @param {Function} constructor we inherit from
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function inherits (ctorA, ctorB) {
|
||||
function f() {};
|
||||
f.prototype = ctorB.prototype;
|
||||
ctorA.prototype = new f;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scrollbar size detection.
|
||||
*/
|
||||
|
||||
var size;
|
||||
|
||||
function scrollbarSize () {
|
||||
if (!size) {
|
||||
var div = $(
|
||||
'<div style="width:50px;height:50px;overflow:hidden;'
|
||||
+ 'position:absolute;top:-200px;left:-200px;"><div style="height:100px;">'
|
||||
+ '</div>'
|
||||
);
|
||||
|
||||
$('body').append(div);
|
||||
|
||||
var w1 = $('div', div).innerWidth();
|
||||
div.css('overflow-y', 'scroll');
|
||||
var w2 = $('div', div).innerWidth();
|
||||
$(div).remove();
|
||||
|
||||
size = w1 - w2;
|
||||
}
|
||||
|
||||
return size;
|
||||
};
|
||||
|
||||
})(jQuery);
|
|
@ -1,78 +0,0 @@
|
|||
/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
|
||||
* Licensed under the MIT License (LICENSE.txt).
|
||||
*
|
||||
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
|
||||
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
|
||||
* Thanks to: Seamus Leahy for adding deltaX and deltaY
|
||||
*
|
||||
* Version: 3.0.4
|
||||
*
|
||||
* Requires: 1.2.2+
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
var types = ['DOMMouseScroll', 'mousewheel'];
|
||||
|
||||
$.event.special.mousewheel = {
|
||||
setup: function() {
|
||||
if ( this.addEventListener ) {
|
||||
for ( var i=types.length; i; ) {
|
||||
this.addEventListener( types[--i], handler, false );
|
||||
}
|
||||
} else {
|
||||
this.onmousewheel = handler;
|
||||
}
|
||||
},
|
||||
|
||||
teardown: function() {
|
||||
if ( this.removeEventListener ) {
|
||||
for ( var i=types.length; i; ) {
|
||||
this.removeEventListener( types[--i], handler, false );
|
||||
}
|
||||
} else {
|
||||
this.onmousewheel = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
mousewheel: function(fn) {
|
||||
return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
|
||||
},
|
||||
|
||||
unmousewheel: function(fn) {
|
||||
return this.unbind("mousewheel", fn);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function handler(event) {
|
||||
var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
|
||||
event = $.event.fix(orgEvent);
|
||||
event.type = "mousewheel";
|
||||
|
||||
// Old school scrollwheel delta
|
||||
if ( event.wheelDelta ) { delta = event.wheelDelta/120; }
|
||||
if ( event.detail ) { delta = -event.detail/3; }
|
||||
|
||||
// New school multidimensional scroll (touchpads) deltas
|
||||
deltaY = delta;
|
||||
|
||||
// Gecko
|
||||
if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
|
||||
deltaY = 0;
|
||||
deltaX = -1*delta;
|
||||
}
|
||||
|
||||
// Webkit
|
||||
if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
|
||||
if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
|
||||
|
||||
// Add event and delta to the front of the arguments
|
||||
args.unshift(event, delta, deltaX, deltaY);
|
||||
|
||||
return $.event.handle.apply(this, args);
|
||||
}
|
||||
|
||||
})(jQuery);
|
|
@ -1,81 +0,0 @@
|
|||
$(function () {
|
||||
|
||||
$.ajax({
|
||||
url: "http://github.com/api/v2/json/commits/list/" + ghuser + "/" + ghproject + "/master",
|
||||
dataType: 'jsonp',
|
||||
success: function(json) {
|
||||
var latest = json.commits[0],
|
||||
stamp = new Date(latest.committed_date),
|
||||
stampString = month[stamp.getMonth()] + ' ' + stamp.getDate() + ', ' + stamp.getFullYear();
|
||||
|
||||
$('#latestCommitMessage').text(latest.message);
|
||||
$('#latestCommitTime').text(stampString);
|
||||
$('#latestCommitURL').html(' - commit ' + latest.id.substring(0, 6));
|
||||
$('#latestCommitURL').attr('href', "https://github.com" + latest.url);
|
||||
}
|
||||
});
|
||||
|
||||
var month = new Array(12);
|
||||
month[0] = "Jan";
|
||||
month[1] = "Feb";
|
||||
month[2] = "Mar";
|
||||
month[3] = "Apr";
|
||||
month[4] = "May";
|
||||
month[5] = "Jun";
|
||||
month[6] = "Jul";
|
||||
month[7] = "Aug";
|
||||
month[8] = "Sep";
|
||||
month[9] = "Oct";
|
||||
month[10] = "Nov";
|
||||
month[11] = "Dec";
|
||||
|
||||
|
||||
$(function () {
|
||||
$('.box-wrap').antiscroll();
|
||||
});
|
||||
|
||||
$('pre code').addClass('prettyprint');
|
||||
prettyPrint();
|
||||
|
||||
$('a.scroll').click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var section = $(this).attr('href')
|
||||
, $scrollto = $(section + '-section');
|
||||
|
||||
$('html,body').animate({
|
||||
scrollTop: $scrollto.offset().top
|
||||
});
|
||||
});
|
||||
|
||||
$('.view-source').click(function(){
|
||||
var $obj = $(this).next('.code-wrap')
|
||||
, will = ($obj.css('display') == 'none') ? true : false;
|
||||
|
||||
$obj.toggle(200);
|
||||
|
||||
if (will) {
|
||||
$('html,body').animate({
|
||||
scrollTop: $obj.offset().top
|
||||
});
|
||||
}
|
||||
|
||||
var tag = $(this).siblings('.header').find('h1').text()
|
||||
, action = (will) ? 'opened' : 'closed'
|
||||
, note = 'User ' + action + ' ' + tag + '.';
|
||||
|
||||
mpq.track('View Source clicked', {
|
||||
'tag': tag,
|
||||
'action': action,
|
||||
'mp_note': note
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('a.button.github').click(function () {
|
||||
mpq.track('Github Fork clicked');
|
||||
});
|
||||
|
||||
$('.code-wrap').hide();
|
||||
});
|
|
@ -1,28 +0,0 @@
|
|||
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
|
||||
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
|
||||
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
|
||||
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
|
||||
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
|
||||
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
|
||||
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
|
||||
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
|
||||
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
|
||||
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
|
||||
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
|
||||
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
|
||||
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
|
||||
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
|
||||
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
|
||||
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
|
||||
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
|
||||
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
|
||||
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
|
||||
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
|
||||
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
|
||||
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
|
||||
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
|
||||
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
|
||||
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
|
||||
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
|
||||
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();
|
File diff suppressed because one or more lines are too long
|
@ -1,325 +0,0 @@
|
|||
|
||||
/*!
|
||||
* Module dependencies.
|
||||
*
|
||||
* Chai is automatically included in the browser.
|
||||
*/
|
||||
|
||||
if (!chai) {
|
||||
var chai = require('..');
|
||||
}
|
||||
|
||||
var assert = chai.assert;
|
||||
|
||||
function err(fn, msg) {
|
||||
try {
|
||||
fn();
|
||||
throw new chai.AssertionError({ message: 'Expected an error' });
|
||||
} catch (err) {
|
||||
assert.equal(msg, err.message);
|
||||
}
|
||||
}
|
||||
|
||||
suite('assert', function () {
|
||||
|
||||
test('version', function () {
|
||||
assert.match(chai.version, /^\d+\.\d+\.\d+$/ );
|
||||
});
|
||||
|
||||
test('isTrue', function () {
|
||||
assert.isTrue(true);
|
||||
|
||||
err(function() {
|
||||
assert.isTrue(false);
|
||||
}, "expected false to be true");
|
||||
|
||||
err(function() {
|
||||
assert.isTrue(1);
|
||||
}, "expected 1 to be true");
|
||||
|
||||
err(function() {
|
||||
assert.isTrue('test');
|
||||
}, "expected 'test' to be true");
|
||||
});
|
||||
|
||||
test('ok', function () {
|
||||
assert.ok(true);
|
||||
assert.ok(1);
|
||||
assert.ok('test');
|
||||
|
||||
err(function () {
|
||||
assert.ok(false);
|
||||
}, "expected false to be truthy");
|
||||
|
||||
err(function () {
|
||||
assert.ok(0);
|
||||
}, "expected 0 to be truthy");
|
||||
|
||||
err(function () {
|
||||
assert.ok('');
|
||||
}, "expected '' to be truthy");
|
||||
});
|
||||
|
||||
test('isFalse', function () {
|
||||
assert.isFalse(false);
|
||||
|
||||
err(function() {
|
||||
assert.isFalse(true);
|
||||
}, "expected true to be false");
|
||||
|
||||
err(function() {
|
||||
assert.isFalse(0);
|
||||
}, "expected 0 to be false");
|
||||
});
|
||||
|
||||
test('equal', function () {
|
||||
var foo;
|
||||
assert.equal(foo, undefined);
|
||||
});
|
||||
|
||||
test('typeof', function () {
|
||||
assert.typeOf('test', 'string');
|
||||
assert.typeOf(true, 'boolean');
|
||||
assert.typeOf(5, 'number');
|
||||
|
||||
err(function () {
|
||||
assert.typeOf(5, 'string');
|
||||
}, "expected 5 to be a string");
|
||||
});
|
||||
|
||||
test('instanceOf', function() {
|
||||
function Foo(){}
|
||||
assert.instanceOf(new Foo(), Foo);
|
||||
|
||||
err(function () {
|
||||
assert.instanceOf(5, Foo);
|
||||
}, "expected 5 to be an instance of Foo");
|
||||
});
|
||||
|
||||
test('isObject', function () {
|
||||
function Foo(){}
|
||||
assert.isObject({});
|
||||
assert.isObject(new Foo());
|
||||
|
||||
err(function() {
|
||||
assert.isObject(true);
|
||||
}, "expected true to be a object");
|
||||
|
||||
err(function() {
|
||||
assert.isObject(Foo);
|
||||
}, "expected [Function: Foo] to be a object");
|
||||
|
||||
err(function() {
|
||||
assert.isObject('foo');
|
||||
}, "expected 'foo' to be a object");
|
||||
});
|
||||
|
||||
test('notEqual', function() {
|
||||
assert.notEqual(3, 4);
|
||||
|
||||
err(function () {
|
||||
assert.notEqual(5, 5);
|
||||
}, "expected 5 to equal 5");
|
||||
});
|
||||
|
||||
test('strictEqual', function() {
|
||||
assert.strictEqual('foo', 'foo');
|
||||
|
||||
err(function () {
|
||||
assert.strictEqual('5', 5);
|
||||
}, "expected \'5\' to equal 5");
|
||||
});
|
||||
|
||||
test('notStrictEqual', function() {
|
||||
assert.notStrictEqual(5, '5');
|
||||
|
||||
err(function () {
|
||||
assert.notStrictEqual(5, 5);
|
||||
}, "expected 5 to not equal 5");
|
||||
});
|
||||
|
||||
test('deepEqual', function() {
|
||||
assert.deepEqual({tea: 'chai'}, {tea: 'chai'});
|
||||
|
||||
err(function () {
|
||||
assert.deepEqual({tea: 'chai'}, {tea: 'black'});
|
||||
}, "expected { tea: \'chai\' } to equal { tea: \'black\' }");
|
||||
});
|
||||
|
||||
test('notDeepEqual', function() {
|
||||
assert.notDeepEqual({tea: 'jasmine'}, {tea: 'chai'});
|
||||
|
||||
err(function () {
|
||||
assert.notDeepEqual({tea: 'chai'}, {tea: 'chai'});
|
||||
}, "expected { tea: \'chai\' } to not equal { tea: \'chai\' }");
|
||||
});
|
||||
|
||||
test('isNull', function() {
|
||||
assert.isNull(null);
|
||||
|
||||
err(function () {
|
||||
assert.isNull(undefined);
|
||||
}, "expected undefined to equal null");
|
||||
});
|
||||
|
||||
test('isNotNull', function() {
|
||||
assert.isNotNull(undefined);
|
||||
|
||||
err(function () {
|
||||
assert.isNotNull(null);
|
||||
}, "expected null to not equal null");
|
||||
});
|
||||
|
||||
test('isUndefined', function() {
|
||||
assert.isUndefined(undefined);
|
||||
|
||||
err(function () {
|
||||
assert.isUndefined(null);
|
||||
}, "expected null to equal undefined");
|
||||
});
|
||||
|
||||
test('isDefined', function() {
|
||||
assert.isDefined(null);
|
||||
|
||||
err(function () {
|
||||
assert.isDefined(undefined);
|
||||
}, "expected undefined to not equal undefined");
|
||||
});
|
||||
|
||||
test('isFunction', function() {
|
||||
var func = function() {};
|
||||
assert.isFunction(func);
|
||||
|
||||
err(function () {
|
||||
assert.isFunction({});
|
||||
}, "expected {} to be a function");
|
||||
});
|
||||
|
||||
test('isArray', function() {
|
||||
assert.isArray([]);
|
||||
assert.isArray(new Array);
|
||||
|
||||
err(function () {
|
||||
assert.isArray({});
|
||||
}, "expected {} to be an instance of Array");
|
||||
});
|
||||
|
||||
test('isString', function() {
|
||||
assert.isString('Foo');
|
||||
assert.isString(new String('foo'));
|
||||
|
||||
err(function () {
|
||||
assert.isString(1);
|
||||
}, "expected 1 to be a string");
|
||||
});
|
||||
|
||||
test('isNumber', function() {
|
||||
assert.isNumber(1);
|
||||
assert.isNumber(Number('3'));
|
||||
|
||||
err(function () {
|
||||
assert.isNumber('1');
|
||||
}, "expected \'1\' to be a number");
|
||||
});
|
||||
|
||||
test('isBoolean', function() {
|
||||
assert.isBoolean(true);
|
||||
assert.isBoolean(false);
|
||||
|
||||
err(function () {
|
||||
assert.isBoolean('1');
|
||||
}, "expected \'1\' to be a boolean");
|
||||
});
|
||||
|
||||
test('include', function() {
|
||||
assert.include('foobar', 'bar');
|
||||
assert.include([ 1, 2, 3], 3);
|
||||
|
||||
err(function () {
|
||||
assert.include('foobar', 'baz');
|
||||
}, "expected \'foobar\' to contain \'baz\'");
|
||||
});
|
||||
|
||||
test('length', function() {
|
||||
assert.length([1,2,3], 3);
|
||||
assert.length('foobar', 6);
|
||||
|
||||
err(function () {
|
||||
assert.length('foobar', 5);
|
||||
}, "expected 'foobar' to have a length of 5 but got 6");
|
||||
|
||||
err(function () {
|
||||
assert.length(1, 5);
|
||||
}, "expected 1 to have a property \'length\'");
|
||||
});
|
||||
|
||||
test('throws', function() {
|
||||
assert.throws(function() { throw new Error('foo'); });
|
||||
assert.throws(function() { throw new Error('bar'); }, 'foo');
|
||||
|
||||
err(function () {
|
||||
assert.throws(function() {});
|
||||
}, "expected [Function] to throw an error");
|
||||
});
|
||||
|
||||
test('doesNotThrow', function() {
|
||||
assert.doesNotThrow(function() { });
|
||||
assert.doesNotThrow(function() { }, 'foo');
|
||||
|
||||
err(function () {
|
||||
assert.doesNotThrow(function() { throw new Error('foo'); });
|
||||
}, 'expected [Function] to not throw an error');
|
||||
});
|
||||
|
||||
test('ifError', function() {
|
||||
assert.ifError(false);
|
||||
assert.ifError(null);
|
||||
assert.ifError(undefined);
|
||||
|
||||
err(function () {
|
||||
assert.ifError('foo');
|
||||
}, "expected \'foo\' to be falsy");
|
||||
});
|
||||
|
||||
test('operator', function() {
|
||||
assert.operator(1, '<', 2);
|
||||
assert.operator(2, '>', 1);
|
||||
assert.operator(1, '==', 1);
|
||||
assert.operator(1, '<=', 1);
|
||||
assert.operator(1, '>=', 1);
|
||||
assert.operator(1, '!=', 2);
|
||||
assert.operator(1, '!==', 2);
|
||||
|
||||
err(function () {
|
||||
assert.operator(1, '=', 2);
|
||||
}, 'Invalid operator "="');
|
||||
|
||||
err(function () {
|
||||
assert.operator(2, '<', 1);
|
||||
}, "expected false to be true");
|
||||
|
||||
err(function () {
|
||||
assert.operator(1, '>', 2);
|
||||
}, "expected false to be true");
|
||||
|
||||
err(function () {
|
||||
assert.operator(1, '==', 2);
|
||||
}, "expected false to be true");
|
||||
|
||||
err(function () {
|
||||
assert.operator(2, '<=', 1);
|
||||
}, "expected false to be true");
|
||||
|
||||
err(function () {
|
||||
assert.operator(1, '>=', 2);
|
||||
}, "expected false to be true");
|
||||
|
||||
err(function () {
|
||||
assert.operator(1, '!=', 1);
|
||||
}, "expected false to be true");
|
||||
|
||||
err(function () {
|
||||
assert.operator(1, '!==', '1');
|
||||
}, "expected false to be true");
|
||||
});
|
||||
});
|
|
@ -1,35 +0,0 @@
|
|||
if (!chai) {
|
||||
var chai = require('..');
|
||||
}
|
||||
|
||||
var assert = chai.assert;
|
||||
|
||||
function fooThrows () {
|
||||
assert.equal('foo', 'bar');
|
||||
}
|
||||
|
||||
suite('configuration', function () {
|
||||
|
||||
test('Assertion.includeStack is true, stack trace available', function () {
|
||||
chai.Assertion.includeStack = true;
|
||||
try {
|
||||
fooThrows();
|
||||
assert.ok(false, 'should not get here because error thrown');
|
||||
} catch (err) {
|
||||
if (typeof(err.stack) !== 'undefined') { // not all browsers support err.stack
|
||||
assert.include(err.stack, 'at fooThrows', 'should have stack trace in error message');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('Assertion.includeStack is false, stack trace not available', function () {
|
||||
chai.Assertion.includeStack = false;
|
||||
try {
|
||||
fooThrows();
|
||||
assert.ok(false, 'should not get here because error thrown');
|
||||
} catch (err) {
|
||||
assert.ok(!err.stack || err.stack.indexOf('at fooThrows') === -1, 'should not have stack trace in error message');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
|
@ -1,526 +0,0 @@
|
|||
/*!
|
||||
* Module dependencies.
|
||||
*
|
||||
* Chai is automatically included in the browser.
|
||||
*/
|
||||
|
||||
if (!chai) {
|
||||
var chai = require('..');
|
||||
}
|
||||
|
||||
var expect = chai.expect;
|
||||
|
||||
function err(fn, msg) {
|
||||
try {
|
||||
fn();
|
||||
throw new chai.AssertionError({ message: 'Expected an error' });
|
||||
} catch (err) {
|
||||
expect(msg).to.equal(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
suite('expect', function () {
|
||||
|
||||
test('=.version', function() {
|
||||
expect(chai.version).to.match(/^\d+\.\d+\.\d+$/);
|
||||
});
|
||||
|
||||
test('=double require', function(){
|
||||
//require('chai').expect().to.equal(expect);
|
||||
});
|
||||
|
||||
test('assertion', function(){
|
||||
expect('test').to.be.a('string');
|
||||
expect('foo').to.equal('foo');
|
||||
});
|
||||
|
||||
test('true', function(){
|
||||
expect(true).to.be.true;
|
||||
expect(false).to.not.be.true;
|
||||
expect(1).to.not.be.true;
|
||||
|
||||
err(function(){
|
||||
expect('test').to.be.true;
|
||||
}, "expected 'test' to be true")
|
||||
});
|
||||
|
||||
test('ok', function(){
|
||||
expect(true).to.be.ok;
|
||||
expect(false).to.not.be.ok;
|
||||
expect(1).to.be.ok;
|
||||
expect(0).to.not.be.ok;
|
||||
|
||||
err(function(){
|
||||
expect('').to.be.ok;
|
||||
}, "expected '' to be truthy");
|
||||
|
||||
err(function(){
|
||||
expect('test').to.not.be.ok;
|
||||
}, "expected 'test' to be falsy");
|
||||
});
|
||||
|
||||
test('false', function(){
|
||||
expect(false).to.be.false;
|
||||
expect(true).to.not.be.false;
|
||||
expect(0).to.not.be.false;
|
||||
|
||||
err(function(){
|
||||
expect('').to.be.false;
|
||||
}, "expected '' to be false")
|
||||
});
|
||||
|
||||
test('exist', function(){
|
||||
var foo = 'bar'
|
||||
, bar;
|
||||
expect(foo).to.exist;
|
||||
expect(bar).to.not.exist;
|
||||
});
|
||||
|
||||
test('arguments', function(){
|
||||
var args = (function(){ return arguments; })(1,2,3);
|
||||
expect(args).to.be.arguments;
|
||||
expect([]).to.not.be.arguments;
|
||||
});
|
||||
|
||||
test('.equal()', function(){
|
||||
var foo;
|
||||
expect(undefined).to.equal(foo);
|
||||
});
|
||||
|
||||
test('typeof', function(){
|
||||
expect('test').to.be.a('string');
|
||||
|
||||
err(function(){
|
||||
expect('test').to.not.be.a('string');
|
||||
}, "expected 'test' not to be a string");
|
||||
|
||||
expect(5).to.be.a('number');
|
||||
expect(new Number(1)).to.be.a('number');
|
||||
expect(Number(1)).to.be.a('number');
|
||||
expect(true).to.be.a('boolean');
|
||||
expect(new Array()).to.be.a('array');
|
||||
expect(new Object()).to.be.a('object');
|
||||
expect({}).to.be.a('object');
|
||||
expect([]).to.be.a('array');
|
||||
expect(function() {}).to.be.a('function');
|
||||
|
||||
err(function(){
|
||||
expect(5).to.not.be.a('number');
|
||||
}, "expected 5 not to be a number");
|
||||
});
|
||||
|
||||
test('instanceof', function(){
|
||||
function Foo(){}
|
||||
expect(new Foo()).to.be.an.instanceof(Foo);
|
||||
|
||||
err(function(){
|
||||
expect(3).to.an.instanceof(Foo);
|
||||
}, "expected 3 to be an instance of Foo");
|
||||
});
|
||||
|
||||
test('within(start, finish)', function(){
|
||||
expect(5).to.be.within(5, 10);
|
||||
expect(5).to.be.within(3,6);
|
||||
expect(5).to.be.within(3,5);
|
||||
expect(5).to.not.be.within(1,3);
|
||||
|
||||
err(function(){
|
||||
expect(5).to.not.be.within(4,6);
|
||||
}, "expected 5 to not be within 4..6");
|
||||
|
||||
err(function(){
|
||||
expect(10).to.be.within(50,100);
|
||||
}, "expected 10 to be within 50..100");
|
||||
});
|
||||
|
||||
test('above(n)', function(){
|
||||
expect(5).to.be.above(2);
|
||||
expect(5).to.be.greaterThan(2);
|
||||
expect(5).to.not.be.above(5);
|
||||
expect(5).to.not.be.above(6);
|
||||
|
||||
err(function(){
|
||||
expect(5).to.be.above(6);
|
||||
}, "expected 5 to be above 6");
|
||||
|
||||
err(function(){
|
||||
expect(10).to.not.be.above(6);
|
||||
}, "expected 10 to be below 6");
|
||||
});
|
||||
|
||||
test('below(n)', function(){
|
||||
expect(2).to.be.below(5);
|
||||
expect(2).to.be.lessThan(5);
|
||||
expect(2).to.not.be.below(2);
|
||||
expect(2).to.not.be.below(1);
|
||||
|
||||
err(function(){
|
||||
expect(6).to.be.below(5);
|
||||
}, "expected 6 to be below 5");
|
||||
|
||||
err(function(){
|
||||
expect(6).to.not.be.below(10);
|
||||
}, "expected 6 to be above 10");
|
||||
});
|
||||
|
||||
test('match(regexp)', function(){
|
||||
expect('foobar').to.match(/^foo/)
|
||||
expect('foobar').to.not.match(/^bar/)
|
||||
|
||||
err(function(){
|
||||
expect('foobar').to.match(/^bar/i)
|
||||
}, "expected 'foobar' to match /^bar/i");
|
||||
|
||||
err(function(){
|
||||
expect('foobar').to.not.match(/^foo/i)
|
||||
}, "expected 'foobar' not to match /^foo/i");
|
||||
});
|
||||
|
||||
test('length(n)', function(){
|
||||
expect('test').to.have.length(4);
|
||||
expect('test').to.not.have.length(3);
|
||||
expect([1,2,3]).to.have.length(3);
|
||||
|
||||
err(function(){
|
||||
expect(4).to.have.length(3);
|
||||
}, 'expected 4 to have a property \'length\'');
|
||||
|
||||
err(function(){
|
||||
expect('asd').to.not.have.length(3);
|
||||
}, "expected 'asd' to not have a length of 3");
|
||||
});
|
||||
|
||||
test('eql(val)', function(){
|
||||
expect('test').to.eql('test');
|
||||
expect({ foo: 'bar' }).to.eql({ foo: 'bar' });
|
||||
expect(1).to.eql(1);
|
||||
expect('4').to.not.eql(4);
|
||||
|
||||
err(function(){
|
||||
expect(4).to.eql(3);
|
||||
}, 'expected 4 to equal 3');
|
||||
});
|
||||
|
||||
test('equal(val)', function(){
|
||||
expect('test').to.equal('test');
|
||||
expect(1).to.equal(1);
|
||||
|
||||
err(function(){
|
||||
expect(4).to.equal(3);
|
||||
}, 'expected 4 to equal 3');
|
||||
|
||||
err(function(){
|
||||
expect('4').to.equal(4);
|
||||
}, "expected '4' to equal 4");
|
||||
});
|
||||
|
||||
test('empty', function(){
|
||||
function FakeArgs() {};
|
||||
FakeArgs.prototype.length = 0;
|
||||
|
||||
expect('').to.be.empty;
|
||||
expect('foo').not.to.be.empty;
|
||||
expect([]).to.be.empty;
|
||||
expect(['foo']).not.to.be.empty;
|
||||
expect(new FakeArgs).to.be.empty;
|
||||
expect({arguments: 0}).not.to.be.empty;
|
||||
expect({}).to.be.empty;
|
||||
expect({foo: 'bar'}).not.to.be.empty;
|
||||
|
||||
err(function(){
|
||||
expect('').not.to.be.empty;
|
||||
}, "expected \'\' not to be empty");
|
||||
|
||||
err(function(){
|
||||
expect('foo').to.be.empty;
|
||||
}, "expected \'foo\' to be empty");
|
||||
|
||||
err(function(){
|
||||
expect([]).not.to.be.empty;
|
||||
}, "expected [] not to be empty");
|
||||
|
||||
err(function(){
|
||||
expect(['foo']).to.be.empty;
|
||||
}, "expected [ \'foo\' ] to be empty");
|
||||
|
||||
err(function(){
|
||||
expect(new FakeArgs).not.to.be.empty;
|
||||
}, "expected {} not to be empty");
|
||||
|
||||
err(function(){
|
||||
expect({arguments: 0}).to.be.empty;
|
||||
}, "expected { arguments: 0 } to be empty");
|
||||
|
||||
err(function(){
|
||||
expect({}).not.to.be.empty;
|
||||
}, "expected {} not to be empty");
|
||||
|
||||
err(function(){
|
||||
expect({foo: 'bar'}).to.be.empty;
|
||||
}, "expected { foo: \'bar\' } to be empty");
|
||||
});
|
||||
|
||||
test('property(name)', function(){
|
||||
expect('test').to.have.property('length');
|
||||
expect(4).to.not.have.property('length');
|
||||
|
||||
err(function(){
|
||||
expect('asd').to.have.property('foo');
|
||||
}, "expected 'asd' to have a property 'foo'");
|
||||
});
|
||||
|
||||
test('property(name, val)', function(){
|
||||
expect('test').to.have.property('length', 4);
|
||||
expect('asd').to.have.property('constructor', String);
|
||||
|
||||
err(function(){
|
||||
expect('asd').to.have.property('length', 4);
|
||||
}, "expected 'asd' to have a property 'length' of 4, but got 3");
|
||||
|
||||
err(function(){
|
||||
expect('asd').to.not.have.property('length', 3);
|
||||
}, "expected 'asd' to not have a property 'length' of 3");
|
||||
|
||||
err(function(){
|
||||
expect('asd').to.not.have.property('foo', 3);
|
||||
}, "'asd' has no property 'foo'");
|
||||
|
||||
err(function(){
|
||||
expect('asd').to.have.property('constructor', Number);
|
||||
}, "expected 'asd' to have a property 'constructor' of [Function: Number], but got [Function: String]");
|
||||
});
|
||||
|
||||
test('ownProperty(name)', function(){
|
||||
expect('test').to.have.ownProperty('length');
|
||||
expect('test').to.haveOwnProperty('length');
|
||||
expect({ length: 12 }).to.have.ownProperty('length');
|
||||
|
||||
err(function(){
|
||||
expect({ length: 12 }).to.not.have.ownProperty('length');
|
||||
}, "expected { length: 12 } to not have own property 'length'");
|
||||
});
|
||||
|
||||
test('string()', function(){
|
||||
expect('foobar').to.have.string('bar');
|
||||
expect('foobar').to.have.string('foo');
|
||||
expect('foobar').to.not.have.string('baz');
|
||||
|
||||
err(function(){
|
||||
expect(3).to.have.string('baz');
|
||||
}, "expected 3 to be a string");
|
||||
|
||||
err(function(){
|
||||
expect('foobar').to.have.string('baz');
|
||||
}, "expected 'foobar' to contain 'baz'");
|
||||
|
||||
err(function(){
|
||||
expect('foobar').to.not.have.string('bar');
|
||||
}, "expected 'foobar' to not contain 'bar'");
|
||||
});
|
||||
|
||||
test('include()', function(){
|
||||
expect(['foo', 'bar']).to.include('foo');
|
||||
expect(['foo', 'bar']).to.include('foo');
|
||||
expect(['foo', 'bar']).to.include('bar');
|
||||
expect([1,2]).to.include(1);
|
||||
expect(['foo', 'bar']).to.not.include('baz');
|
||||
expect(['foo', 'bar']).to.not.include(1);
|
||||
|
||||
err(function(){
|
||||
expect(['foo']).to.include('bar');
|
||||
}, "expected [ 'foo' ] to include 'bar'");
|
||||
|
||||
err(function(){
|
||||
expect(['bar', 'foo']).to.not.include('foo');
|
||||
}, "expected [ 'bar', 'foo' ] to not include 'foo'");
|
||||
});
|
||||
|
||||
test('keys(array)', function(){
|
||||
expect({ foo: 1 }).to.have.keys(['foo']);
|
||||
expect({ foo: 1, bar: 2 }).to.have.keys(['foo', 'bar']);
|
||||
expect({ foo: 1, bar: 2 }).to.have.keys('foo', 'bar');
|
||||
expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('foo', 'bar');
|
||||
expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('bar', 'foo');
|
||||
expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('baz');
|
||||
|
||||
expect({ foo: 1, bar: 2 }).to.contain.keys('foo');
|
||||
expect({ foo: 1, bar: 2 }).to.contain.keys('bar', 'foo');
|
||||
expect({ foo: 1, bar: 2 }).to.contain.keys(['foo']);
|
||||
expect({ foo: 1, bar: 2 }).to.contain.keys(['bar']);
|
||||
expect({ foo: 1, bar: 2 }).to.contain.keys(['bar', 'foo']);
|
||||
|
||||
expect({ foo: 1, bar: 2 }).to.not.have.keys('baz');
|
||||
expect({ foo: 1, bar: 2 }).to.not.have.keys('foo', 'baz');
|
||||
expect({ foo: 1, bar: 2 }).to.not.contain.keys('baz');
|
||||
expect({ foo: 1, bar: 2 }).to.not.contain.keys('foo', 'baz');
|
||||
expect({ foo: 1, bar: 2 }).to.not.contain.keys('baz', 'foo');
|
||||
|
||||
err(function(){
|
||||
expect({ foo: 1 }).to.have.keys();
|
||||
}, "keys required");
|
||||
|
||||
err(function(){
|
||||
expect({ foo: 1 }).to.have.keys([]);
|
||||
}, "keys required");
|
||||
|
||||
err(function(){
|
||||
expect({ foo: 1 }).to.not.have.keys([]);
|
||||
}, "keys required");
|
||||
|
||||
err(function(){
|
||||
expect({ foo: 1 }).to.contain.keys([]);
|
||||
}, "keys required");
|
||||
|
||||
err(function(){
|
||||
expect({ foo: 1 }).to.have.keys(['bar']);
|
||||
}, "expected { foo: 1 } to have key 'bar'");
|
||||
|
||||
err(function(){
|
||||
expect({ foo: 1 }).to.have.keys(['bar', 'baz']);
|
||||
}, "expected { foo: 1 } to have keys 'bar', and 'baz'");
|
||||
|
||||
err(function(){
|
||||
expect({ foo: 1 }).to.have.keys(['foo', 'bar', 'baz']);
|
||||
}, "expected { foo: 1 } to have keys 'foo', 'bar', and 'baz'");
|
||||
|
||||
err(function(){
|
||||
expect({ foo: 1 }).to.not.have.keys(['foo']);
|
||||
}, "expected { foo: 1 } to not have key 'foo'");
|
||||
|
||||
err(function(){
|
||||
expect({ foo: 1 }).to.not.have.keys(['foo']);
|
||||
}, "expected { foo: 1 } to not have key 'foo'");
|
||||
|
||||
err(function(){
|
||||
expect({ foo: 1, bar: 2 }).to.not.have.keys(['foo', 'bar']);
|
||||
}, "expected { foo: 1, bar: 2 } to not have keys 'foo', and 'bar'");
|
||||
|
||||
err(function(){
|
||||
expect({ foo: 1 }).to.not.contain.keys(['foo']);
|
||||
}, "expected { foo: 1 } to not contain key 'foo'");
|
||||
|
||||
err(function(){
|
||||
expect({ foo: 1 }).to.contain.keys('foo', 'bar');
|
||||
}, "expected { foo: 1 } to contain keys 'foo', and 'bar'");
|
||||
});
|
||||
|
||||
test('chaining', function(){
|
||||
var tea = { name: 'chai', extras: ['milk', 'sugar', 'smile'] };
|
||||
expect(tea).to.have.property('extras').with.lengthOf(3);
|
||||
|
||||
err(function(){
|
||||
expect(tea).to.have.property('extras').with.lengthOf(4);
|
||||
}, "expected [ 'milk', 'sugar', 'smile' ] to have a length of 4 but got 3");
|
||||
|
||||
expect(tea).to.be.a('object').and.have.property('name', 'chai');
|
||||
});
|
||||
|
||||
test('throw', function () {
|
||||
var goodFn = function () { 1==1; }
|
||||
, badFn = function () { throw new Error('testing'); }
|
||||
, refErrFn = function () { throw new ReferenceError(); };
|
||||
|
||||
expect(goodFn).to.not.throw();
|
||||
expect(goodFn).to.not.throw(Error);
|
||||
expect(badFn).to.throw();
|
||||
expect(badFn).to.throw(Error);
|
||||
expect(badFn).to.not.throw(ReferenceError);
|
||||
expect(refErrFn).to.throw();
|
||||
expect(refErrFn).to.throw(ReferenceError);
|
||||
expect(refErrFn).to.not.throw(Error);
|
||||
expect(refErrFn).to.not.throw(TypeError);
|
||||
|
||||
expect(badFn).to.throw(/testing/);
|
||||
expect(badFn).to.not.throw(/hello/);
|
||||
expect(badFn).to.throw('testing');
|
||||
expect(badFn).to.not.throw('hello');
|
||||
|
||||
expect(badFn).to.throw(Error, /testing/);
|
||||
expect(badFn).to.throw(Error, 'testing');
|
||||
|
||||
err(function(){
|
||||
expect(goodFn).to.throw();
|
||||
}, "expected [Function] to throw an error");
|
||||
|
||||
err(function(){
|
||||
expect(goodFn).to.throw(ReferenceError);
|
||||
}, "expected [Function] to throw ReferenceError");
|
||||
|
||||
err(function(){
|
||||
expect(badFn).to.not.throw();
|
||||
}, "expected [Function] to not throw an error");
|
||||
|
||||
err(function(){
|
||||
expect(badFn).to.throw(ReferenceError);
|
||||
}, "expected [Function] to throw ReferenceError but a Error was thrown");
|
||||
|
||||
err(function(){
|
||||
expect(badFn).to.not.throw(Error);
|
||||
}, "expected [Function] to not throw Error");
|
||||
|
||||
err(function(){
|
||||
expect(refErrFn).to.not.throw(ReferenceError);
|
||||
}, "expected [Function] to not throw ReferenceError");
|
||||
|
||||
err(function(){
|
||||
expect(refErrFn).to.throw(Error);
|
||||
}, "expected [Function] to throw Error but a ReferenceError was thrown");
|
||||
|
||||
err(function (){
|
||||
expect(badFn).to.not.throw(/testing/);
|
||||
}, "expected [Function] to throw error not matching /testing/");
|
||||
|
||||
err(function () {
|
||||
expect(badFn).to.throw(/hello/);
|
||||
}, "expected [Function] to throw error matching /hello/ but got \'testing\'");
|
||||
|
||||
err(function () {
|
||||
expect(badFn).to.throw(Error, /hello/);
|
||||
}, "expected [Function] to throw error matching /hello/ but got 'testing'");
|
||||
|
||||
err(function () {
|
||||
expect(badFn).to.throw(Error, 'hello');
|
||||
}, "expected [Function] to throw error including 'hello' but got 'testing'");
|
||||
});
|
||||
|
||||
test('respondTo', function(){
|
||||
function Foo(){};
|
||||
Foo.prototype.bar = function(){};
|
||||
|
||||
var bar = {};
|
||||
bar.foo = function(){};
|
||||
|
||||
expect(Foo).to.respondTo('bar');
|
||||
expect(Foo).to.not.respondTo('foo');
|
||||
|
||||
expect(bar).to.respondTo('foo');
|
||||
|
||||
err(function(){
|
||||
expect(Foo).to.respondTo('baz');
|
||||
}, "expected [Function: Foo] to respond to \'baz\'");
|
||||
|
||||
err(function(){
|
||||
expect(bar).to.respondTo('baz');
|
||||
}, "expected { foo: [Function] } to respond to \'baz\'");
|
||||
});
|
||||
|
||||
test('satisfy', function(){
|
||||
var matcher = function(num){
|
||||
return num === 1;
|
||||
};
|
||||
|
||||
expect(1).to.satisfy(matcher);
|
||||
|
||||
err(function(){
|
||||
expect(2).to.satisfy(matcher);
|
||||
}, "expected 2 to satisfy [Function]");
|
||||
});
|
||||
|
||||
test('closeTo', function(){
|
||||
expect(1.5).to.be.closeTo(1.0, 0.5);
|
||||
|
||||
err(function(){
|
||||
expect(2).to.be.closeTo(1.0, 0.5);
|
||||
}, "expected 2 to be close to 1 +/- 0.5");
|
||||
});
|
||||
});
|
|
@ -1,23 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Mocha</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" href="mocha.css" />
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
|
||||
<script src="mocha.js"></script>
|
||||
<script>mocha.setup('tdd')</script>
|
||||
<script src="/chai.js"></script>
|
||||
<script src="configuration.js"></script>
|
||||
<script src="expect.js"></script>
|
||||
<script src="should.js"></script>
|
||||
<script src="assert.js"></script>
|
||||
<script src="plugins.js"></script>
|
||||
<script>onload = function() {
|
||||
mocha.run();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,135 +0,0 @@
|
|||
|
||||
body {
|
||||
font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
padding: 60px 50px;
|
||||
}
|
||||
|
||||
#mocha h1, h2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#mocha h1 {
|
||||
font-size: 1em;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
#mocha .suite .suite h1 {
|
||||
font-size: .8em;
|
||||
}
|
||||
|
||||
#mocha h2 {
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#mocha .suite {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#mocha .test {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#mocha .test:hover h2::after {
|
||||
position: relative;
|
||||
top: 0;
|
||||
right: -10px;
|
||||
content: '(view source)';
|
||||
font-size: 12px;
|
||||
font-family: arial;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
#mocha .test.pending:hover h2::after {
|
||||
content: '(pending)';
|
||||
font-family: arial;
|
||||
}
|
||||
|
||||
#mocha .test.pass::before {
|
||||
content: '✓';
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
color: #00c41c;
|
||||
}
|
||||
|
||||
#mocha .test.pending {
|
||||
color: #0b97c4;
|
||||
}
|
||||
|
||||
#mocha .test.pending::before {
|
||||
content: '◦';
|
||||
color: #0b97c4;
|
||||
}
|
||||
|
||||
#mocha .test.fail {
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
#mocha .test.fail pre {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#mocha .test.fail::before {
|
||||
content: '✖';
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
#mocha .test pre.error {
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
#mocha .test pre {
|
||||
display: inline-block;
|
||||
font: 12px/1.5 monaco, monospace;
|
||||
margin: 5px;
|
||||
padding: 15px;
|
||||
border: 1px solid #eee;
|
||||
border-bottom-color: #ddd;
|
||||
-webkit-border-radius: 3px;
|
||||
-webkit-box-shadow: 0 1px 3px #eee;
|
||||
}
|
||||
|
||||
#error {
|
||||
color: #c00;
|
||||
font-size: 1.5 em;
|
||||
font-weight: 100;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
#stats {
|
||||
position: fixed;
|
||||
top: 15px;
|
||||
right: 10px;
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
#stats .progress {
|
||||
float: right;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
#stats em {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#stats li {
|
||||
display: inline-block;
|
||||
margin: 0 5px;
|
||||
list-style: none;
|
||||
padding-top: 11px;
|
||||
}
|
||||
|
||||
code .comment { color: #ddd }
|
||||
code .init { color: #2F6FAD }
|
||||
code .string { color: #5890AD }
|
||||
code .keyword { color: #8A6343 }
|
||||
code .number { color: #2F6FAD }
|
File diff suppressed because it is too large
Load diff
|
@ -1,26 +0,0 @@
|
|||
if (!chai) {
|
||||
var chai = require('..');
|
||||
}
|
||||
|
||||
suite('plugins', function () {
|
||||
|
||||
function plugin (chai) {
|
||||
Object.defineProperty(chai.Assertion.prototype, 'testing', {
|
||||
get: function () {
|
||||
return 'successful';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
test('basic usage', function () {
|
||||
chai.use(plugin);
|
||||
var expect = chai.expect;
|
||||
expect(expect('').testing).to.equal('successful');
|
||||
});
|
||||
|
||||
test('double plugin', function () {
|
||||
chai.expect(function () {
|
||||
chai.use(plugin);
|
||||
}).to.not.throw();
|
||||
});
|
||||
});
|
|
@ -1,532 +0,0 @@
|
|||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
|
||||
if (!chai) {
|
||||
var chai = require('..');
|
||||
}
|
||||
|
||||
var should = chai.should();
|
||||
|
||||
function err(fn, msg) {
|
||||
try {
|
||||
fn();
|
||||
throw new chai.AssertionError({ message: 'Expected an error' });
|
||||
} catch (err) {
|
||||
should.equal(msg, err.message);
|
||||
}
|
||||
}
|
||||
|
||||
suite('should', function() {
|
||||
|
||||
test('.version', function(){
|
||||
chai.version.should.match(/^\d+\.\d+\.\d+$/);
|
||||
});
|
||||
|
||||
test('double require', function(){
|
||||
//require('chai').should().should.equal(should);
|
||||
});
|
||||
|
||||
test('assertion', function(){
|
||||
'test'.should.be.a('string');
|
||||
should.equal('foo', 'foo');
|
||||
should.not.equal('foo', 'bar');
|
||||
});
|
||||
|
||||
test('root exist', function () {
|
||||
var foo = 'foo'
|
||||
, bar = undefined;
|
||||
should.exist(foo);
|
||||
should.not.exist(bar);
|
||||
|
||||
err(function () {
|
||||
should.exist(bar);
|
||||
}, "expected undefined to exist");
|
||||
|
||||
err(function () {
|
||||
should.not.exist(foo);
|
||||
}, "expected 'foo' to not exist")
|
||||
});
|
||||
|
||||
test('true', function(){
|
||||
(true).should.be.true;
|
||||
false.should.not.be.true;
|
||||
(1).should.not.be.true;false
|
||||
false.should.have.been.false;
|
||||
|
||||
err(function(){
|
||||
'test'.should.be.true;
|
||||
}, "expected 'test' to be true")
|
||||
});
|
||||
|
||||
test('ok', function(){
|
||||
true.should.be.ok;
|
||||
false.should.not.be.ok;
|
||||
(1).should.be.ok;
|
||||
(0).should.not.be.ok;
|
||||
|
||||
err(function(){
|
||||
''.should.be.ok;
|
||||
}, "expected '' to be truthy");
|
||||
|
||||
err(function(){
|
||||
'test'.should.not.be.ok;
|
||||
}, "expected 'test' to be falsy");
|
||||
});
|
||||
|
||||
test('false', function(){
|
||||
false.should.be.false;
|
||||
true.should.not.be.false;
|
||||
(0).should.not.be.false;
|
||||
|
||||
err(function(){
|
||||
''.should.be.false;
|
||||
}, "expected '' to be false")
|
||||
});
|
||||
|
||||
test('arguments', function(){
|
||||
var args = (function(){ return arguments; })(1,2,3);
|
||||
args.should.be.arguments;
|
||||
[].should.not.be.arguments;
|
||||
});
|
||||
|
||||
test('.equal()', function(){
|
||||
var foo;
|
||||
should.equal(undefined, foo);
|
||||
});
|
||||
|
||||
test('typeof', function(){
|
||||
'test'.should.be.a('string');
|
||||
|
||||
err(function(){
|
||||
'test'.should.not.be.a('string');
|
||||
}, "expected 'test' not to be a string");
|
||||
|
||||
(5).should.be.a('number');
|
||||
(new Number(1)).should.be.a('number');
|
||||
Number(1).should.be.a('number');
|
||||
(true).should.be.a('boolean');
|
||||
(new Array()).should.be.a('array');
|
||||
(new Object()).should.be.a('object');
|
||||
({}).should.be.a('object');
|
||||
([]).should.be.a('array');
|
||||
(function() {}).should.be.a('function');
|
||||
|
||||
(5).should.be.a('number');
|
||||
|
||||
err(function(){
|
||||
(5).should.not.be.a('number');
|
||||
}, "expected 5 not to be a number");
|
||||
});
|
||||
|
||||
test('instanceof', function(){
|
||||
function Foo(){}
|
||||
new Foo().should.be.an.instanceof(Foo);
|
||||
|
||||
err(function(){
|
||||
(3).should.an.instanceof(Foo);
|
||||
}, "expected 3 to be an instance of Foo");
|
||||
});
|
||||
|
||||
test('within(start, finish)', function(){
|
||||
(5).should.be.within(5, 10);
|
||||
(5).should.be.within(3,6);
|
||||
(5).should.be.within(3,5);
|
||||
(5).should.not.be.within(1,3);
|
||||
|
||||
err(function(){
|
||||
(5).should.not.be.within(4,6);
|
||||
}, "expected 5 to not be within 4..6");
|
||||
|
||||
err(function(){
|
||||
(10).should.be.within(50,100);
|
||||
}, "expected 10 to be within 50..100");
|
||||
});
|
||||
|
||||
test('above(n)', function(){
|
||||
(5).should.be.above(2);
|
||||
(5).should.be.greaterThan(2);
|
||||
(5).should.not.be.above(5);
|
||||
(5).should.not.be.above(6);
|
||||
|
||||
err(function(){
|
||||
(5).should.be.above(6);
|
||||
}, "expected 5 to be above 6");
|
||||
|
||||
err(function(){
|
||||
(10).should.not.be.above(6);
|
||||
}, "expected 10 to be below 6");
|
||||
});
|
||||
|
||||
test('below(n)', function(){
|
||||
(2).should.be.below(5);
|
||||
(2).should.be.lessThan(5);
|
||||
(2).should.not.be.below(2);
|
||||
(2).should.not.be.below(1);
|
||||
|
||||
err(function(){
|
||||
(6).should.be.below(5);
|
||||
}, "expected 6 to be below 5");
|
||||
|
||||
err(function(){
|
||||
(6).should.not.be.below(10);
|
||||
}, "expected 6 to be above 10");
|
||||
});
|
||||
|
||||
test('match(regexp)', function(){
|
||||
'foobar'.should.match(/^foo/)
|
||||
'foobar'.should.not.match(/^bar/)
|
||||
|
||||
err(function(){
|
||||
'foobar'.should.match(/^bar/i)
|
||||
}, "expected 'foobar' to match /^bar/i");
|
||||
|
||||
err(function(){
|
||||
'foobar'.should.not.match(/^foo/i)
|
||||
}, "expected 'foobar' not to match /^foo/i");
|
||||
});
|
||||
|
||||
test('length(n)', function(){
|
||||
'test'.should.have.length(4);
|
||||
'test'.should.not.have.length(3);
|
||||
[1,2,3].should.have.length(3);
|
||||
|
||||
err(function(){
|
||||
(4).should.have.length(3);
|
||||
}, 'expected 4 to have a property \'length\'');
|
||||
|
||||
err(function(){
|
||||
'asd'.should.not.have.length(3);
|
||||
}, "expected 'asd' to not have a length of 3");
|
||||
});
|
||||
|
||||
test('eql(val)', function(){
|
||||
'test'.should.eql('test');
|
||||
({ foo: 'bar' }).should.eql({ foo: 'bar' });
|
||||
(1).should.eql(1);
|
||||
'4'.should.not.eql(4);
|
||||
|
||||
err(function(){
|
||||
(4).should.eql(3);
|
||||
}, 'expected 4 to equal 3');
|
||||
});
|
||||
|
||||
test('equal(val)', function(){
|
||||
'test'.should.equal('test');
|
||||
(1).should.equal(1);
|
||||
|
||||
err(function(){
|
||||
(4).should.equal(3);
|
||||
}, 'expected 4 to equal 3');
|
||||
|
||||
err(function(){
|
||||
'4'.should.equal(4);
|
||||
}, "expected '4' to equal 4");
|
||||
});
|
||||
|
||||
test('empty', function(){
|
||||
function FakeArgs() {};
|
||||
FakeArgs.prototype.length = 0;
|
||||
|
||||
''.should.be.empty;
|
||||
'foo'.should.not.be.empty;
|
||||
([]).should.be.empty;
|
||||
(['foo']).should.not.be.empty;
|
||||
(new FakeArgs).should.be.empty;
|
||||
({arguments: 0}).should.not.be.empty;
|
||||
({}).should.be.empty;
|
||||
({foo: 'bar'}).should.not.be.empty;
|
||||
|
||||
err(function(){
|
||||
''.should.not.be.empty;
|
||||
}, "expected \'\' not to be empty");
|
||||
|
||||
err(function(){
|
||||
'foo'.should.be.empty;
|
||||
}, "expected \'foo\' to be empty");
|
||||
|
||||
err(function(){
|
||||
([]).should.not.be.empty;
|
||||
}, "expected [] not to be empty");
|
||||
|
||||
err(function(){
|
||||
(['foo']).should.be.empty;
|
||||
}, "expected [ \'foo\' ] to be empty");
|
||||
|
||||
err(function(){
|
||||
(new FakeArgs).should.not.be.empty;
|
||||
}, "expected {} not to be empty");
|
||||
|
||||
err(function(){
|
||||
({arguments: 0}).should.be.empty;
|
||||
}, "expected { arguments: 0 } to be empty");
|
||||
|
||||
err(function(){
|
||||
({}).should.not.be.empty;
|
||||
}, "expected {} not to be empty");
|
||||
|
||||
err(function(){
|
||||
({foo: 'bar'}).should.be.empty;
|
||||
}, "expected { foo: \'bar\' } to be empty");
|
||||
});
|
||||
|
||||
test('property(name)', function(){
|
||||
'test'.should.have.property('length');
|
||||
(4).should.not.have.property('length');
|
||||
|
||||
err(function(){
|
||||
'asd'.should.have.property('foo');
|
||||
}, "expected 'asd' to have a property 'foo'");
|
||||
});
|
||||
|
||||
test('property(name, val)', function(){
|
||||
'test'.should.have.property('length', 4);
|
||||
'asd'.should.have.property('constructor', String);
|
||||
|
||||
err(function(){
|
||||
'asd'.should.have.property('length', 4);
|
||||
}, "expected 'asd' to have a property 'length' of 4, but got 3");
|
||||
|
||||
err(function(){
|
||||
'asd'.should.not.have.property('length', 3);
|
||||
}, "expected 'asd' to not have a property 'length' of 3");
|
||||
|
||||
err(function(){
|
||||
'asd'.should.not.have.property('foo', 3);
|
||||
}, "'asd' has no property 'foo'");
|
||||
|
||||
err(function(){
|
||||
'asd'.should.have.property('constructor', Number);
|
||||
}, "expected 'asd' to have a property 'constructor' of [Function: Number], but got [Function: String]");
|
||||
});
|
||||
|
||||
test('ownProperty(name)', function(){
|
||||
'test'.should.have.ownProperty('length');
|
||||
'test'.should.haveOwnProperty('length');
|
||||
({ length: 12 }).should.have.ownProperty('length');
|
||||
|
||||
err(function(){
|
||||
({ length: 12 }).should.not.have.ownProperty('length');
|
||||
}, "expected { length: 12 } to not have own property 'length'");
|
||||
});
|
||||
|
||||
test('string()', function(){
|
||||
'foobar'.should.contain.string('bar');
|
||||
'foobar'.should.contain.string('foo');
|
||||
'foobar'.should.not.contain.string('baz');
|
||||
|
||||
err(function(){
|
||||
(3).should.contain.string('baz');
|
||||
}, "expected 3 to be a string");
|
||||
|
||||
err(function(){
|
||||
'foobar'.should.contain.string('baz');
|
||||
}, "expected 'foobar' to contain 'baz'");
|
||||
|
||||
err(function(){
|
||||
'foobar'.should.not.contain.string('bar');
|
||||
}, "expected 'foobar' to not contain 'bar'");
|
||||
});
|
||||
|
||||
test('include()', function(){
|
||||
['foo', 'bar'].should.include('foo');
|
||||
['foo', 'bar'].should.include('foo');
|
||||
['foo', 'bar'].should.include('bar');
|
||||
[1,2].should.include(1);
|
||||
['foo', 'bar'].should.not.include('baz');
|
||||
['foo', 'bar'].should.not.include(1);
|
||||
|
||||
err(function(){
|
||||
['foo'].should.include('bar');
|
||||
}, "expected [ 'foo' ] to include 'bar'");
|
||||
|
||||
err(function(){
|
||||
['bar', 'foo'].should.not.include('foo');
|
||||
}, "expected [ 'bar', 'foo' ] to not include 'foo'");
|
||||
});
|
||||
|
||||
test('keys(array)', function(){
|
||||
({ foo: 1 }).should.have.keys(['foo']);
|
||||
({ foo: 1, bar: 2 }).should.have.keys(['foo', 'bar']);
|
||||
({ foo: 1, bar: 2 }).should.have.keys('foo', 'bar');
|
||||
({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('foo', 'bar');
|
||||
({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('bar', 'foo');
|
||||
({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('baz');
|
||||
|
||||
({ foo: 1, bar: 2 }).should.contain.keys('foo');
|
||||
({ foo: 1, bar: 2 }).should.contain.keys('bar', 'foo');
|
||||
({ foo: 1, bar: 2 }).should.contain.keys(['foo']);
|
||||
({ foo: 1, bar: 2 }).should.contain.keys(['bar']);
|
||||
({ foo: 1, bar: 2 }).should.contain.keys(['bar', 'foo']);
|
||||
|
||||
({ foo: 1, bar: 2 }).should.not.have.keys('baz');
|
||||
({ foo: 1, bar: 2 }).should.not.have.keys('foo', 'baz');
|
||||
({ foo: 1, bar: 2 }).should.not.contain.keys('baz');
|
||||
({ foo: 1, bar: 2 }).should.not.contain.keys('foo', 'baz');
|
||||
({ foo: 1, bar: 2 }).should.not.contain.keys('baz', 'foo');
|
||||
|
||||
err(function(){
|
||||
({ foo: 1 }).should.have.keys();
|
||||
}, "keys required");
|
||||
|
||||
err(function(){
|
||||
({ foo: 1 }).should.have.keys([]);
|
||||
}, "keys required");
|
||||
|
||||
err(function(){
|
||||
({ foo: 1 }).should.not.have.keys([]);
|
||||
}, "keys required");
|
||||
|
||||
err(function(){
|
||||
({ foo: 1 }).should.contain.keys([]);
|
||||
}, "keys required");
|
||||
|
||||
err(function(){
|
||||
({ foo: 1 }).should.have.keys(['bar']);
|
||||
}, "expected { foo: 1 } to have key 'bar'");
|
||||
|
||||
err(function(){
|
||||
({ foo: 1 }).should.have.keys(['bar', 'baz']);
|
||||
}, "expected { foo: 1 } to have keys 'bar', and 'baz'");
|
||||
|
||||
err(function(){
|
||||
({ foo: 1 }).should.have.keys(['foo', 'bar', 'baz']);
|
||||
}, "expected { foo: 1 } to have keys 'foo', 'bar', and 'baz'");
|
||||
|
||||
err(function(){
|
||||
({ foo: 1 }).should.not.have.keys(['foo']);
|
||||
}, "expected { foo: 1 } to not have key 'foo'");
|
||||
|
||||
err(function(){
|
||||
({ foo: 1 }).should.not.have.keys(['foo']);
|
||||
}, "expected { foo: 1 } to not have key 'foo'");
|
||||
|
||||
err(function(){
|
||||
({ foo: 1, bar: 2 }).should.not.have.keys(['foo', 'bar']);
|
||||
}, "expected { foo: 1, bar: 2 } to not have keys 'foo', and 'bar'");
|
||||
|
||||
err(function(){
|
||||
({ foo: 1 }).should.not.contain.keys(['foo']);
|
||||
}, "expected { foo: 1 } to not contain key 'foo'");
|
||||
|
||||
err(function(){
|
||||
({ foo: 1 }).should.contain.keys('foo', 'bar');
|
||||
}, "expected { foo: 1 } to contain keys 'foo', and 'bar'");
|
||||
});
|
||||
|
||||
test('throw', function () {
|
||||
var goodFn = function () { 1==1; }
|
||||
, badFn = function () { throw new Error('testing'); }
|
||||
, refErrFn = function () { throw new ReferenceError('hello'); };
|
||||
|
||||
(goodFn).should.not.throw();
|
||||
(goodFn).should.not.throw(Error);
|
||||
(badFn).should.throw();
|
||||
(badFn).should.throw(Error);
|
||||
(badFn).should.not.throw(ReferenceError);
|
||||
(refErrFn).should.throw();
|
||||
(refErrFn).should.throw(ReferenceError);
|
||||
(refErrFn).should.not.throw(Error);
|
||||
(refErrFn).should.not.throw(TypeError);
|
||||
|
||||
(badFn).should.throw(/testing/);
|
||||
(badFn).should.throw('testing');
|
||||
(badFn).should.not.throw(/hello/);
|
||||
(badFn).should.throw(Error, /testing/);
|
||||
(badFn).should.throw(Error, 'testing');
|
||||
|
||||
should.throw(badFn);
|
||||
should.throw(refErrFn, ReferenceError);
|
||||
should.not.throw(goodFn);
|
||||
should.not.throw(badFn, ReferenceError);
|
||||
|
||||
should.throw(badFn, Error, /testing/);
|
||||
should.throw(badFn, Error, 'testing');
|
||||
|
||||
err(function(){
|
||||
(goodFn).should.throw();
|
||||
}, "expected [Function] to throw an error");
|
||||
|
||||
err(function(){
|
||||
(goodFn).should.throw(ReferenceError);
|
||||
}, "expected [Function] to throw ReferenceError");
|
||||
|
||||
err(function(){
|
||||
(badFn).should.not.throw();
|
||||
}, "expected [Function] to not throw an error");
|
||||
|
||||
err(function(){
|
||||
(badFn).should.throw(ReferenceError);
|
||||
}, "expected [Function] to throw ReferenceError but a Error was thrown");
|
||||
|
||||
err(function(){
|
||||
(badFn).should.not.throw(Error);
|
||||
}, "expected [Function] to not throw Error");
|
||||
|
||||
err(function(){
|
||||
(refErrFn).should.not.throw(ReferenceError);
|
||||
}, "expected [Function] to not throw ReferenceError");
|
||||
|
||||
err(function(){
|
||||
(refErrFn).should.throw(Error);
|
||||
}, "expected [Function] to throw Error but a ReferenceError was thrown");
|
||||
|
||||
err(function (){
|
||||
(badFn).should.not.throw(/testing/);
|
||||
}, "expected [Function] to throw error not matching /testing/");
|
||||
|
||||
err(function () {
|
||||
(badFn).should.throw(/hello/);
|
||||
}, "expected [Function] to throw error matching /hello/ but got \'testing\'");
|
||||
|
||||
err(function () {
|
||||
(badFn).should.throw(Error, /hello/);
|
||||
}, "expected [Function] to throw error matching /hello/ but got 'testing'");
|
||||
|
||||
err(function () {
|
||||
(badFn).should.throw(Error, 'hello');
|
||||
}, "expected [Function] to throw error including 'hello' but got 'testing'");
|
||||
});
|
||||
|
||||
test('respondTo', function(){
|
||||
function Foo(){};
|
||||
Foo.prototype.bar = function(){};
|
||||
|
||||
var bar = {};
|
||||
bar.foo = function(){};
|
||||
|
||||
Foo.should.respondTo('bar');
|
||||
Foo.should.not.respondTo('foo');
|
||||
|
||||
bar.should.respondTo('foo');
|
||||
|
||||
err(function(){
|
||||
Foo.should.respondTo('baz');
|
||||
}, "expected [Function: Foo] to respond to \'baz\'");
|
||||
|
||||
err(function(){
|
||||
bar.should.respondTo('baz');
|
||||
}, "expected { foo: [Function] } to respond to \'baz\'");
|
||||
});
|
||||
|
||||
test('satisfy', function(){
|
||||
var matcher = function(num){
|
||||
return num === 1;
|
||||
};
|
||||
|
||||
(1).should.satisfy(matcher);
|
||||
|
||||
err(function(){
|
||||
(2).should.satisfy(matcher);
|
||||
}, "expected 2 to satisfy [Function]");
|
||||
});
|
||||
|
||||
test('closeTo', function(){
|
||||
(1.5).should.be.closeTo(1.0, 0.5);
|
||||
|
||||
err(function(){
|
||||
(2).should.be.closeTo(1.0, 0.5);
|
||||
}, "expected 2 to be close to 1 +/- 0.5");
|
||||
});
|
||||
});
|
|
@ -1,47 +0,0 @@
|
|||
.antiscroll-wrap {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.antiscroll-scrollbar {
|
||||
background: #666;
|
||||
background: rgba(0, 0, 0, .6);
|
||||
-webkit-border-radius: 7px;
|
||||
-moz-border-radius: 7px;
|
||||
border-radius: 7px;
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
|
||||
-webkit-transition: linear 300ms opacity;
|
||||
-moz-transition: linear 300ms opacity;
|
||||
-o-transition: linear 300ms opacity;
|
||||
}
|
||||
|
||||
.antiscroll-scrollbar-shown {
|
||||
opacity: 1;
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
|
||||
}
|
||||
|
||||
.antiscroll-scrollbar-horizontal {
|
||||
height: 7px;
|
||||
margin-left: 2px;
|
||||
bottom: 2px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.antiscroll-scrollbar-vertical {
|
||||
width: 7px;
|
||||
margin-top: 2px;
|
||||
right: 2px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.antiscroll-inner {
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.antiscroll-inner::-webkit-scrollbar, .antiscroll-inner::scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 27 KiB |
|
@ -1,403 +0,0 @@
|
|||
|
||||
(function ($) {
|
||||
|
||||
/**
|
||||
* Augment jQuery prototype.
|
||||
*/
|
||||
|
||||
$.fn.antiscroll = function (options) {
|
||||
return this.each(function () {
|
||||
if ($(this).data('antiscroll')) {
|
||||
$(this).data('antiscroll').destroy();
|
||||
}
|
||||
|
||||
$(this).data('antiscroll', new $.Antiscroll(this, options));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose constructor.
|
||||
*/
|
||||
|
||||
$.Antiscroll = Antiscroll;
|
||||
|
||||
/**
|
||||
* Antiscroll pane constructor.
|
||||
*
|
||||
* @param {Element|jQuery} main pane
|
||||
* @parma {Object} options
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Antiscroll (el, opts) {
|
||||
this.el = $(el);
|
||||
this.options = opts || {};
|
||||
this.padding = undefined == this.options.padding ? 2 : this.options.padding;
|
||||
this.inner = this.el.find('.antiscroll-inner');
|
||||
this.inner.css({
|
||||
'width': '+=' + scrollbarSize()
|
||||
, 'height': '+=' + scrollbarSize()
|
||||
});
|
||||
|
||||
if (this.inner.get(0).scrollWidth > this.el.width()) {
|
||||
this.horizontal = new Scrollbar.Horizontal(this);
|
||||
}
|
||||
|
||||
if (this.inner.get(0).scrollHeight > this.el.height()) {
|
||||
this.vertical = new Scrollbar.Vertical(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up.
|
||||
*
|
||||
* @return {Antiscroll} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Antiscroll.prototype.destroy = function () {
|
||||
if (this.horizontal) {
|
||||
this.horizontal.destroy();
|
||||
}
|
||||
if (this.vertical) {
|
||||
this.vertical.destroy();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scrolbar constructor.
|
||||
*
|
||||
* @param {Element|jQuery} element
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Scrollbar (pane) {
|
||||
this.pane = pane;
|
||||
this.pane.el.append(this.el);
|
||||
this.innerEl = this.pane.inner.get(0);
|
||||
|
||||
this.dragging = false;
|
||||
this.enter = false;
|
||||
this.shown = false;
|
||||
|
||||
// hovering
|
||||
this.pane.el.mouseenter($.proxy(this, 'mouseenter'));
|
||||
this.pane.el.mouseleave($.proxy(this, 'mouseleave'));
|
||||
|
||||
// dragging
|
||||
this.el.mousedown($.proxy(this, 'mousedown'));
|
||||
|
||||
// scrolling
|
||||
this.pane.inner.scroll($.proxy(this, 'scroll'));
|
||||
|
||||
// wheel -optional-
|
||||
this.pane.inner.bind('mousewheel', $.proxy(this, 'mousewheel'));
|
||||
|
||||
// show
|
||||
var initialDisplay = this.pane.options.initialDisplay;
|
||||
|
||||
if (initialDisplay !== false) {
|
||||
this.show();
|
||||
this.hiding = setTimeout($.proxy(this, 'hide'), parseInt(initialDisplay, 10) || 3000);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Cleans up.
|
||||
*
|
||||
* @return {Scrollbar} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.destroy = function () {
|
||||
this.el.remove();
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon mouseenter.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.mouseenter = function () {
|
||||
this.enter = true;
|
||||
this.show();
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon mouseleave.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.mouseleave = function () {
|
||||
this.enter = false;
|
||||
|
||||
if (!this.dragging) {
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called upon wrap scroll.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.scroll = function () {
|
||||
if (!this.shown) {
|
||||
this.show();
|
||||
if (!this.enter && !this.dragging) {
|
||||
this.hiding = setTimeout($.proxy(this, 'hide'), 1500);
|
||||
}
|
||||
}
|
||||
|
||||
this.update();
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon scrollbar mousedown.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.mousedown = function (ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
this.dragging = true;
|
||||
|
||||
this.startPageY = ev.pageY - parseInt(this.el.css('top'), 10);
|
||||
this.startPageX = ev.pageX - parseInt(this.el.css('left'), 10);
|
||||
|
||||
// prevent crazy selections on IE
|
||||
document.onselectstart = function () { return false; };
|
||||
|
||||
var pane = this.pane
|
||||
, move = $.proxy(this, 'mousemove')
|
||||
, self = this
|
||||
|
||||
$(document)
|
||||
.mousemove(move)
|
||||
.mouseup(function () {
|
||||
self.dragging = false;
|
||||
document.onselectstart = null;
|
||||
|
||||
$(document).unbind('mousemove', move);
|
||||
|
||||
if (!self.enter) {
|
||||
self.hide();
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
/**
|
||||
* Show scrollbar.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.show = function (duration) {
|
||||
if (!this.shown) {
|
||||
this.update();
|
||||
this.el.addClass('antiscroll-scrollbar-shown');
|
||||
if (this.hiding) {
|
||||
clearTimeout(this.hiding);
|
||||
this.hiding = null;
|
||||
}
|
||||
this.shown = true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Hide scrollbar.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.prototype.hide = function () {
|
||||
if (this.shown) {
|
||||
// check for dragging
|
||||
this.el.removeClass('antiscroll-scrollbar-shown');
|
||||
this.shown = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Horizontal scrollbar constructor
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Horizontal = function (pane) {
|
||||
this.el = $('<div class="antiscroll-scrollbar antiscroll-scrollbar-horizontal">');
|
||||
Scrollbar.call(this, pane);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherits from Scrollbar.
|
||||
*/
|
||||
|
||||
inherits(Scrollbar.Horizontal, Scrollbar);
|
||||
|
||||
/**
|
||||
* Updates size/position of scrollbar.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Horizontal.prototype.update = function () {
|
||||
var paneWidth = this.pane.el.width()
|
||||
, trackWidth = paneWidth - this.pane.padding * 2
|
||||
, innerEl = this.pane.inner.get(0)
|
||||
|
||||
this.el
|
||||
.css('width', trackWidth * paneWidth / innerEl.scrollWidth)
|
||||
.css('left', trackWidth * innerEl.scrollLeft / innerEl.scrollWidth)
|
||||
}
|
||||
|
||||
/**
|
||||
* Called upon drag.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Horizontal.prototype.mousemove = function (ev) {
|
||||
var trackWidth = this.pane.el.width() - this.pane.padding * 2
|
||||
, pos = ev.pageX - this.startPageX
|
||||
, barWidth = this.el.width()
|
||||
, innerEl = this.pane.inner.get(0)
|
||||
|
||||
// minimum top is 0, maximum is the track height
|
||||
var y = Math.min(Math.max(pos, 0), trackWidth - barWidth)
|
||||
|
||||
innerEl.scrollLeft = (innerEl.scrollWidth - this.pane.el.width())
|
||||
* y / (trackWidth - barWidth)
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon container mousewheel.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Horizontal.prototype.mousewheel = function (ev, delta, x, y) {
|
||||
if ((x < 0 && 0 == this.pane.inner.get(0).scrollLeft) ||
|
||||
(x > 0 && (this.innerEl.scrollLeft + this.pane.el.width()
|
||||
== this.innerEl.scrollWidth))) {
|
||||
ev.preventDefault();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Vertical scrollbar constructor
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Vertical = function (pane) {
|
||||
this.el = $('<div class="antiscroll-scrollbar antiscroll-scrollbar-vertical">');
|
||||
Scrollbar.call(this, pane);
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherits from Scrollbar.
|
||||
*/
|
||||
|
||||
inherits(Scrollbar.Vertical, Scrollbar);
|
||||
|
||||
/**
|
||||
* Updates size/position of scrollbar.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Vertical.prototype.update = function () {
|
||||
var paneHeight = this.pane.el.height()
|
||||
, trackHeight = paneHeight - this.pane.padding * 2
|
||||
, innerEl = this.innerEl
|
||||
|
||||
this.el
|
||||
.css('height', trackHeight * paneHeight / innerEl.scrollHeight)
|
||||
.css('top', trackHeight * innerEl.scrollTop / innerEl.scrollHeight)
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon drag.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Vertical.prototype.mousemove = function (ev) {
|
||||
var paneHeight = this.pane.el.height()
|
||||
, trackHeight = paneHeight - this.pane.padding * 2
|
||||
, pos = ev.pageY - this.startPageY
|
||||
, barHeight = this.el.height()
|
||||
, innerEl = this.innerEl
|
||||
|
||||
// minimum top is 0, maximum is the track height
|
||||
var y = Math.min(Math.max(pos, 0), trackHeight - barHeight)
|
||||
|
||||
innerEl.scrollTop = (innerEl.scrollHeight - paneHeight)
|
||||
* y / (trackHeight - barHeight)
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon container mousewheel.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scrollbar.Vertical.prototype.mousewheel = function (ev, delta, x, y) {
|
||||
if ((y > 0 && 0 == this.innerEl.scrollTop) ||
|
||||
(y < 0 && (this.innerEl.scrollTop + this.pane.el.height()
|
||||
== this.innerEl.scrollHeight))) {
|
||||
ev.preventDefault();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Cross-browser inheritance.
|
||||
*
|
||||
* @param {Function} constructor
|
||||
* @param {Function} constructor we inherit from
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function inherits (ctorA, ctorB) {
|
||||
function f() {};
|
||||
f.prototype = ctorB.prototype;
|
||||
ctorA.prototype = new f;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scrollbar size detection.
|
||||
*/
|
||||
|
||||
var size;
|
||||
|
||||
function scrollbarSize () {
|
||||
if (!size) {
|
||||
var div = $(
|
||||
'<div style="width:50px;height:50px;overflow:hidden;'
|
||||
+ 'position:absolute;top:-200px;left:-200px;"><div style="height:100px;">'
|
||||
+ '</div>'
|
||||
);
|
||||
|
||||
$('body').append(div);
|
||||
|
||||
var w1 = $('div', div).innerWidth();
|
||||
div.css('overflow-y', 'scroll');
|
||||
var w2 = $('div', div).innerWidth();
|
||||
$(div).remove();
|
||||
|
||||
size = w1 - w2;
|
||||
}
|
||||
|
||||
return size;
|
||||
};
|
||||
|
||||
})(jQuery);
|
|
@ -1,78 +0,0 @@
|
|||
/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
|
||||
* Licensed under the MIT License (LICENSE.txt).
|
||||
*
|
||||
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
|
||||
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
|
||||
* Thanks to: Seamus Leahy for adding deltaX and deltaY
|
||||
*
|
||||
* Version: 3.0.4
|
||||
*
|
||||
* Requires: 1.2.2+
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
var types = ['DOMMouseScroll', 'mousewheel'];
|
||||
|
||||
$.event.special.mousewheel = {
|
||||
setup: function() {
|
||||
if ( this.addEventListener ) {
|
||||
for ( var i=types.length; i; ) {
|
||||
this.addEventListener( types[--i], handler, false );
|
||||
}
|
||||
} else {
|
||||
this.onmousewheel = handler;
|
||||
}
|
||||
},
|
||||
|
||||
teardown: function() {
|
||||
if ( this.removeEventListener ) {
|
||||
for ( var i=types.length; i; ) {
|
||||
this.removeEventListener( types[--i], handler, false );
|
||||
}
|
||||
} else {
|
||||
this.onmousewheel = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
mousewheel: function(fn) {
|
||||
return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
|
||||
},
|
||||
|
||||
unmousewheel: function(fn) {
|
||||
return this.unbind("mousewheel", fn);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function handler(event) {
|
||||
var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
|
||||
event = $.event.fix(orgEvent);
|
||||
event.type = "mousewheel";
|
||||
|
||||
// Old school scrollwheel delta
|
||||
if ( event.wheelDelta ) { delta = event.wheelDelta/120; }
|
||||
if ( event.detail ) { delta = -event.detail/3; }
|
||||
|
||||
// New school multidimensional scroll (touchpads) deltas
|
||||
deltaY = delta;
|
||||
|
||||
// Gecko
|
||||
if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
|
||||
deltaY = 0;
|
||||
deltaX = -1*delta;
|
||||
}
|
||||
|
||||
// Webkit
|
||||
if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
|
||||
if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
|
||||
|
||||
// Add event and delta to the front of the arguments
|
||||
args.unshift(event, delta, deltaX, deltaY);
|
||||
|
||||
return $.event.handle.apply(this, args);
|
||||
}
|
||||
|
||||
})(jQuery);
|
|
@ -1,81 +0,0 @@
|
|||
$(function () {
|
||||
|
||||
$.ajax({
|
||||
url: "http://github.com/api/v2/json/commits/list/" + ghuser + "/" + ghproject + "/master",
|
||||
dataType: 'jsonp',
|
||||
success: function(json) {
|
||||
var latest = json.commits[0],
|
||||
stamp = new Date(latest.committed_date),
|
||||
stampString = month[stamp.getMonth()] + ' ' + stamp.getDate() + ', ' + stamp.getFullYear();
|
||||
|
||||
$('#latestCommitMessage').text(latest.message);
|
||||
$('#latestCommitTime').text(stampString);
|
||||
$('#latestCommitURL').html(' - commit ' + latest.id.substring(0, 6));
|
||||
$('#latestCommitURL').attr('href', "https://github.com" + latest.url);
|
||||
}
|
||||
});
|
||||
|
||||
var month = new Array(12);
|
||||
month[0] = "Jan";
|
||||
month[1] = "Feb";
|
||||
month[2] = "Mar";
|
||||
month[3] = "Apr";
|
||||
month[4] = "May";
|
||||
month[5] = "Jun";
|
||||
month[6] = "Jul";
|
||||
month[7] = "Aug";
|
||||
month[8] = "Sep";
|
||||
month[9] = "Oct";
|
||||
month[10] = "Nov";
|
||||
month[11] = "Dec";
|
||||
|
||||
|
||||
$(function () {
|
||||
$('.box-wrap').antiscroll();
|
||||
});
|
||||
|
||||
$('pre code').addClass('prettyprint');
|
||||
prettyPrint();
|
||||
|
||||
$('a.scroll').click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var section = $(this).attr('href')
|
||||
, $scrollto = $(section + '-section');
|
||||
|
||||
$('html,body').animate({
|
||||
scrollTop: $scrollto.offset().top
|
||||
});
|
||||
});
|
||||
|
||||
$('.view-source').click(function(){
|
||||
var $obj = $(this).next('.code-wrap')
|
||||
, will = ($obj.css('display') == 'none') ? true : false;
|
||||
|
||||
$obj.toggle(200);
|
||||
|
||||
if (will) {
|
||||
$('html,body').animate({
|
||||
scrollTop: $obj.offset().top
|
||||
});
|
||||
}
|
||||
|
||||
var tag = $(this).siblings('.header').find('h1').text()
|
||||
, action = (will) ? 'opened' : 'closed'
|
||||
, note = 'User ' + action + ' ' + tag + '.';
|
||||
|
||||
mpq.track('View Source clicked', {
|
||||
'tag': tag,
|
||||
'action': action,
|
||||
'mp_note': note
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('a.button.github').click(function () {
|
||||
mpq.track('Github Fork clicked');
|
||||
});
|
||||
|
||||
$('.code-wrap').hide();
|
||||
});
|
|
@ -1,28 +0,0 @@
|
|||
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
|
||||
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
|
||||
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
|
||||
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
|
||||
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
|
||||
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
|
||||
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
|
||||
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
|
||||
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
|
||||
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
|
||||
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
|
||||
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
|
||||
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
|
||||
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
|
||||
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
|
||||
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
|
||||
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
|
||||
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
|
||||
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
|
||||
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
|
||||
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
|
||||
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
|
||||
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
|
||||
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
|
||||
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
|
||||
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
|
||||
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();
|
|
@ -1,26 +0,0 @@
|
|||
extends layout
|
||||
|
||||
block nav
|
||||
ul.pages
|
||||
li: a(href= (site.ghbaseurl) ? site.ghbaseurl : '/') Home
|
||||
- if (files.support)
|
||||
for page in files.support
|
||||
li: a(href=site.ghbaseurl + page.href)= page.title
|
||||
- if (files.code)
|
||||
ul.code
|
||||
for page in files.code
|
||||
- if (page.template == 'code-index')
|
||||
li.header: a(href=site.ghbaseurl + page.href)= page.title
|
||||
for page in files.code
|
||||
- if (page.template == 'code')
|
||||
li: a(href=site.ghbaseurl + page.href)= page.title
|
||||
|
||||
block content
|
||||
h1= file.title
|
||||
article
|
||||
.header!= file.prepared
|
||||
.files
|
||||
for spec in files.code
|
||||
unless spec.template == 'code-index'
|
||||
h3: a(href=site.ghbaseurl + spec.href)= spec.title
|
||||
p!= spec.description
|
|
@ -1,72 +0,0 @@
|
|||
extends layout
|
||||
|
||||
block title
|
||||
title API Documentation for #{file.title} - #{site.title}
|
||||
|
||||
block nav
|
||||
.box-wrap.antiscroll-wrap
|
||||
.box
|
||||
.antiscroll-inner
|
||||
.box-inner
|
||||
ul.sections
|
||||
for comment in file.prepared
|
||||
unless comment.ignore
|
||||
for tag in comment.tags
|
||||
- if (tag.type == 'name')
|
||||
- comment.anchor = tag.string
|
||||
li.keepcase: a.scroll(href='#' + tag.string)= tag.string
|
||||
ul.pages
|
||||
li: a(href= (site.ghbaseurl) ? site.ghbaseurl : '/') Home
|
||||
- if (files.support)
|
||||
for page in files.support
|
||||
li: a(href=site.ghbaseurl + page.href)= page.title
|
||||
- if (files.code)
|
||||
ul.code
|
||||
for page in files.code
|
||||
- if (page.template == 'code-index')
|
||||
li.header: a(href=site.ghbaseurl + page.href)= page.title
|
||||
for page in files.code
|
||||
- if (page.template == 'code')
|
||||
li: a(href=site.ghbaseurl + page.href)= page.title
|
||||
|
||||
block content
|
||||
#code
|
||||
for comment in file.prepared
|
||||
unless comment.ignore
|
||||
article.codeblock(id=comment.anchor + '-section')
|
||||
.header!= comment.description.summary
|
||||
- if (comment.ctx && comment.ctx.string)
|
||||
.ctx
|
||||
h3= comment.ctx.string
|
||||
- if (comment.tags.length)
|
||||
.tags
|
||||
each tag in comment.tags
|
||||
- if (tag.type == 'api')
|
||||
.tag
|
||||
span.type @#{tag.type}
|
||||
span.visibility #{tag.visibility}
|
||||
- else if (tag.type == 'param')
|
||||
-var types = tag.types.join(' | ')
|
||||
.tag
|
||||
span.type @#{tag.type}
|
||||
span.types { #{types} }
|
||||
span.name #{tag.name}
|
||||
span.desc #{tag.description}
|
||||
- else if (tag.type == 'see')
|
||||
.tag
|
||||
span.type @#{tag.type}
|
||||
span.name #{tag.local}
|
||||
- else if (tag.type == 'name')
|
||||
// ignroing this
|
||||
- else
|
||||
.tag
|
||||
span.type @#{tag.type}
|
||||
span.desc #{tag.string}
|
||||
- console.log('unknown tag in file: ' + file.title)
|
||||
- console.log(tag)
|
||||
.description!= comment.description.body
|
||||
- if (comment.code)
|
||||
.view-source View Source
|
||||
.code-wrap
|
||||
pre.source.prettyprint
|
||||
code= comment.code
|
|
@ -1,30 +0,0 @@
|
|||
extends layout
|
||||
|
||||
block nav
|
||||
- if (files.home)
|
||||
ul.sections
|
||||
for page in files.home
|
||||
- var href = page.href.split('/')
|
||||
- href = href[href.length - 2]
|
||||
li: a.scroll(href='#' + href)= (page.menu || page.title)
|
||||
- if (files.support)
|
||||
ul.pages
|
||||
for page in files.support
|
||||
li: a(href=site.ghbaseurl + page.href)= page.title
|
||||
- if (files.code)
|
||||
ul.code
|
||||
for page in files.code
|
||||
- if (page.template == 'code-index')
|
||||
li.header: a(href=site.ghbaseurl + page.href)= page.title
|
||||
for page in files.code
|
||||
- if (page.template == 'code')
|
||||
li: a(href=site.ghbaseurl + page.href)= page.title
|
||||
|
||||
block content
|
||||
article!= file.prepared
|
||||
if (files.home)
|
||||
for section in files.home
|
||||
- var href = section.href.split('/')
|
||||
- href = href[href.length - 2]
|
||||
h1(id=href + '-section'): a(name=href)= section.title
|
||||
section!= section.prepared
|
|
@ -1,94 +0,0 @@
|
|||
!!!5
|
||||
html(lang='en')
|
||||
head
|
||||
block title
|
||||
title #{file.title} - #{site.title}
|
||||
script(type='text/javascript')
|
||||
var ghuser = '#{site.ghuser}'
|
||||
, ghproject = '#{site.ghproject}';
|
||||
script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js')
|
||||
script(src=site.ghbaseurl + '/public/js/jq-mousewheel.js')
|
||||
script(src=site.ghbaseurl + '/public/js/antiscroll.js')
|
||||
script(src=site.ghbaseurl + '/public/js/prettify.js')
|
||||
script(src=site.ghbaseurl + '/public/js/main.js')
|
||||
link(rel='stylesheet', href=site.ghbaseurl + '/public/css/antiscroll.css', type='text/css', media='all')
|
||||
link(rel='stylesheet', href=site.ghbaseurl + '/public/css/main.css', type='text/css', media='all')
|
||||
link(href='http://fonts.googleapis.com/css?family=Lato:300|Redressed', rel='stylesheet', type='text/css')
|
||||
- if (site.mixpanel)
|
||||
script(type='text/javascript')
|
||||
var mpq = [];
|
||||
mpq.push(["init", "#{site.mixpanel}"]);
|
||||
(function(){var b,a,e,d,c;b=document.createElement("script");b.type="text/javascript";
|
||||
b.async=true;b.src=(document.location.protocol==="https:"?"https:":"http:")+
|
||||
"//api.mixpanel.com/site_media/js/api/mixpanel.js";a=document.getElementsByTagName("script")[0];
|
||||
a.parentNode.insertBefore(b,a);e=function(f){return function(){mpq.push(
|
||||
[f].concat(Array.prototype.slice.call(arguments,0)))}};d=["init","track","track_links",
|
||||
"track_forms","register","register_once","identify","name_tag","set_config"];for(c=0;c<
|
||||
d.length;c++){mpq[d[c]]=e(d[c])}})();
|
||||
- if (site.googleanalytics)
|
||||
script(type='text/javascript')
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', '#{site.googleanalytics}']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
body
|
||||
nav
|
||||
block nav
|
||||
ul.pages
|
||||
li: a(href= (site.ghbaseurl) ? site.ghbaseurl : '/') Home
|
||||
- console.log(files);
|
||||
- if (files.page)
|
||||
for page in files.page
|
||||
- if (page.template == 'code')
|
||||
li: a(href=site.ghbaseurl + page.href)= page.title
|
||||
- if (files.code)
|
||||
ul.code
|
||||
for page in files.code
|
||||
- if (page.template == 'code-index')
|
||||
li.header: a(href=site.ghbaseurl + page.href)= page.title
|
||||
for page in files.code
|
||||
- if (page.template == 'code')
|
||||
li: a(href=site.ghbaseurl + page.href)= page.title
|
||||
header
|
||||
block header
|
||||
h1: a(href= (site.ghbaseurl) ? site.ghbaseurl : '/'): img(src=site.ghbaseurl + '/public/img/chai-logo.png', title=site.title)
|
||||
.description!= site.description
|
||||
.gh
|
||||
h4 Latest Update to Github
|
||||
#commit
|
||||
span#latestCommitTime Loading...
|
||||
a#latestCommitURL
|
||||
#latestCommitMessage Loading...
|
||||
#buttons
|
||||
.btn
|
||||
iframe(src="http://markdotto.github.com/github-buttons/github-btn.html?user=" + site.ghuser + "&repo=" + site.ghproject + "&type=watch&count=true", allowtransparency="true", frameborder="0", scrolling="0", width="110px", height="20px")
|
||||
.btn
|
||||
iframe(src="http://markdotto.github.com/github-buttons/github-btn.html?user=" + site.ghuser + "&repo=" + site.ghproject + "&type=fork&count=true", allowtransparency="true", frameborder="0", scrolling="0", width="110px", height="20px")
|
||||
.btn
|
||||
a(href="htts://twitter.com/share", class="twitter-share-button", data-via=site.tweetvia, data-url=site.tweeturl, data-related=site.tweetrelated) Tweet
|
||||
script
|
||||
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
|
||||
- if (site.twitterfollow && site.twitterfollow.length > 0)
|
||||
.btn
|
||||
a(href="https://twitter.com/" + site.twitterfollow, class="twitter-follow-button", data-show-count="false") Follow @#{site.twitterfollow
|
||||
script
|
||||
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
|
||||
#links
|
||||
a#repoIssues(href='https://github.com/' + site.ghuser + '/' + site.ghproject + '/issues') GitHub Issues
|
||||
- if (site.hasdownloads)
|
||||
a#repoDownload(href='https://github.com/downloads/' + site.ghuser + '/' + site.ghproject + '/' + site.ghproject + '-' + site.version + '.zip')
|
||||
| Download v#{site.version}
|
||||
|
||||
section#content
|
||||
block content
|
||||
.wrap!= file.prepared
|
||||
footer
|
||||
block footer
|
||||
.branding #{site.title} is
|
||||
a(href='http://alogicalparadox.com') a logical paradox
|
||||
| . site generated by
|
||||
a(href='http://codexjs.com') codex.
|
|
@ -1,134 +0,0 @@
|
|||
|
||||
gray = #e6e6e6
|
||||
|
||||
pre
|
||||
padding 15px
|
||||
margin 15px
|
||||
border 1px solid gray
|
||||
border-radius 3px
|
||||
font-size 12px
|
||||
|
||||
.code-wrap
|
||||
scrollbar()
|
||||
clearfix()
|
||||
|
||||
pre.source
|
||||
max-height 350px
|
||||
overflow-y auto
|
||||
font-size 11px
|
||||
border 1px solid buttonbig
|
||||
|
||||
.codeblock
|
||||
position relative
|
||||
border-top 1px dotted darken(primary, 20%)
|
||||
margin-top 85px
|
||||
h1
|
||||
color buttonbig
|
||||
margin-top 0px !important
|
||||
|
||||
code
|
||||
padding 3px 5px
|
||||
background darken(primary, 5%)
|
||||
|
||||
.ctx h3
|
||||
color darken(primary, 20%)
|
||||
|
||||
.tags
|
||||
padding 15px
|
||||
font-size 12px
|
||||
span
|
||||
margin-right 3px
|
||||
&.type
|
||||
font-weight bold
|
||||
&.types
|
||||
font-style italic
|
||||
|
||||
.view-source
|
||||
button-shiny(buttonsmall, #fff)
|
||||
cursor pointer
|
||||
position absolute
|
||||
top 15px
|
||||
right 0px
|
||||
|
||||
/* Pretty printing styles. Used with prettify.js. */
|
||||
/* Vim sunburst theme by David Leibovic */
|
||||
|
||||
pre .str, code .str
|
||||
color #65B042 /* string - green */
|
||||
|
||||
pre .kwd, code .kwd
|
||||
color #E28964 /* keyword - dark pink */
|
||||
|
||||
pre .com, code .com
|
||||
color #AEAEAE
|
||||
font-style italic /* comment - gray */
|
||||
|
||||
pre .typ, code .typ
|
||||
color #89bdff /* type - light blue */
|
||||
|
||||
pre .lit, code .lit
|
||||
color #3387CC /* literal - blue */
|
||||
|
||||
pre .pun, code .pun
|
||||
color #000 /* punctuation - white */
|
||||
|
||||
pre .pln, code .pln
|
||||
color #000 /* plaintext - white */
|
||||
|
||||
pre .tag, code .tag
|
||||
color #89bdff /* html/xml tag - light blue */
|
||||
|
||||
pre .atn, code .atn
|
||||
color #bdb76b /* html/xml attribute name - khaki */
|
||||
|
||||
pre .atv, code .atv
|
||||
color #65B042 /* html/xml attribute value - green */
|
||||
|
||||
pre .dec, code .dec
|
||||
color #3387CC /* decimal - blue */
|
||||
|
||||
pre.prettyprint,
|
||||
code.prettyprint
|
||||
background-color #fff
|
||||
|
||||
|
||||
pre.prettyprint
|
||||
white-space pre-wrap
|
||||
|
||||
/* Specify class=linenums on a pre to get line numbering */
|
||||
ol.linenums
|
||||
margin-top 0
|
||||
margin-bottom 0
|
||||
color #AEAEAE /* IE indents via margin-left */
|
||||
|
||||
li.L0,li.L1,li.L2,li.L3,li.L4,li.L5,li.L6,li.L7,li.L8,li.L9
|
||||
list-style-type none
|
||||
/* Alternate shading for lines */
|
||||
li.L1,li.L3,li.L5,li.L7,li.L9
|
||||
background-color white
|
||||
|
||||
@media print
|
||||
pre .str, code .str
|
||||
color #060
|
||||
pre .kwd, code .kwd
|
||||
color #006
|
||||
font-weight bold
|
||||
pre .com, code .com
|
||||
color #600
|
||||
font-style italic
|
||||
pre .typ, code .typ
|
||||
color #404
|
||||
font-weight bold
|
||||
pre .lit, code .lit
|
||||
color #044
|
||||
pre .pun, code .pun
|
||||
color #440
|
||||
pre .pln, code .pln
|
||||
color #000
|
||||
pre .tag, code .tag
|
||||
color #006
|
||||
font-weight bold
|
||||
pre .atn, code .atn
|
||||
color #404
|
||||
pre .atv, code .atv
|
||||
color #060
|
|
@ -1,197 +0,0 @@
|
|||
@import 'nib'
|
||||
@import 'fez'
|
||||
@import 'scrollbar'
|
||||
|
||||
global-reset()
|
||||
fez-reset()
|
||||
|
||||
primary = #FAF4E8 //#F2EBD8 // background
|
||||
accent = darken(primary, 60%)//#90BFC9 //darken(#fff, 15%)
|
||||
headers = #784942 //449B33 // BD9462
|
||||
ghbg = #81A27D//E8DEAD
|
||||
|
||||
buttonbig = #A32931
|
||||
buttonsmall = #575639
|
||||
|
||||
body
|
||||
font 13px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif
|
||||
background-color lighten(primary, 50%)
|
||||
|
||||
h1, h2, h3, h4
|
||||
font-family "Redressed", "Helvetica Neue", Helvetica, Arial, sans-serif
|
||||
|
||||
a
|
||||
color buttonbig
|
||||
text-decoration none
|
||||
|
||||
h1
|
||||
color headers
|
||||
font-size 3em
|
||||
> a
|
||||
color headers
|
||||
|
||||
h3
|
||||
color accent
|
||||
font-size 2em
|
||||
margin-top 1em
|
||||
clearfix()
|
||||
> a
|
||||
color accent
|
||||
|
||||
h4
|
||||
font-size 1.5em
|
||||
|
||||
pre
|
||||
background #fff
|
||||
|
||||
em
|
||||
font-style italic
|
||||
font-weight bold
|
||||
|
||||
header, section#content, footer
|
||||
width 740px
|
||||
margin-left 220px
|
||||
|
||||
.box-wrap
|
||||
margin-bottom 50px
|
||||
|
||||
.box, .box .antiscroll-inner
|
||||
max-height 340px
|
||||
width 140px
|
||||
|
||||
header
|
||||
clearfix()
|
||||
margin-top 50px
|
||||
h1
|
||||
font-size 65px
|
||||
a
|
||||
display block
|
||||
width 193px
|
||||
height 217px
|
||||
margin 0px auto
|
||||
overflow hidden
|
||||
.description
|
||||
color lighten(#000, 40%)
|
||||
margin-bottom 1.2em
|
||||
font-size 22px
|
||||
font-family "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif
|
||||
.gh
|
||||
clearfix()
|
||||
background primary
|
||||
border 1px solid darken(primary, 20%)
|
||||
border-radius 5px
|
||||
padding 10px
|
||||
position relative
|
||||
min-height 90px
|
||||
h4
|
||||
text-shadow 1px 1px 0px #fff
|
||||
margin-bottom 10px
|
||||
color lighten(#000, 40%)
|
||||
#latestCommitURL
|
||||
font-size 11px
|
||||
margin-left 10px
|
||||
#commit
|
||||
font-size 10px
|
||||
margin-right 10px
|
||||
line-height 18px
|
||||
padding 0px 5px
|
||||
background lighten(primary, 70%)
|
||||
border-radius 3px
|
||||
float left
|
||||
color darken(primary, 30%)
|
||||
a
|
||||
color darken(primary, 30%)
|
||||
font-style italic
|
||||
#latestCommitMessage
|
||||
line-height 20px
|
||||
text-shadow 1px 1px 0px #fff
|
||||
#buttons
|
||||
margin-top 10px
|
||||
clearfix()
|
||||
.btn
|
||||
float left
|
||||
#clone
|
||||
position absolute
|
||||
bottom 10px
|
||||
right 10px
|
||||
left 10px
|
||||
.fork
|
||||
button-shiny(buttonbig, #fff, #cc3300)
|
||||
cursor pointer
|
||||
float left
|
||||
display inline-block
|
||||
.clone
|
||||
color lighten(#000, 40%)
|
||||
float left
|
||||
display inline-block
|
||||
margin-left 15px
|
||||
background #F7E6BE
|
||||
border-radius 5px
|
||||
padding 0px 15px
|
||||
font 11px "Bitstream Vera Sans Mono", "Courier", monospace
|
||||
line-height 25px
|
||||
max-width 545px
|
||||
overflow hidden
|
||||
#links
|
||||
position absolute
|
||||
top 10px
|
||||
right 10px
|
||||
font-size 11px
|
||||
line-height 18px
|
||||
a
|
||||
color buttonbig
|
||||
padding 0px 10px
|
||||
&:hover
|
||||
text-decoration underline
|
||||
|
||||
section#content
|
||||
margin-top 50px
|
||||
margin-bottom 50px
|
||||
min-height 350px
|
||||
|
||||
h1
|
||||
padding-top 10px
|
||||
margin-top 85px
|
||||
h2
|
||||
padding-top 15px
|
||||
margin-top 25px
|
||||
p
|
||||
code
|
||||
padding 3px 5px
|
||||
background darken(primary, 5%)
|
||||
|
||||
nav
|
||||
position fixed
|
||||
top 65px
|
||||
left 30px
|
||||
width 140px
|
||||
|
||||
ul
|
||||
list-style none
|
||||
margin-bottom 50px
|
||||
li
|
||||
margin-left 0px
|
||||
margin-right 12px
|
||||
text-align right
|
||||
&.keepcase
|
||||
a
|
||||
text-transform none !important
|
||||
&.header
|
||||
font-weight bold
|
||||
a
|
||||
color lighten(#000, 40%)
|
||||
font-family "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif
|
||||
font-size 14px
|
||||
text-transform lowercase
|
||||
&:hover
|
||||
text-decoration underline
|
||||
|
||||
footer
|
||||
margin-top 100px
|
||||
padding-top 25px
|
||||
margin-bottom 50px
|
||||
border-top 1px solid accent
|
||||
color lighten(#000, 50%)
|
||||
text-transform lowercase
|
||||
|
||||
@import 'code'
|
|
@ -1,47 +0,0 @@
|
|||
|
||||
scrollbar()
|
||||
::-webkit-scrollbar
|
||||
width: 8px
|
||||
height: 8px
|
||||
|
||||
::-webkit-scrollbar-button:vertical
|
||||
border-width: 0px
|
||||
|
||||
::-webkit-scrollbar-button:start:decrement,
|
||||
::-webkit-scrollbar-button:end:increment
|
||||
display: none
|
||||
|
||||
::-webkit-scrollbar-button:vertical:start:increment,
|
||||
::-webkit-scrollbar-button:vertical:end:decrement
|
||||
display: none
|
||||
|
||||
::-webkit-scrollbar-button:vertical:increment
|
||||
border-width: 0px
|
||||
|
||||
::-webkit-scrollbar-button:vertical:decrement
|
||||
border-width: 0px
|
||||
|
||||
::-webkit-scrollbar-track:vertical
|
||||
border-width: 0px
|
||||
|
||||
::-webkit-scrollbar-track-piece:vertical:start
|
||||
border-width: 0px
|
||||
|
||||
::-webkit-scrollbar-track-piece:vertical:end
|
||||
border-width: 0px
|
||||
|
||||
::-webkit-scrollbar-track-piece
|
||||
display: none
|
||||
|
||||
::-webkit-scrollbar-thumb:vertical
|
||||
height: 50px
|
||||
background-color: #e6e6e6
|
||||
-webkit-border-radius: 8px
|
||||
-moz-border-radius: 8px
|
||||
border-radius: 8px
|
||||
|
||||
::-webkit-scrollbar-corner:vertical
|
||||
display: none
|
||||
|
||||
::-webkit-scrollbar-resizer:vertical
|
||||
display: none
|
Loading…
Reference in a new issue