smparkes-jazrb 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. data/README.rdoc +2 -0
  2. data/bin/jazrb +46 -14
  3. data/doc/jasmine/files.html +165 -11
  4. data/doc/jasmine/index.html +5 -13
  5. data/doc/jasmine/symbols/_global_.html +145 -19
  6. data/doc/jasmine/symbols/jasmine.Block.html +72 -6
  7. data/doc/jasmine/symbols/jasmine.Clock.html +678 -0
  8. data/doc/jasmine/symbols/jasmine.Env.html +632 -16
  9. data/doc/jasmine/symbols/jasmine.EnvjsReporter.html +1 -1
  10. data/doc/jasmine/symbols/jasmine.JsApiReporter.html +500 -6
  11. data/doc/jasmine/symbols/jasmine.Matchers.html +228 -9
  12. data/doc/jasmine/symbols/jasmine.MultiReporter.html +72 -6
  13. data/doc/jasmine/symbols/jasmine.NestedResults.html +5 -7
  14. data/doc/jasmine/symbols/jasmine.Reporter.html +252 -6
  15. data/doc/jasmine/symbols/jasmine.Runner.html +377 -6
  16. data/doc/jasmine/symbols/jasmine.Spec.html +972 -8
  17. data/doc/jasmine/symbols/jasmine.Spy.html +6 -8
  18. data/doc/jasmine/symbols/jasmine.Suite.html +354 -6
  19. data/doc/jasmine/symbols/jasmine.XMLReporter.html +1 -1
  20. data/doc/jasmine/symbols/jasmine.html +571 -18
  21. data/doc/jasmine/symbols/jasmine.util.html +213 -6
  22. data/doc/jasmine/symbols/src/src_Block.js.html +29 -0
  23. data/doc/jasmine/symbols/src/src_Env.js.html +232 -0
  24. data/doc/jasmine/symbols/src/src_JsApiReporter.js.html +110 -0
  25. data/doc/jasmine/symbols/src/src_Matchers.js.html +399 -0
  26. data/doc/jasmine/symbols/src/src_MultiReporter.js.html +36 -0
  27. data/doc/jasmine/symbols/src/src_NestedResults.js.html +88 -0
  28. data/doc/jasmine/symbols/src/src_PrettyPrinter.js.html +128 -0
  29. data/doc/jasmine/symbols/src/src_Queue.js.html +119 -0
  30. data/doc/jasmine/symbols/src/src_Reporter.js.html +35 -0
  31. data/doc/jasmine/symbols/src/src_Reporters.js.html +51 -0
  32. data/doc/jasmine/symbols/src/src_Runner.js.html +75 -0
  33. data/doc/jasmine/symbols/src/src_Spec.js.html +228 -0
  34. data/doc/jasmine/symbols/src/src_Suite.js.html +77 -0
  35. data/doc/jasmine/symbols/src/src_WaitsBlock.js.html +21 -0
  36. data/doc/jasmine/symbols/src/src_WaitsForBlock.js.html +45 -0
  37. data/doc/jasmine/symbols/src/src_base.js.html +557 -0
  38. data/doc/jasmine/symbols/src/src_mock-timeout.js.html +185 -0
  39. data/doc/jasmine/symbols/src/src_util.js.html +75 -0
  40. data/lib/jazrb/intro.js +32 -3
  41. data/lib/jazrb/jasmine/XMLReporter.js +36 -2
  42. data/lib/jazrb/jasmine/jasmine-0.10.0.js +73 -15
  43. data/lib/jazrb/jasmine/jasmine.js +73 -15
  44. data/lib/jazrb/options.rb +5 -0
  45. data/lib/jazrb/qintro.js +113 -0
  46. data/lib/jazrb/qoutro.js +3 -0
  47. data/lib/jazrb/qunit/qunit.css +17 -0
  48. data/lib/jazrb/qunit/qunit.js +1027 -0
  49. metadata +26 -7
  50. data/doc/jasmine/symbols/src/lib_consolex.js.html +0 -35
  51. data/doc/jasmine/symbols/src/lib_jasmine-0.10.0.js.html +0 -2302
  52. data/doc/jasmine/symbols/src/lib_jasmine-0.9.0.js.html +0 -2212
  53. data/doc/jasmine/symbols/src/lib_json2.js.html +0 -486
@@ -13,10 +13,10 @@ jasmine.unimplementedMethod_ = function() {
13
13
  };
14
14
 
15
15
  /**
16
- * Large or small values here may result in slow test running & "Too much recursion" errors
16
+ * Default interval for event loop yields. Small values here may result in slow test running. Zero means no updates until all tests have completed.
17
17
  *
18
18
  */
19
- jasmine.UPDATE_INTERVAL = 250;
19
+ jasmine.DEFAULT_UPDATE_INTERVAL = 250;
20
20
 
21
21
  /**
22
22
  * Allows for bound functions to be comapred. Internal use only.
@@ -60,7 +60,8 @@ jasmine.ExpectationResult = function(params) {
60
60
  this.details = params.details;
61
61
 
62
62
  this.message = this.passed_ ? 'Passed.' : params.message;
63
- this.trace = this.passed_ ? '' : new Error(this.message);
63
+ this.trace = this.passed_ ? '' :
64
+ ( params.exception ? params.exception : new Error(this.message) );
64
65
  };
65
66
 
66
67
  jasmine.ExpectationResult.prototype.passed = function () {
@@ -177,7 +178,7 @@ jasmine.Spy = function(name) {
177
178
  */
178
179
  this.isSpy = true;
179
180
  /**
180
- * The acutal function this spy stubs.
181
+ * The actual function this spy stubs.
181
182
  */
182
183
  this.plan = function() {
183
184
  };
@@ -358,8 +359,8 @@ jasmine.log = function(message) {
358
359
  * @param methodName
359
360
  * @returns a Jasmine spy that can be chained with all spy methods
360
361
  */
361
- var spyOn = function(obj, methodName) {
362
- return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
362
+ var spyOn = function(obj, methodName, ignore) {
363
+ return jasmine.getEnv().currentSpec.spyOn(obj, methodName, ignore);
363
364
  };
364
365
 
365
366
  /**
@@ -420,6 +421,18 @@ var waits = function(timeout) {
420
421
  jasmine.getEnv().currentSpec.waits(timeout);
421
422
  };
422
423
 
424
+ var anticipate = function(number) {
425
+ jasmine.getEnv().currentSpec.anticipate(number);
426
+ };
427
+
428
+ var incomplete = function() {
429
+ jasmine.getEnv().currentSpec.stop();
430
+ };
431
+
432
+ var complete = function() {
433
+ jasmine.getEnv().currentSpec.start();
434
+ };
435
+
423
436
  /**
424
437
  * Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
425
438
  *
@@ -539,7 +552,7 @@ jasmine.version_= {
539
552
  "major": 0,
540
553
  "minor": 10,
541
554
  "build": 0,
542
- "revision": 1257815655
555
+ "revision": 1258603168
543
556
  };
544
557
  /**
545
558
  * @namespace
@@ -547,13 +560,16 @@ jasmine.version_= {
547
560
  jasmine.util = {};
548
561
 
549
562
  /**
550
- * Declare that a child class inherite it's prototype from the parent class.
563
+ * Declare that a child class inherit it's prototype from the parent class.
551
564
  *
552
565
  * @private
553
566
  * @param {Function} childClass
554
567
  * @param {Function} parentClass
555
568
  */
556
569
  jasmine.util.inherit = function(childClass, parentClass) {
570
+ /**
571
+ * @private
572
+ */
557
573
  var subclass = function() {
558
574
  };
559
575
  subclass.prototype = parentClass.prototype;
@@ -617,7 +633,7 @@ jasmine.Env = function() {
617
633
 
618
634
  this.reporter = new jasmine.MultiReporter();
619
635
 
620
- this.updateInterval = jasmine.UPDATE_INTERVAL
636
+ this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL
621
637
  this.lastUpdate = 0;
622
638
  this.specFilter = function() {
623
639
  return true;
@@ -903,7 +919,7 @@ jasmine.JsApiReporter.prototype.suites = function() {
903
919
  };
904
920
 
905
921
  jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
906
- var isSuite = suiteOrSpec instanceof jasmine.Suite
922
+ var isSuite = suiteOrSpec instanceof jasmine.Suite;
907
923
  var summary = {
908
924
  id: suiteOrSpec.id,
909
925
  name: suiteOrSpec.description,
@@ -984,7 +1000,7 @@ jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
984
1000
  * @constructor
985
1001
  * @param {jasmine.Env} env
986
1002
  * @param actual
987
- * @param {jasmine.NestedResults} results
1003
+ * @param {jasmine.Spec} spec
988
1004
  */
989
1005
  jasmine.Matchers = function(env, actual, spec) {
990
1006
  this.env = env;
@@ -1605,6 +1621,7 @@ jasmine.Queue = function(env) {
1605
1621
  this.running = false;
1606
1622
  this.index = 0;
1607
1623
  this.offset = 0;
1624
+ this._stopped = 0;
1608
1625
  };
1609
1626
 
1610
1627
  jasmine.Queue.prototype.addBefore = function(block) {
@@ -1626,6 +1643,18 @@ jasmine.Queue.prototype.start = function(onComplete) {
1626
1643
  this.next_();
1627
1644
  };
1628
1645
 
1646
+ jasmine.Queue.prototype._start = function() {
1647
+ var self = this;
1648
+ this._stopped--;
1649
+ if(this._stopped == 0){
1650
+ setTimeout(function(){self.next_();},0);
1651
+ }
1652
+ };
1653
+
1654
+ jasmine.Queue.prototype._stop = function() {
1655
+ this._stopped++;
1656
+ };
1657
+
1629
1658
  jasmine.Queue.prototype.isRunning = function() {
1630
1659
  return this.running;
1631
1660
  };
@@ -1636,7 +1665,8 @@ jasmine.Queue.prototype.next_ = function() {
1636
1665
  var self = this;
1637
1666
  var goAgain = true;
1638
1667
 
1639
- while (goAgain) {
1668
+ // debug("stopped",this._stopped,self.index,self.blocks.length);
1669
+ while (goAgain && this._stopped <= 0) {
1640
1670
  goAgain = false;
1641
1671
 
1642
1672
  if (self.index < self.blocks.length) {
@@ -1649,6 +1679,9 @@ jasmine.Queue.prototype.next_ = function() {
1649
1679
  return;
1650
1680
  }
1651
1681
 
1682
+ if( self.blocks[self.index]._anticipate !== undefined ) {
1683
+ }
1684
+
1652
1685
  self.offset = 0;
1653
1686
  self.index++;
1654
1687
 
@@ -1693,13 +1726,23 @@ jasmine.Queue.prototype.results = function() {
1693
1726
  };
1694
1727
 
1695
1728
 
1696
- /* JasmineReporters.reporter
1729
+ /** JasmineReporters.reporter
1697
1730
  * Base object that will get called whenever a Spec, Suite, or Runner is done. It is up to
1698
1731
  * descendants of this object to do something with the results (see json_reporter.js)
1732
+ *
1733
+ * @deprecated
1699
1734
  */
1700
1735
  jasmine.Reporters = {};
1701
1736
 
1737
+ /**
1738
+ * @deprecated
1739
+ * @param callbacks
1740
+ */
1702
1741
  jasmine.Reporters.reporter = function(callbacks) {
1742
+ /**
1743
+ * @deprecated
1744
+ * @param callbacks
1745
+ */
1703
1746
  var that = {
1704
1747
  callbacks: callbacks || {},
1705
1748
 
@@ -1858,6 +1901,18 @@ jasmine.Spec.prototype.addToQueue = function (block) {
1858
1901
  }
1859
1902
  };
1860
1903
 
1904
+ jasmine.Spec.prototype.stop = function(){
1905
+ this.queue._stop();
1906
+ }
1907
+
1908
+ jasmine.Spec.prototype.start = function(){
1909
+ this.queue._start();
1910
+ }
1911
+
1912
+ jasmine.Spec.prototype.anticipate = function(number){
1913
+ this._anticipate = number;
1914
+ }
1915
+
1861
1916
  jasmine.Spec.prototype.addMatcherResult = function(result) {
1862
1917
  this.results_.addResult(result);
1863
1918
  };
@@ -1881,7 +1936,8 @@ jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessag
1881
1936
  jasmine.Spec.prototype.fail = function (e) {
1882
1937
  var expectationResult = new jasmine.ExpectationResult({
1883
1938
  passed: false,
1884
- message: e ? jasmine.util.formatException(e) : 'Exception'
1939
+ message: e ? jasmine.util.formatException(e) : 'Exception',
1940
+ exception: e
1885
1941
  });
1886
1942
  this.results_.addResult(expectationResult);
1887
1943
  };
@@ -2209,7 +2265,9 @@ jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall,
2209
2265
  };
2210
2266
  };
2211
2267
 
2212
-
2268
+ /**
2269
+ * @namespace
2270
+ */
2213
2271
  jasmine.Clock = {
2214
2272
  defaultFakeTimer: new jasmine.FakeTimer(),
2215
2273
 
@@ -13,10 +13,10 @@ jasmine.unimplementedMethod_ = function() {
13
13
  };
14
14
 
15
15
  /**
16
- * Large or small values here may result in slow test running & "Too much recursion" errors
16
+ * Default interval for event loop yields. Small values here may result in slow test running. Zero means no updates until all tests have completed.
17
17
  *
18
18
  */
19
- jasmine.UPDATE_INTERVAL = 250;
19
+ jasmine.DEFAULT_UPDATE_INTERVAL = 250;
20
20
 
21
21
  /**
22
22
  * Allows for bound functions to be comapred. Internal use only.
@@ -60,7 +60,8 @@ jasmine.ExpectationResult = function(params) {
60
60
  this.details = params.details;
61
61
 
62
62
  this.message = this.passed_ ? 'Passed.' : params.message;
63
- this.trace = this.passed_ ? '' : new Error(this.message);
63
+ this.trace = this.passed_ ? '' :
64
+ ( params.exception ? params.exception : new Error(this.message) );
64
65
  };
65
66
 
66
67
  jasmine.ExpectationResult.prototype.passed = function () {
@@ -177,7 +178,7 @@ jasmine.Spy = function(name) {
177
178
  */
178
179
  this.isSpy = true;
179
180
  /**
180
- * The acutal function this spy stubs.
181
+ * The actual function this spy stubs.
181
182
  */
182
183
  this.plan = function() {
183
184
  };
@@ -358,8 +359,8 @@ jasmine.log = function(message) {
358
359
  * @param methodName
359
360
  * @returns a Jasmine spy that can be chained with all spy methods
360
361
  */
361
- var spyOn = function(obj, methodName) {
362
- return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
362
+ var spyOn = function(obj, methodName, ignore) {
363
+ return jasmine.getEnv().currentSpec.spyOn(obj, methodName, ignore);
363
364
  };
364
365
 
365
366
  /**
@@ -420,6 +421,18 @@ var waits = function(timeout) {
420
421
  jasmine.getEnv().currentSpec.waits(timeout);
421
422
  };
422
423
 
424
+ var anticipate = function(number) {
425
+ jasmine.getEnv().currentSpec.anticipate(number);
426
+ };
427
+
428
+ var incomplete = function() {
429
+ jasmine.getEnv().currentSpec.stop();
430
+ };
431
+
432
+ var complete = function() {
433
+ jasmine.getEnv().currentSpec.start();
434
+ };
435
+
423
436
  /**
424
437
  * Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
425
438
  *
@@ -539,7 +552,7 @@ jasmine.version_= {
539
552
  "major": 0,
540
553
  "minor": 10,
541
554
  "build": 0,
542
- "revision": 1257815655
555
+ "revision": 1258603168
543
556
  };
544
557
  /**
545
558
  * @namespace
@@ -547,13 +560,16 @@ jasmine.version_= {
547
560
  jasmine.util = {};
548
561
 
549
562
  /**
550
- * Declare that a child class inherite it's prototype from the parent class.
563
+ * Declare that a child class inherit it's prototype from the parent class.
551
564
  *
552
565
  * @private
553
566
  * @param {Function} childClass
554
567
  * @param {Function} parentClass
555
568
  */
556
569
  jasmine.util.inherit = function(childClass, parentClass) {
570
+ /**
571
+ * @private
572
+ */
557
573
  var subclass = function() {
558
574
  };
559
575
  subclass.prototype = parentClass.prototype;
@@ -617,7 +633,7 @@ jasmine.Env = function() {
617
633
 
618
634
  this.reporter = new jasmine.MultiReporter();
619
635
 
620
- this.updateInterval = jasmine.UPDATE_INTERVAL
636
+ this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL
621
637
  this.lastUpdate = 0;
622
638
  this.specFilter = function() {
623
639
  return true;
@@ -903,7 +919,7 @@ jasmine.JsApiReporter.prototype.suites = function() {
903
919
  };
904
920
 
905
921
  jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
906
- var isSuite = suiteOrSpec instanceof jasmine.Suite
922
+ var isSuite = suiteOrSpec instanceof jasmine.Suite;
907
923
  var summary = {
908
924
  id: suiteOrSpec.id,
909
925
  name: suiteOrSpec.description,
@@ -984,7 +1000,7 @@ jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
984
1000
  * @constructor
985
1001
  * @param {jasmine.Env} env
986
1002
  * @param actual
987
- * @param {jasmine.NestedResults} results
1003
+ * @param {jasmine.Spec} spec
988
1004
  */
989
1005
  jasmine.Matchers = function(env, actual, spec) {
990
1006
  this.env = env;
@@ -1605,6 +1621,7 @@ jasmine.Queue = function(env) {
1605
1621
  this.running = false;
1606
1622
  this.index = 0;
1607
1623
  this.offset = 0;
1624
+ this._stopped = 0;
1608
1625
  };
1609
1626
 
1610
1627
  jasmine.Queue.prototype.addBefore = function(block) {
@@ -1626,6 +1643,18 @@ jasmine.Queue.prototype.start = function(onComplete) {
1626
1643
  this.next_();
1627
1644
  };
1628
1645
 
1646
+ jasmine.Queue.prototype._start = function() {
1647
+ var self = this;
1648
+ this._stopped--;
1649
+ if(this._stopped == 0){
1650
+ setTimeout(function(){self.next_();},0);
1651
+ }
1652
+ };
1653
+
1654
+ jasmine.Queue.prototype._stop = function() {
1655
+ this._stopped++;
1656
+ };
1657
+
1629
1658
  jasmine.Queue.prototype.isRunning = function() {
1630
1659
  return this.running;
1631
1660
  };
@@ -1636,7 +1665,8 @@ jasmine.Queue.prototype.next_ = function() {
1636
1665
  var self = this;
1637
1666
  var goAgain = true;
1638
1667
 
1639
- while (goAgain) {
1668
+ // debug("stopped",this._stopped,self.index,self.blocks.length);
1669
+ while (goAgain && this._stopped <= 0) {
1640
1670
  goAgain = false;
1641
1671
 
1642
1672
  if (self.index < self.blocks.length) {
@@ -1649,6 +1679,9 @@ jasmine.Queue.prototype.next_ = function() {
1649
1679
  return;
1650
1680
  }
1651
1681
 
1682
+ if( self.blocks[self.index]._anticipate !== undefined ) {
1683
+ }
1684
+
1652
1685
  self.offset = 0;
1653
1686
  self.index++;
1654
1687
 
@@ -1693,13 +1726,23 @@ jasmine.Queue.prototype.results = function() {
1693
1726
  };
1694
1727
 
1695
1728
 
1696
- /* JasmineReporters.reporter
1729
+ /** JasmineReporters.reporter
1697
1730
  * Base object that will get called whenever a Spec, Suite, or Runner is done. It is up to
1698
1731
  * descendants of this object to do something with the results (see json_reporter.js)
1732
+ *
1733
+ * @deprecated
1699
1734
  */
1700
1735
  jasmine.Reporters = {};
1701
1736
 
1737
+ /**
1738
+ * @deprecated
1739
+ * @param callbacks
1740
+ */
1702
1741
  jasmine.Reporters.reporter = function(callbacks) {
1742
+ /**
1743
+ * @deprecated
1744
+ * @param callbacks
1745
+ */
1703
1746
  var that = {
1704
1747
  callbacks: callbacks || {},
1705
1748
 
@@ -1858,6 +1901,18 @@ jasmine.Spec.prototype.addToQueue = function (block) {
1858
1901
  }
1859
1902
  };
1860
1903
 
1904
+ jasmine.Spec.prototype.stop = function(){
1905
+ this.queue._stop();
1906
+ }
1907
+
1908
+ jasmine.Spec.prototype.start = function(){
1909
+ this.queue._start();
1910
+ }
1911
+
1912
+ jasmine.Spec.prototype.anticipate = function(number){
1913
+ this._anticipate = number;
1914
+ }
1915
+
1861
1916
  jasmine.Spec.prototype.addMatcherResult = function(result) {
1862
1917
  this.results_.addResult(result);
1863
1918
  };
@@ -1881,7 +1936,8 @@ jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessag
1881
1936
  jasmine.Spec.prototype.fail = function (e) {
1882
1937
  var expectationResult = new jasmine.ExpectationResult({
1883
1938
  passed: false,
1884
- message: e ? jasmine.util.formatException(e) : 'Exception'
1939
+ message: e ? jasmine.util.formatException(e) : 'Exception',
1940
+ exception: e
1885
1941
  });
1886
1942
  this.results_.addResult(expectationResult);
1887
1943
  };
@@ -2209,7 +2265,9 @@ jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall,
2209
2265
  };
2210
2266
  };
2211
2267
 
2212
-
2268
+ /**
2269
+ * @namespace
2270
+ */
2213
2271
  jasmine.Clock = {
2214
2272
  defaultFakeTimer: new jasmine.FakeTimer(),
2215
2273
 
data/lib/jazrb/options.rb CHANGED
@@ -3,6 +3,7 @@ require 'optparse'
3
3
  $jazrb_verbose = false
4
4
  $jazrb_xml = false
5
5
  $jazrb_deps = nil
6
+ $jazrb_qunit = false
6
7
 
7
8
  OptionParser.new do |o|
8
9
 
@@ -14,6 +15,10 @@ OptionParser.new do |o|
14
15
  $jazrb_xml = true
15
16
  end
16
17
 
18
+ o.on("-q","--qunit") do
19
+ $jazrb_qunit = true
20
+ end
21
+
17
22
  o.on("--deps PATH") do |path|
18
23
  $jazrb_deps = path
19
24
  end
@@ -0,0 +1,113 @@
1
+ this.QUnit || load(Ruby.ENV["JAZRB_JS_PATH"]+"/qunit/qunit.js");
2
+
3
+ (function(){
4
+
5
+ var APOS = "'"; QUOTE = '"';
6
+ var ESCAPED_QUOTE = { };
7
+ ESCAPED_QUOTE[QUOTE] = '&quot;';
8
+ ESCAPED_QUOTE[APOS] = '&apos;';
9
+
10
+ function formatAttributes(attributes) {
11
+ var att_value;
12
+ var apos_pos, quot_pos;
13
+ var use_quote, escape, quote_to_escape;
14
+ var att_str;
15
+ var re;
16
+ var result = '';
17
+
18
+ for (var att in attributes) {
19
+ att_value = attributes[att] || "";
20
+
21
+ att_value = att_value.replace(/&/g, "&amp;");
22
+ att_value = att_value.replace(/</g, "&lt;");
23
+ att_value = att_value.replace(/>/g, "&gt;");
24
+
25
+ // Find first quote marks if any
26
+ apos_pos = att_value.indexOf(APOS);
27
+ quot_pos = att_value.indexOf(QUOTE);
28
+
29
+ // Determine which quote type to use around
30
+ // the attribute value
31
+ if (apos_pos == -1 && quot_pos == -1) {
32
+ att_str = ' ' + att + "='" + att_value + "'";
33
+ result += att_str;
34
+ continue;
35
+ }
36
+
37
+ // Prefer the single quote unless forced to use double
38
+ if (quot_pos != -1 && quot_pos < apos_pos) {
39
+ use_quote = APOS;
40
+ }
41
+ else {
42
+ use_quote = QUOTE;
43
+ }
44
+
45
+ // Figure out which kind of quote to escape
46
+ // Use nice dictionary instead of yucky if-else nests
47
+ escape = ESCAPED_QUOTE[use_quote];
48
+
49
+ // Escape only the right kind of quote
50
+ re = new RegExp(use_quote,'g');
51
+ att_str = ' ' + att + '=' + use_quote +
52
+ att_value.replace(re, escape) + use_quote;
53
+ result += att_str;
54
+ }
55
+ return result;
56
+ };
57
+
58
+
59
+ var module;
60
+ var test;
61
+
62
+ var started = false;
63
+
64
+ QUnit.moduleStart = function(m,te) {
65
+ if(!started){
66
+ started = true;
67
+ print("<testsuites>");
68
+ }
69
+ if(module) {
70
+ print(" </testsuite>");
71
+ }
72
+ print(" <testsuite"+formatAttributes({name:m})+">");
73
+ module = m;
74
+ };
75
+
76
+ QUnit.testStart = function(t) {
77
+ test = t;
78
+ };
79
+
80
+ QUnit.log = function(r,m) {
81
+ var name = test + " : " + m;
82
+ var msg;
83
+ if (!r) {
84
+ var match = m.match(/(.*), (expected: .* result: .*)/);
85
+ if(match) {
86
+ name = match[1];
87
+ msg = match[2];
88
+ } else {
89
+ name = test;
90
+ msg = m;
91
+ }
92
+ }
93
+ print(" <testcase"+formatAttributes({name:name})+">");
94
+ if(!r){
95
+ print(" <failure"+formatAttributes({message:msg})+">");
96
+ print(" </failure>");
97
+ }
98
+ print(" </testcase>");
99
+ // var s = ( r ? "PASS (" : "FAIL (" ) + ") " + test_string + m;
100
+ // print(s);
101
+ };
102
+
103
+ QUnit.done = function(f,t) {
104
+ // print((t-f) + " Passed, " + f + " Failed, " + t + " Total Tests" );
105
+ if(module){
106
+ print(" </testsuite>");
107
+ }
108
+ if(started) {
109
+ print("</testsuites>");
110
+ }
111
+ };
112
+
113
+ })(QUnit);
@@ -0,0 +1,3 @@
1
+ if(window.location == "about:blank"){
2
+ window.onload();
3
+ }
@@ -0,0 +1,17 @@
1
+ h1#qunit-header { padding: 15px; font-size: large; background-color: #06b; color: white; font-family: 'trebuchet ms', verdana, arial; margin: 0; }
2
+ h1#qunit-header a { color: white; }
3
+
4
+ h2#qunit-banner { height: 2em; border-bottom: 1px solid white; background-color: #eee; margin: 0; font-family: 'trebuchet ms', verdana, arial; }
5
+ h2#qunit-banner.pass { background-color: green; }
6
+ h2#qunit-banner.fail { background-color: red; }
7
+
8
+ h2#qunit-userAgent { padding: 10px; background-color: #eee; color: black; margin: 0; font-size: small; font-weight: normal; font-family: 'trebuchet ms', verdana, arial; font-size: 10pt; }
9
+
10
+ div#qunit-testrunner-toolbar { background: #eee; border-top: 1px solid black; padding: 10px; font-family: 'trebuchet ms', verdana, arial; margin: 0; font-size: 10pt; }
11
+
12
+ ol#qunit-tests { font-family: 'trebuchet ms', verdana, arial; font-size: 10pt; }
13
+ ol#qunit-tests li strong { cursor:pointer; }
14
+ ol#qunit-tests .pass { color: green; }
15
+ ol#qunit-tests .fail { color: red; }
16
+
17
+ p#qunit-testresult { margin-left: 1em; font-size: 10pt; font-family: 'trebuchet ms', verdana, arial; }