Permalink
Browse files

add qunit testing to grunts

  • Loading branch information...
1 parent e58c9db commit fc47140c8c38d90d4b74058368a89fcb0496f262 @bgrins committed Feb 25, 2013
Showing with 1,588 additions and 864 deletions.
  1. +1 −1 component.json
  2. +2 −2 dist/tinycolor-min.js
  3. +4 −4 docs/tinycolor.html
  4. +7 −2 grunt.js
  5. +1 −1 package.json
  6. +2 −2 test/index.html
  7. +45 −28 test/qunit.css
  8. +1,522 −820 test/qunit.js
  9. +2 −2 test/test.js
  10. +2 −2 tinycolor.js
View
@@ -1,6 +1,6 @@
{
"name": "tinycolor",
- "version": "0.9.12",
+ "version": "0.9.14",
"main": ["./tinycolor.js"],
"dependencies": {
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,6 +1,6 @@
-<!DOCTYPE html> <html> <head> <title>tinycolor.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> tinycolor.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>TinyColor v0.9.13
+<!DOCTYPE html> <html> <head> <title>tinycolor.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> tinycolor.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>TinyColor v0.9.14
https://github.com/bgrins/TinyColor
-2012-11-28, Brian Grinstead, MIT License</p> </td> <td class="code"> <div class="highlight"><pre><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">root</span><span class="p">)</span> <span class="p">{</span>
+2013-02-24, Brian Grinstead, MIT License</p> </td> <td class="code"> <div class="highlight"><pre><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">root</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">trimLeft</span> <span class="o">=</span> <span class="sr">/^[\s,#]+/</span><span class="p">,</span>
<span class="nx">trimRight</span> <span class="o">=</span> <span class="sr">/\s+$/</span><span class="p">,</span>
@@ -460,7 +460,7 @@
colors for that base, returns the most readable color.
<em>Example</em>
tinycolor.mostReadable("#123", ["#fff", "#000"]) => "#000"</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">tinycolor</span><span class="p">.</span><span class="nx">mostReadable</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">baseColor</span><span class="p">,</span> <span class="nx">colorList</span><span class="p">)</span> <span class="p">{</span>
- <span class="kd">var</span> <span class="nx">bestColor</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">bestColor</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
<span class="kd">var</span> <span class="nx">bestScore</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="kd">var</span> <span class="nx">bestIsReadable</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">colorList</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-23"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-23">&#182;</a> </div> <p>We normalize both around the "acceptable" breaking point,
@@ -473,7 +473,7 @@
<span class="p">((</span><span class="o">!</span> <span class="nx">readable</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="o">!</span> <span class="nx">bestIsReadable</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nx">score</span> <span class="o">&gt;</span> <span class="nx">bestScore</span><span class="p">))</span> <span class="p">{</span>
<span class="nx">bestIsReadable</span> <span class="o">=</span> <span class="nx">readable</span><span class="p">;</span>
<span class="nx">bestScore</span> <span class="o">=</span> <span class="nx">score</span><span class="p">;</span>
- <span class="nx">bestColor</span> <span class="o">=</span> <span class="nx">colorList</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
+ <span class="nx">bestColor</span> <span class="o">=</span> <span class="nx">tinycolor</span><span class="p">(</span><span class="nx">colorList</span><span class="p">[</span><span class="nx">i</span><span class="p">]);</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="k">return</span> <span class="nx">bestColor</span><span class="p">;</span>
View
@@ -23,6 +23,11 @@ module.exports = function(grunt) {
}
},
+ qunit: {
+ all: ['test/index.html']
+ },
+
+
lint: {
all: ['tinycolor.js']
},
@@ -47,7 +52,7 @@ module.exports = function(grunt) {
});
- grunt.registerTask('default', 'lint');
- grunt.registerTask('build', 'min docco');
+ grunt.registerTask('default', 'lint qunit');
+ grunt.registerTask('build', 'lint qunit min docco');
};
View
@@ -1,5 +1,5 @@
{
- "version": "0.9.12",
+ "version": "0.9.14",
"name" : "tinycolor2",
"description" : "Fast Color Parsing and Manipulation",
"url" : "http://bgrins.github.com/TinyColor",
View
@@ -3,7 +3,7 @@
<head>
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />
<script type='text/javascript' src='qunit.js'></script>
- <script type='text/javascript' src='../demo/jquery-1.6.1.js'></script>
+ <script type='text/javascript' src='../demo/jquery-1.9.1.js'></script>
<script type='text/javascript' src='../tinycolor.js'></script>
</head>
<body>
@@ -14,7 +14,7 @@ <h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup, will be hidden</div>
-
+
<script type='text/javascript' src='test.js'></script>
</body>
</html>
View
@@ -1,13 +1,11 @@
/**
- * QUnit - A JavaScript Unit Testing Framework
+ * QUnit v1.11.0 - A JavaScript Unit Testing Framework
*
- * http://docs.jquery.com/QUnit
+ * http://qunitjs.com
*
- * Copyright (c) 2011 John Resig, J̦rn Zaefferer
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * or GPL (GPL-LICENSE.txt) licenses.
- * Pulled Live from Git Wed Jun 29 17:45:01 UTC 2011
- * Last Commit: b061e22c54f548fa2a768f14af5876c81ace5d09
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
*/
/** Font Family and Sizes */
@@ -22,7 +20,7 @@
/** Resets */
-#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
+#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
margin: 0;
padding: 0;
}
@@ -40,10 +38,10 @@
line-height: 1em;
font-weight: normal;
- border-radius: 15px 15px 0 0;
- -moz-border-radius: 15px 15px 0 0;
- -webkit-border-top-right-radius: 15px;
- -webkit-border-top-left-radius: 15px;
+ border-radius: 5px 5px 0 0;
+ -moz-border-radius: 5px 5px 0 0;
+ -webkit-border-top-right-radius: 5px;
+ -webkit-border-top-left-radius: 5px;
}
#qunit-header a {
@@ -56,6 +54,11 @@
color: #fff;
}
+#qunit-testrunner-toolbar label {
+ display: inline-block;
+ padding: 0 .5em 0 .1em;
+}
+
#qunit-banner {
height: 5px;
}
@@ -64,6 +67,7 @@
padding: 0.5em 0 0.5em 2em;
color: #5E740B;
background-color: #eee;
+ overflow: hidden;
}
#qunit-userAgent {
@@ -73,6 +77,9 @@
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
+#qunit-modulefilter-container {
+ float: right;
+}
/** Tests: Pass/Fail */
@@ -104,19 +111,24 @@
color: #000;
}
-#qunit-tests ol {
+#qunit-tests li .runtime {
+ float: right;
+ font-size: smaller;
+}
+
+.qunit-assert-list {
margin-top: 0.5em;
padding: 0.5em;
background-color: #fff;
- border-radius: 15px;
- -moz-border-radius: 15px;
- -webkit-border-radius: 15px;
+ border-radius: 5px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+}
- box-shadow: inset 0px 2px 13px #999;
- -moz-box-shadow: inset 0px 2px 13px #999;
- -webkit-box-shadow: inset 0px 2px 13px #999;
+.qunit-collapsed {
+ display: none;
}
#qunit-tests table {
@@ -159,8 +171,7 @@
#qunit-tests b.failed { color: #710909; }
#qunit-tests li li {
- margin: 0.5em;
- padding: 0.4em 0.5em 0.4em 0.5em;
+ padding: 5px;
background-color: #fff;
border-bottom: none;
list-style-position: inside;
@@ -169,9 +180,9 @@
/*** Passing Styles */
#qunit-tests li li.pass {
- color: #5E740B;
+ color: #3c510c;
background-color: #fff;
- border-left: 26px solid #C6E746;
+ border-left: 10px solid #C6E746;
}
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
@@ -187,14 +198,15 @@
#qunit-tests li li.fail {
color: #710909;
background-color: #fff;
- border-left: 26px solid #EE5757;
+ border-left: 10px solid #EE5757;
+ white-space: pre;
}
#qunit-tests > li:last-child {
- border-radius: 0 0 15px 15px;
- -moz-border-radius: 0 0 15px 15px;
- -webkit-border-bottom-right-radius: 15px;
- -webkit-border-bottom-left-radius: 15px;
+ border-radius: 0 0 5px 5px;
+ -moz-border-radius: 0 0 5px 5px;
+ -webkit-border-bottom-right-radius: 5px;
+ -webkit-border-bottom-left-radius: 5px;
}
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
@@ -217,11 +229,16 @@
border-bottom: 1px solid white;
}
+#qunit-testresult .module-name {
+ font-weight: bold;
+}
/** Fixture */
#qunit-fixture {
position: absolute;
top: -10000px;
left: -10000px;
+ width: 1000px;
+ height: 1000px;
}
Oops, something went wrong.

0 comments on commit fc47140

Please sign in to comment.