Permalink
Browse files

Updated the qunit test

  • Loading branch information...
Andrée Hansson
Andrée Hansson committed Feb 11, 2010
1 parent c4cf0fe commit a15fe3f4fea2b7dc34dd7b020f2062b43605291c
1 qunit
Submodule qunit deleted from 532c6e
View
Binary file not shown.
View
@@ -0,0 +1,70 @@
+<!doctype html>
+<html>
+
+<head>
+ <title>QUnit: Image Load</title>
+ <link rel="stylesheet" href="qunit/qunit.css" />
+ <style>img { display: block; }</style>
+
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
+ <script src="../ahpi.imgload.js"></script>
+ <script src="qunit/qunit.js"></script>
+ <script>
+(function () {
+
+var img = new Image();
+img.onerror = img.onload = function () { runTests(); };
+img.src = 'cached.gif';
+
+function runTests() {
+
+ test("Image load event (Normal)", function () {
+
+ expect(2);
+
+ var $normal = $('#normal');
+ $normal.bind('load', function () { ok(true, "Load event fired"); });
+ $normal.unbind('load');
+ ok(true, "Load event unbound");
+ });
+
+ test("Image load event (Cached)", function () {
+
+ expect(2);
+
+ var $cached = $('#cached').attr('src', 'cached.gif');
+ $cached.bind('load', function () { ok(true, "Load event fired"); });
+ $cached.unbind('load');
+ ok(true, 'Load event unbound');
+ });
+
+ test("Image load event (Data URI)", function () {
+
+ expect(2);
+
+ var $datauri = $('#datauri');
+ $datauri.bind('error', function () { ok(true, "Data URI not supported"); });
+ $datauri.bind('load', function () { ok(true, "Load event fired"); });
+ $datauri.unbind('load');
+ ok(true, 'Load event unbound');
+ });
+}
+}());
+
+ </script>
+
+</head>
+
+<body>
+
+<p>
+ <img id="normal" src="normal.gif" />
+ <img id="cached" src="" />
+ <img id="datauri" src="data:image/gif;base64,R0lGODdhGwAPAIAAAP///wAAACwAAAAAGwAPAAACN4SPqcvtD08IaIKJrclab+pdlDR+FViK50qq7Wu2XOjGJreEOmrDteqhCUed1E6R8RWTkaYzUgAAOw==" />
+ <a href="../ahpi.imgload.js">ahpi.imgload.js Source</a>
+</p>
+
+<ol id="qunit-tests"></ol>
+</body>
+
+</html>
View
Binary file not shown.
View
@@ -0,0 +1,21 @@
+{
+ "name": "qunit",
+ "author": {
+ "name": "John Resig",
+ "email": "jeresig@gmail.com",
+ "url": "http://ejohn.org/"
+ },
+ "maintainer": {
+ "name": "Jörn Zaefferer",
+ "email": "joern.zaefferer@googlemail.com",
+ "url": "http://bassistance.de/"
+ },
+ "url": "http://docs.jquery.com/QUnit",
+ "license": {
+ "name": "MIT",
+ "url": "http://www.opensource.org/licenses/mit-license.php"
+ },
+ "description": "An easy-to-use JavaScript Unit Testing framework.",
+ "keywords": [ "testing", "unit", "jquery" ],
+ "lib": "qunit"
+}
View
@@ -0,0 +1,119 @@
+
+ol#qunit-tests {
+ font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
+ margin:0;
+ padding:0;
+ list-style-position:inside;
+
+ font-size: smaller;
+}
+ol#qunit-tests li{
+ padding:0.4em 0.5em 0.4em 2.5em;
+ border-bottom:1px solid #fff;
+ font-size:small;
+ list-style-position:inside;
+}
+ol#qunit-tests li ol{
+ box-shadow: inset 0px 2px 13px #999;
+ -moz-box-shadow: inset 0px 2px 13px #999;
+ -webkit-box-shadow: inset 0px 2px 13px #999;
+ margin-top:0.5em;
+ margin-left:0;
+ padding:0.5em;
+ background-color:#fff;
+ border-radius:15px;
+ -moz-border-radius: 15px;
+ -webkit-border-radius: 15px;
+}
+ol#qunit-tests li li{
+ border-bottom:none;
+ margin:0.5em;
+ background-color:#fff;
+ list-style-position: inside;
+ padding:0.4em 0.5em 0.4em 0.5em;
+}
+
+ol#qunit-tests li li.pass{
+ border-left:26px solid #C6E746;
+ background-color:#fff;
+ color:#5E740B;
+ }
+ol#qunit-tests li li.fail{
+ border-left:26px solid #EE5757;
+ background-color:#fff;
+ color:#710909;
+}
+ol#qunit-tests li.pass{
+ background-color:#D2E0E6;
+ color:#528CE0;
+}
+ol#qunit-tests li.fail{
+ background-color:#EE5757;
+ color:#000;
+}
+ol#qunit-tests li strong {
+ cursor:pointer;
+}
+h1#qunit-header{
+ background-color:#0d3349;
+ margin:0;
+ padding:0.5em 0 0.5em 1em;
+ color:#fff;
+ font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
+ border-top-right-radius:15px;
+ border-top-left-radius:15px;
+ -moz-border-radius-topright:15px;
+ -moz-border-radius-topleft:15px;
+ -webkit-border-top-right-radius:15px;
+ -webkit-border-top-left-radius:15px;
+ text-shadow: rgba(0, 0, 0, 0.5) 4px 4px 1px;
+}
+h2#qunit-banner{
+ font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
+ height:5px;
+ margin:0;
+ padding:0;
+}
+h2#qunit-banner.qunit-pass{
+ background-color:#C6E746;
+}
+h2#qunit-banner.qunit-fail, #qunit-testrunner-toolbar {
+ background-color:#EE5757;
+}
+#qunit-testrunner-toolbar {
+ font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
+ padding:0;
+ /*width:80%;*/
+ padding:0em 0 0.5em 2em;
+ font-size: small;
+}
+h2#qunit-userAgent {
+ font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
+ background-color:#2b81af;
+ margin:0;
+ padding:0;
+ color:#fff;
+ font-size: small;
+ padding:0.5em 0 0.5em 2.5em;
+ text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
+}
+p#qunit-testresult{
+ font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
+ margin:0;
+ font-size: small;
+ color:#2b81af;
+ border-bottom-right-radius:15px;
+ border-bottom-left-radius:15px;
+ -moz-border-radius-bottomright:15px;
+ -moz-border-radius-bottomleft:15px;
+ -webkit-border-bottom-right-radius:15px;
+ -webkit-border-bottom-left-radius:15px;
+ background-color:#D2E0E6;
+ padding:0.5em 0.5em 0.5em 2.5em;
+}
+strong b.fail{
+ color:#710909;
+ }
+strong b.pass{
+ color:#5E740B;
+ }
Oops, something went wrong.

0 comments on commit a15fe3f

Please sign in to comment.