alpha-simprini-engine 0.0.1

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 (129) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +38 -0
  4. data/app/assets/javascripts/alpha_simprini.coffee +15 -0
  5. data/app/assets/javascripts/alpha_simprini/application.coffee +22 -0
  6. data/app/assets/javascripts/alpha_simprini/coffee_kup/binding.coffee +119 -0
  7. data/app/assets/javascripts/alpha_simprini/coffee_kup/helpers.coffee +17 -0
  8. data/app/assets/javascripts/alpha_simprini/coffee_kup/tags.coffee +7 -0
  9. data/app/assets/javascripts/alpha_simprini/collection.coffee +62 -0
  10. data/app/assets/javascripts/alpha_simprini/delegate.coffee +21 -0
  11. data/app/assets/javascripts/alpha_simprini/event.coffee +75 -0
  12. data/app/assets/javascripts/alpha_simprini/html.coffee +56 -0
  13. data/app/assets/javascripts/alpha_simprini/mixin.coffee +10 -0
  14. data/app/assets/javascripts/alpha_simprini/model.coffee +137 -0
  15. data/app/assets/javascripts/alpha_simprini/models/radio_selection_model.coffee +9 -0
  16. data/app/assets/javascripts/alpha_simprini/packer.coffee +93 -0
  17. data/app/assets/javascripts/alpha_simprini/template_helpers.coffee +8 -0
  18. data/app/assets/javascripts/alpha_simprini/view.coffee +182 -0
  19. data/app/assets/javascripts/alpha_simprini/views/canvas.coffee +2 -0
  20. data/app/assets/javascripts/alpha_simprini/views/horizontal_split.coffee +9 -0
  21. data/app/assets/javascripts/alpha_simprini/views/panel.coffee +2 -0
  22. data/app/assets/javascripts/alpha_simprini/views/splitter.coffee +2 -0
  23. data/app/assets/javascripts/alpha_simprini/views/stage.coffee +7 -0
  24. data/app/assets/javascripts/alpha_simprini/views/vertical_split.coffee +8 -0
  25. data/app/assets/javascripts/alpha_simprini/views/viewport.coffee +0 -0
  26. data/app/assets/javascripts/bundle.js +16416 -0
  27. data/app/assets/javascripts/lib/backbone.coffee +11 -0
  28. data/app/assets/javascripts/lib/koffeecup_backbone_databind.coffee +25 -0
  29. data/app/assets/javascripts/lib/module.coffee +15 -0
  30. data/app/assets/javascripts/lib/state_machine.coffee +33 -0
  31. data/app/assets/javascripts/lib/string.coffee +13 -0
  32. data/app/assets/javascripts/qunit.js +1513 -0
  33. data/app/assets/javascripts/test.coffee +4 -0
  34. data/app/assets/javascripts/test/alpha_simprini/coffee_kup/binding.coffee +118 -0
  35. data/app/assets/javascripts/test/alpha_simprini/coffee_kup/helpers.coffee +10 -0
  36. data/app/assets/javascripts/test/alpha_simprini/coffee_kup/tags.coffee +18 -0
  37. data/app/assets/javascripts/test/alpha_simprini/collection.coffee +7 -0
  38. data/app/assets/javascripts/test/alpha_simprini/event.coffee +43 -0
  39. data/app/assets/javascripts/test/alpha_simprini/model.coffee +63 -0
  40. data/app/assets/javascripts/test/alpha_simprini/view.coffee +72 -0
  41. data/app/assets/javascripts/test/alpha_simprini/views/canvas.coffee +8 -0
  42. data/app/assets/javascripts/test/alpha_simprini/views/horizontal_split.coffee +13 -0
  43. data/app/assets/javascripts/test/alpha_simprini/views/vertical_split.coffee +13 -0
  44. data/app/assets/javascripts/test/backbone/collection.js +345 -0
  45. data/app/assets/javascripts/test/backbone/events.js +86 -0
  46. data/app/assets/javascripts/test/backbone/model.js +426 -0
  47. data/app/assets/javascripts/test/backbone/view.js +137 -0
  48. data/app/assets/stylesheets/bootstrap.sass +6 -0
  49. data/app/assets/stylesheets/paneling.sass +2 -0
  50. data/app/assets/stylesheets/qunit.scss +228 -0
  51. data/app/assets/stylesheets/table.sass +10 -0
  52. data/app/assets/stylesheets/typography.sass +19 -0
  53. data/app/controllers/alpha_simprini/test_controller.rb +3 -0
  54. data/app/controllers/resources_controller.rb +7 -0
  55. data/app/views/alpha_simprini/test/root.rb +13 -0
  56. data/app/views/resources/base.rb +2 -0
  57. data/app/views/resources/edit.rb +9 -0
  58. data/app/views/resources/form.rb +26 -0
  59. data/app/views/resources/index.rb +41 -0
  60. data/app/views/resources/new.rb +9 -0
  61. data/app/views/resources/show.rb +42 -0
  62. data/app/views/resources/show_has_many.rb +28 -0
  63. data/config/locales/en.yml +4 -0
  64. data/config/routes.rb +3 -0
  65. data/lib/alpha-simprini-engine.rb +33 -0
  66. data/lib/alpha-simprini-engine/version.rb +3 -0
  67. data/lib/alpha_simprini/directive_processor.rb +77 -0
  68. data/lib/alpha_simprini/packer.rb +161 -0
  69. data/lib/alpha_simprini/page.rb +37 -0
  70. data/lib/tasks/alpha-simprini-engine_tasks.rake +4 -0
  71. data/test/alpha-simprini-engine_test.rb +7 -0
  72. data/test/dummy/Rakefile +7 -0
  73. data/test/dummy/app/assets/javascripts/application.js +9 -0
  74. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  75. data/test/dummy/app/controllers/application_controller.rb +3 -0
  76. data/test/dummy/app/helpers/application_helper.rb +2 -0
  77. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  78. data/test/dummy/config.ru +4 -0
  79. data/test/dummy/config/application.rb +42 -0
  80. data/test/dummy/config/boot.rb +10 -0
  81. data/test/dummy/config/database.yml +25 -0
  82. data/test/dummy/config/environment.rb +5 -0
  83. data/test/dummy/config/environments/development.rb +27 -0
  84. data/test/dummy/config/environments/production.rb +51 -0
  85. data/test/dummy/config/environments/test.rb +39 -0
  86. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  87. data/test/dummy/config/initializers/inflections.rb +10 -0
  88. data/test/dummy/config/initializers/mime_types.rb +5 -0
  89. data/test/dummy/config/initializers/secret_token.rb +7 -0
  90. data/test/dummy/config/initializers/session_store.rb +8 -0
  91. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  92. data/test/dummy/config/locales/en.yml +4 -0
  93. data/test/dummy/config/routes.rb +58 -0
  94. data/test/dummy/db/development.sqlite3 +0 -0
  95. data/test/dummy/log/development.log +800 -0
  96. data/test/dummy/public/404.html +26 -0
  97. data/test/dummy/public/422.html +26 -0
  98. data/test/dummy/public/500.html +26 -0
  99. data/test/dummy/public/favicon.ico +0 -0
  100. data/test/dummy/script/rails +6 -0
  101. data/test/dummy/tmp/cache/assets/C24/D70/sprockets%2F388a550030239f3784f207fa32954f64 +0 -0
  102. data/test/dummy/tmp/cache/assets/C34/620/sprockets%2F097ee8532856d48d70420c006f475889 +0 -0
  103. data/test/dummy/tmp/cache/assets/C6F/710/sprockets%2F908d18b0f21c18dad508851126164a41 +0 -0
  104. data/test/dummy/tmp/cache/assets/CA7/120/sprockets%2F35278a6c0150c40394fe02629c8b0eb9 +0 -0
  105. data/test/dummy/tmp/cache/assets/CDB/A80/sprockets%2F443b1c6e71b482fdd83b1833b7e27712 +0 -0
  106. data/test/dummy/tmp/cache/assets/CE3/FB0/sprockets%2F6d3f87a4232e0368bb86760780c5f1bd +0 -0
  107. data/test/dummy/tmp/cache/assets/D1C/160/sprockets%2F87876f7e55ebc78ae11c6c08a27f0605 +0 -0
  108. data/test/dummy/tmp/cache/assets/D26/6C0/sprockets%2F65bce2254bb3140a50326ea1654ea5df +0 -0
  109. data/test/dummy/tmp/cache/assets/D26/FA0/sprockets%2F1f50f59148df5f3e2ab889df381d9744 +0 -0
  110. data/test/dummy/tmp/cache/assets/D36/220/sprockets%2F841654b01d89eada195d7d1fe10b57b0 +0 -0
  111. data/test/dummy/tmp/cache/assets/D47/410/sprockets%2Ff1fe319eb4064bd5b861ac28f7d76555 +18122 -0
  112. data/test/dummy/tmp/cache/assets/D57/1E0/sprockets%2Fe267e3e1059799c429e4f5cfb95ec53c +0 -0
  113. data/test/dummy/tmp/cache/assets/D64/3E0/sprockets%2Fb49b7f8034b81ec601bc32fb127fbe08 +0 -0
  114. data/test/dummy/tmp/cache/assets/D65/850/sprockets%2F7a9b6a0e2d51adb43a1d3f859213e6b8 +15469 -0
  115. data/test/dummy/tmp/cache/assets/D6C/E30/sprockets%2Fcc7322b05ac2bef75e9f4f145d38117f +0 -0
  116. data/test/dummy/tmp/cache/assets/D7D/E00/sprockets%2Fce33b82451c73df1cfec69928b4f77b6 +0 -0
  117. data/test/dummy/tmp/cache/assets/D85/5D0/sprockets%2Fcf743946c378c148b19ce78eeaa9cc75 +0 -0
  118. data/test/dummy/tmp/cache/assets/DBB/560/sprockets%2F5a1d70cf7dd81a5ab5ce7a40a3a38d06 +0 -0
  119. data/test/dummy/tmp/cache/assets/DC1/670/sprockets%2Fefdfad0542298a1db90d24dc27ecc250 +0 -0
  120. data/test/dummy/tmp/cache/assets/DC5/1E0/sprockets%2F7517f22ad0f9dc13b8f0f6e0cc0e5de2 +0 -0
  121. data/test/dummy/tmp/cache/assets/DCC/220/sprockets%2F28d953c6ab9cc9a7db15600aabc6d77d +208 -0
  122. data/test/dummy/tmp/cache/assets/DCF/DF0/sprockets%2Ff0d3068f05825e1dfd9f5aaba946d3dc +0 -0
  123. data/test/dummy/tmp/cache/assets/DD3/0E0/sprockets%2F3e9e08a334bae7deadb5335f5e4f195f +0 -0
  124. data/test/dummy/tmp/cache/assets/DDB/980/sprockets%2Fbd2abc80a17c901e2f497f88f9be58cf +0 -0
  125. data/test/dummy/tmp/cache/assets/E00/ED0/sprockets%2Ffecf3bffeb200a47e96bd04cbc878076 +1535 -0
  126. data/test/dummy/tmp/cache/assets/EFB/560/sprockets%2Fbca0daf751c020cdeddabbefa51cb6ea +0 -0
  127. data/test/dummy/tmp/restart.txt +0 -0
  128. data/test/test_helper.rb +10 -0
  129. metadata +326 -0
@@ -0,0 +1,208 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1314578593.136755: @value{ I" length:EFi�I" digest;
2
+ F"%4daff5c8808721acd71a7e0933c1522bI" source;
3
+ FI"�@charset "UTF-8";
4
+ /**
5
+ * QUnit - A JavaScript Unit Testing Framework
6
+ *
7
+ * http://docs.jquery.com/QUnit
8
+ *
9
+ * Copyright (c) 2011 John Resig, Jörn Zaefferer
10
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
11
+ * or GPL (GPL-LICENSE.txt) licenses.
12
+ * Pulled Live from Git Thu Aug 25 06:20:01 UTC 2011
13
+ * Last Commit: 7f292170fa1109f1355f3e96f8973c32fc553946
14
+ */
15
+ /** Font Family and Sizes */
16
+ #qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
17
+ font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; }
18
+
19
+ #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li {
20
+ font-size: small; }
21
+
22
+ #qunit-tests {
23
+ font-size: smaller; }
24
+
25
+ /** Resets */
26
+ #qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
27
+ margin: 0;
28
+ padding: 0; }
29
+
30
+ /** Header */
31
+ #qunit-header {
32
+ padding: 0.5em 0 0.5em 1em;
33
+ color: #8699a4;
34
+ background-color: #0d3349;
35
+ font-size: 1.5em;
36
+ line-height: 1em;
37
+ font-weight: normal;
38
+ border-radius: 15px 15px 0 0;
39
+ -moz-border-radius: 15px 15px 0 0;
40
+ -webkit-border-top-right-radius: 15px;
41
+ -webkit-border-top-left-radius: 15px; }
42
+
43
+ #qunit-header a {
44
+ text-decoration: none;
45
+ color: #c2ccd1; }
46
+
47
+ #qunit-header a:hover,
48
+ #qunit-header a:focus {
49
+ color: #fff; }
50
+
51
+ #qunit-banner {
52
+ height: 5px; }
53
+
54
+ #qunit-testrunner-toolbar {
55
+ padding: 0.5em 0 0.5em 2em;
56
+ color: #5E740B;
57
+ background-color: #eee; }
58
+
59
+ #qunit-userAgent {
60
+ padding: 0.5em 0 0.5em 2.5em;
61
+ background-color: #2b81af;
62
+ color: #fff;
63
+ text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; }
64
+
65
+ /** Tests: Pass/Fail */
66
+ #qunit-tests {
67
+ list-style-position: inside; }
68
+
69
+ #qunit-tests li {
70
+ padding: 0.4em 0.5em 0.4em 2.5em;
71
+ border-bottom: 1px solid #fff;
72
+ list-style-position: inside; }
73
+
74
+ #qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
75
+ display: none; }
76
+
77
+ #qunit-tests li strong {
78
+ cursor: pointer; }
79
+
80
+ #qunit-tests li a {
81
+ padding: 0.5em;
82
+ color: #c2ccd1;
83
+ text-decoration: none; }
84
+
85
+ #qunit-tests li a:hover,
86
+ #qunit-tests li a:focus {
87
+ color: #000; }
88
+
89
+ #qunit-tests ol {
90
+ margin-top: 0.5em;
91
+ padding: 0.5em;
92
+ background-color: #fff;
93
+ border-radius: 15px;
94
+ -moz-border-radius: 15px;
95
+ -webkit-border-radius: 15px;
96
+ box-shadow: inset 0px 2px 13px #999;
97
+ -moz-box-shadow: inset 0px 2px 13px #999;
98
+ -webkit-box-shadow: inset 0px 2px 13px #999; }
99
+
100
+ #qunit-tests table {
101
+ border-collapse: collapse;
102
+ margin-top: .2em; }
103
+
104
+ #qunit-tests th {
105
+ text-align: right;
106
+ vertical-align: top;
107
+ padding: 0 .5em 0 0; }
108
+
109
+ #qunit-tests td {
110
+ vertical-align: top; }
111
+
112
+ #qunit-tests pre {
113
+ margin: 0;
114
+ white-space: pre-wrap;
115
+ word-wrap: break-word; }
116
+
117
+ #qunit-tests del {
118
+ background-color: #e0f2be;
119
+ color: #374e0c;
120
+ text-decoration: none; }
121
+
122
+ #qunit-tests ins {
123
+ background-color: #ffcaca;
124
+ color: #500;
125
+ text-decoration: none; }
126
+
127
+ /*** Test Counts */
128
+ #qunit-tests b.counts {
129
+ color: black; }
130
+
131
+ #qunit-tests b.passed {
132
+ color: #5E740B; }
133
+
134
+ #qunit-tests b.failed {
135
+ color: #710909; }
136
+
137
+ #qunit-tests li li {
138
+ margin: 0.5em;
139
+ padding: 0.4em 0.5em 0.4em 0.5em;
140
+ background-color: #fff;
141
+ border-bottom: none;
142
+ list-style-position: inside; }
143
+
144
+ /*** Passing Styles */
145
+ #qunit-tests li li.pass {
146
+ color: #5E740B;
147
+ background-color: #fff;
148
+ border-left: 26px solid #C6E746; }
149
+
150
+ #qunit-tests .pass {
151
+ color: #528CE0;
152
+ background-color: #D2E0E6; }
153
+
154
+ #qunit-tests .pass .test-name {
155
+ color: #366097; }
156
+
157
+ #qunit-tests .pass .test-actual,
158
+ #qunit-tests .pass .test-expected {
159
+ color: #999999; }
160
+
161
+ #qunit-banner.qunit-pass {
162
+ background-color: #C6E746; }
163
+
164
+ /*** Failing Styles */
165
+ #qunit-tests li li.fail {
166
+ color: #710909;
167
+ background-color: #fff;
168
+ border-left: 26px solid #EE5757;
169
+ white-space: pre; }
170
+
171
+ #qunit-tests > li:last-child {
172
+ border-radius: 0 0 15px 15px;
173
+ -moz-border-radius: 0 0 15px 15px;
174
+ -webkit-border-bottom-right-radius: 15px;
175
+ -webkit-border-bottom-left-radius: 15px; }
176
+
177
+ #qunit-tests .fail {
178
+ color: #000000;
179
+ background-color: #EE5757; }
180
+
181
+ #qunit-tests .fail .test-name,
182
+ #qunit-tests .fail .module-name {
183
+ color: #000000; }
184
+
185
+ #qunit-tests .fail .test-actual {
186
+ color: #EE5757; }
187
+
188
+ #qunit-tests .fail .test-expected {
189
+ color: green; }
190
+
191
+ #qunit-banner.qunit-fail {
192
+ background-color: #EE5757; }
193
+
194
+ /** Result */
195
+ #qunit-testresult {
196
+ padding: 0.5em 0.5em 0.5em 2.5em;
197
+ color: #2b81af;
198
+ background-color: #D2E0E6;
199
+ border-bottom: 1px solid white; }
200
+
201
+ /** Fixture */
202
+ #qunit-fixture {
203
+ position: absolute;
204
+ top: -10000px;
205
+ left: -10000px; }
206
+ ;
207
+ TI"
208
+ F"%9408615f0521112d69f73731a96a7435
@@ -0,0 +1,1535 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1314578601.281167: @value{I"
2
+ class:EFI"BundledAsset;
3
+ FI"id;
4
+ F"%f1aefeb8aba3d0ec1092298499b1fe2dI"logical_path;
5
+ F"
6
+ F"M/Users/collin/Code/alpha-simprini-engine/app/assets/javascripts/qunit.jsI"content_type;
7
+ FI"application/javascript;
8
+ FI"
9
+ mtime;
10
+ FI"2011-08-28T16:53:54-05:00;
11
+ FI" body;
12
+ FI"'�/**
13
+ * QUnit - A JavaScript Unit Testing Framework
14
+ *
15
+ * http://docs.jquery.com/QUnit
16
+ *
17
+ * Copyright (c) 2011 John Resig, Jörn Zaefferer
18
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
19
+ * or GPL (GPL-LICENSE.txt) licenses.
20
+ * Pulled Live from Git Thu Aug 25 06:20:01 UTC 2011
21
+ * Last Commit: 7f292170fa1109f1355f3e96f8973c32fc553946
22
+ */
23
+
24
+
25
+ (function(window) {
26
+
27
+ var defined = {
28
+ setTimeout: typeof window.setTimeout !== "undefined",
29
+ sessionStorage: (function() {
30
+ try {
31
+ return !!sessionStorage.getItem;
32
+ } catch(e) {
33
+ return false;
34
+ }
35
+ })()
36
+ };
37
+
38
+ var testId = 0;
39
+
40
+ var Test = function(name, testName, expected, testEnvironmentArg, async, callback) {
41
+ this.name = name;
42
+ this.testName = testName;
43
+ this.expected = expected;
44
+ this.testEnvironmentArg = testEnvironmentArg;
45
+ this.async = async;
46
+ this.callback = callback;
47
+ this.assertions = [];
48
+ };
49
+ Test.prototype = {
50
+ init: function() {
51
+ var tests = id("qunit-tests");
52
+ if (tests) {
53
+ var b = document.createElement("strong");
54
+ b.innerHTML = "Running " + this.name;
55
+ var li = document.createElement("li");
56
+ li.appendChild( b );
57
+ li.className = "running";
58
+ li.id = this.id = "test-output" + testId++;
59
+ tests.appendChild( li );
60
+ }
61
+ },
62
+ setup: function() {
63
+ if (this.module != config.previousModule) {
64
+ if ( config.previousModule ) {
65
+ QUnit.moduleDone( {
66
+ name: config.previousModule,
67
+ failed: config.moduleStats.bad,
68
+ passed: config.moduleStats.all - config.moduleStats.bad,
69
+ total: config.moduleStats.all
70
+ } );
71
+ }
72
+ config.previousModule = this.module;
73
+ config.moduleStats = { all: 0, bad: 0 };
74
+ QUnit.moduleStart( {
75
+ name: this.module
76
+ } );
77
+ }
78
+
79
+ config.current = this;
80
+ this.testEnvironment = extend({
81
+ setup: function() {},
82
+ teardown: function() {}
83
+ }, this.moduleTestEnvironment);
84
+ if (this.testEnvironmentArg) {
85
+ extend(this.testEnvironment, this.testEnvironmentArg);
86
+ }
87
+
88
+ QUnit.testStart( {
89
+ name: this.testName
90
+ } );
91
+
92
+ // allow utility functions to access the current test environment
93
+ // TODO why??
94
+ QUnit.current_testEnvironment = this.testEnvironment;
95
+
96
+ try {
97
+ if ( !config.pollution ) {
98
+ saveGlobal();
99
+ }
100
+
101
+ this.testEnvironment.setup.call(this.testEnvironment);
102
+ } catch(e) {
103
+ QUnit.ok( false, "Setup failed on " + this.testName + ": " + e.message );
104
+ }
105
+ },
106
+ run: function() {
107
+ if ( this.async ) {
108
+ QUnit.stop();
109
+ }
110
+
111
+ if ( config.notrycatch ) {
112
+ this.callback.call(this.testEnvironment);
113
+ return;
114
+ }
115
+ try {
116
+ this.callback.call(this.testEnvironment);
117
+ } catch(e) {
118
+ fail("Test " + this.testName + " died, exception and test follows", e, this.callback);
119
+ QUnit.ok( false, "Died on test #" + (this.assertions.length + 1) + ": " + e.message + " - " + QUnit.jsDump.parse(e) );
120
+ // else next test will carry the responsibility
121
+ saveGlobal();
122
+
123
+ // Restart the tests if they're blocking
124
+ if ( config.blocking ) {
125
+ start();
126
+ }
127
+ }
128
+ },
129
+ teardown: function() {
130
+ try {
131
+ this.testEnvironment.teardown.call(this.testEnvironment);
132
+ checkPollution();
133
+ } catch(e) {
134
+ QUnit.ok( false, "Teardown failed on " + this.testName + ": " + e.message );
135
+ }
136
+ },
137
+ finish: function() {
138
+ if ( this.expected && this.expected != this.assertions.length ) {
139
+ QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" );
140
+ }
141
+
142
+ var good = 0, bad = 0,
143
+ tests = id("qunit-tests");
144
+
145
+ config.stats.all += this.assertions.length;
146
+ config.moduleStats.all += this.assertions.length;
147
+
148
+ if ( tests ) {
149
+ var ol = document.createElement("ol");
150
+
151
+ for ( var i = 0; i < this.assertions.length; i++ ) {
152
+ var assertion = this.assertions[i];
153
+
154
+ var li = document.createElement("li");
155
+ li.className = assertion.result ? "pass" : "fail";
156
+ li.innerHTML = assertion.message || (assertion.result ? "okay" : "failed");
157
+ ol.appendChild( li );
158
+
159
+ if ( assertion.result ) {
160
+ good++;
161
+ } else {
162
+ bad++;
163
+ config.stats.bad++;
164
+ config.moduleStats.bad++;
165
+ }
166
+ }
167
+
168
+ // store result when possible
169
+ if ( QUnit.config.reorder && defined.sessionStorage ) {
170
+ if (bad) {
171
+ sessionStorage.setItem("qunit-" + this.module + "-" + this.testName, bad);
172
+ } else {
173
+ sessionStorage.removeItem("qunit-" + this.module + "-" + this.testName);
174
+ }
175
+ }
176
+
177
+ if (bad == 0) {
178
+ ol.style.display = "none";
179
+ }
180
+
181
+ var b = document.createElement("strong");
182
+ b.innerHTML = this.name + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>";
183
+
184
+ var a = document.createElement("a");
185
+ a.innerHTML = "Rerun";
186
+ a.href = QUnit.url({ filter: getText([b]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") });
187
+
188
+ addEvent(b, "click", function() {
189
+ var next = b.nextSibling.nextSibling,
190
+ display = next.style.display;
191
+ next.style.display = display === "none" ? "block" : "none";
192
+ });
193
+
194
+ addEvent(b, "dblclick", function(e) {
195
+ var target = e && e.target ? e.target : window.event.srcElement;
196
+ if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) {
197
+ target = target.parentNode;
198
+ }
199
+ if ( window.location && target.nodeName.toLowerCase() === "strong" ) {
200
+ window.location = QUnit.url({ filter: getText([target]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") });
201
+ }
202
+ });
203
+
204
+ var li = id(this.id);
205
+ li.className = bad ? "fail" : "pass";
206
+ li.removeChild( li.firstChild );
207
+ li.appendChild( b );
208
+ li.appendChild( a );
209
+ li.appendChild( ol );
210
+
211
+ } else {
212
+ for ( var i = 0; i < this.assertions.length; i++ ) {
213
+ if ( !this.assertions[i].result ) {
214
+ bad++;
215
+ config.stats.bad++;
216
+ config.moduleStats.bad++;
217
+ }
218
+ }
219
+ }
220
+
221
+ try {
222
+ QUnit.reset();
223
+ } catch(e) {
224
+ fail("reset() failed, following Test " + this.testName + ", exception and reset fn follows", e, QUnit.reset);
225
+ }
226
+
227
+ QUnit.testDone( {
228
+ name: this.testName,
229
+ failed: bad,
230
+ passed: this.assertions.length - bad,
231
+ total: this.assertions.length
232
+ } );
233
+ },
234
+
235
+ queue: function() {
236
+ var test = this;
237
+ synchronize(function() {
238
+ test.init();
239
+ });
240
+ function run() {
241
+ // each of these can by async
242
+ synchronize(function() {
243
+ test.setup();
244
+ });
245
+ synchronize(function() {
246
+ test.run();
247
+ });
248
+ synchronize(function() {
249
+ test.teardown();
250
+ });
251
+ synchronize(function() {
252
+ test.finish();
253
+ });
254
+ }
255
+ // defer when previous test run passed, if storage is available
256
+ var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-" + this.module + "-" + this.testName);
257
+ if (bad) {
258
+ run();
259
+ } else {
260
+ synchronize(run);
261
+ };
262
+ }
263
+
264
+ };
265
+
266
+ var QUnit = {
267
+
268
+ // call on start of module test to prepend name to all tests
269
+ module: function(name, testEnvironment) {
270
+ config.currentModule = name;
271
+ config.currentModuleTestEnviroment = testEnvironment;
272
+ },
273
+
274
+ asyncTest: function(testName, expected, callback) {
275
+ if ( arguments.length === 2 ) {
276
+ callback = expected;
277
+ expected = 0;
278
+ }
279
+
280
+ QUnit.test(testName, expected, callback, true);
281
+ },
282
+
283
+ test: function(testName, expected, callback, async) {
284
+ var name = '<span class="test-name">' + testName + '</span>', testEnvironmentArg;
285
+
286
+ if ( arguments.length === 2 ) {
287
+ callback = expected;
288
+ expected = null;
289
+ }
290
+ // is 2nd argument a testEnvironment?
291
+ if ( expected && typeof expected === 'object') {
292
+ testEnvironmentArg = expected;
293
+ expected = null;
294
+ }
295
+
296
+ if ( config.currentModule ) {
297
+ name = '<span class="module-name">' + config.currentModule + "</span>: " + name;
298
+ }
299
+
300
+ if ( !validTest(config.currentModule + ": " + testName) ) {
301
+ return;
302
+ }
303
+
304
+ var test = new Test(name, testName, expected, testEnvironmentArg, async, callback);
305
+ test.module = config.currentModule;
306
+ test.moduleTestEnvironment = config.currentModuleTestEnviroment;
307
+ test.queue();
308
+ },
309
+
310
+ /**
311
+ * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
312
+ */
313
+ expect: function(asserts) {
314
+ config.current.expected = asserts;
315
+ },
316
+
317
+ /**
318
+ * Asserts true.
319
+ * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
320
+ */
321
+ ok: function(a, msg) {
322
+ a = !!a;
323
+ var details = {
324
+ result: a,
325
+ message: msg
326
+ };
327
+ msg = escapeHtml(msg);
328
+ QUnit.log(details);
329
+ config.current.assertions.push({
330
+ result: a,
331
+ message: msg
332
+ });
333
+ },
334
+
335
+ /**
336
+ * Checks that the first two arguments are equal, with an optional message.
337
+ * Prints out both actual and expected values.
338
+ *
339
+ * Prefered to ok( actual == expected, message )
340
+ *
341
+ * @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." );
342
+ *
343
+ * @param Object actual
344
+ * @param Object expected
345
+ * @param String message (optional)
346
+ */
347
+ equal: function(actual, expected, message) {
348
+ QUnit.push(expected == actual, actual, expected, message);
349
+ },
350
+
351
+ notEqual: function(actual, expected, message) {
352
+ QUnit.push(expected != actual, actual, expected, message);
353
+ },
354
+
355
+ deepEqual: function(actual, expected, message) {
356
+ QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
357
+ },
358
+
359
+ notDeepEqual: function(actual, expected, message) {
360
+ QUnit.push(!QUnit.equiv(actual, expected), actual, expected, message);
361
+ },
362
+
363
+ strictEqual: function(actual, expected, message) {
364
+ QUnit.push(expected === actual, actual, expected, message);
365
+ },
366
+
367
+ notStrictEqual: function(actual, expected, message) {
368
+ QUnit.push(expected !== actual, actual, expected, message);
369
+ },
370
+
371
+ raises: function(block, expected, message) {
372
+ var actual, ok = false;
373
+
374
+ if (typeof expected === 'string') {
375
+ message = expected;
376
+ expected = null;
377
+ }
378
+
379
+ try {
380
+ block();
381
+ } catch (e) {
382
+ actual = e;
383
+ }
384
+
385
+ if (actual) {
386
+ // we don't want to validate thrown error
387
+ if (!expected) {
388
+ ok = true;
389
+ // expected is a regexp
390
+ } else if (QUnit.objectType(expected) === "regexp") {
391
+ ok = expected.test(actual);
392
+ // expected is a constructor
393
+ } else if (actual instanceof expected) {
394
+ ok = true;
395
+ // expected is a validation function which returns true is validation passed
396
+ } else if (expected.call({}, actual) === true) {
397
+ ok = true;
398
+ }
399
+ }
400
+
401
+ QUnit.ok(ok, message);
402
+ },
403
+
404
+ start: function() {
405
+ config.semaphore--;
406
+ if (config.semaphore > 0) {
407
+ // don't start until equal number of stop-calls
408
+ return;
409
+ }
410
+ if (config.semaphore < 0) {
411
+ // ignore if start is called more often then stop
412
+ config.semaphore = 0;
413
+ }
414
+ // A slight delay, to avoid any current callbacks
415
+ if ( defined.setTimeout ) {
416
+ window.setTimeout(function() {
417
+ if (config.semaphore > 0) {
418
+ return;
419
+ }
420
+ if ( config.timeout ) {
421
+ clearTimeout(config.timeout);
422
+ }
423
+
424
+ config.blocking = false;
425
+ process();
426
+ }, 13);
427
+ } else {
428
+ config.blocking = false;
429
+ process();
430
+ }
431
+ },
432
+
433
+ stop: function(timeout) {
434
+ config.semaphore++;
435
+ config.blocking = true;
436
+
437
+ if ( timeout && defined.setTimeout ) {
438
+ clearTimeout(config.timeout);
439
+ config.timeout = window.setTimeout(function() {
440
+ QUnit.ok( false, "Test timed out" );
441
+ QUnit.start();
442
+ }, timeout);
443
+ }
444
+ }
445
+ };
446
+
447
+ // Backwards compatibility, deprecated
448
+ QUnit.equals = QUnit.equal;
449
+ QUnit.same = QUnit.deepEqual;
450
+
451
+ // Maintain internal state
452
+ var config = {
453
+ // The queue of tests to run
454
+ queue: [],
455
+
456
+ // block until document ready
457
+ blocking: true,
458
+
459
+ // when enabled, show only failing tests
460
+ // gets persisted through sessionStorage and can be changed in UI via checkbox
461
+ hidepassed: false,
462
+
463
+ // by default, run previously failed tests first
464
+ // very useful in combination with "Hide passed tests" checked
465
+ reorder: true,
466
+
467
+ // by default, modify document.title when suite is done
468
+ altertitle: true,
469
+
470
+ urlConfig: ['noglobals', 'notrycatch']
471
+ };
472
+
473
+ // Load paramaters
474
+ (function() {
475
+ var location = window.location || { search: "", protocol: "file:" },
476
+ params = location.search.slice( 1 ).split( "&" ),
477
+ length = params.length,
478
+ urlParams = {},
479
+ current;
480
+
481
+ if ( params[ 0 ] ) {
482
+ for ( var i = 0; i < length; i++ ) {
483
+ current = params[ i ].split( "=" );
484
+ current[ 0 ] = decodeURIComponent( current[ 0 ] );
485
+ // allow just a key to turn on a flag, e.g., test.html?noglobals
486
+ current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true;
487
+ urlParams[ current[ 0 ] ] = current[ 1 ];
488
+ }
489
+ }
490
+
491
+ QUnit.urlParams = urlParams;
492
+ config.filter = urlParams.filter;
493
+
494
+ // Figure out if we're running the tests from a server or not
495
+ QUnit.isLocal = !!(location.protocol === 'file:');
496
+ })();
497
+
498
+ // Expose the API as global variables, unless an 'exports'
499
+ // object exists, in that case we assume we're in CommonJS
500
+ if ( typeof exports === "undefined" || typeof require === "undefined" ) {
501
+ extend(window, QUnit);
502
+ window.QUnit = QUnit;
503
+ } else {
504
+ extend(exports, QUnit);
505
+ exports.QUnit = QUnit;
506
+ }
507
+
508
+ // define these after exposing globals to keep them in these QUnit namespace only
509
+ extend(QUnit, {
510
+ config: config,
511
+
512
+ // Initialize the configuration options
513
+ init: function() {
514
+ extend(config, {
515
+ stats: { all: 0, bad: 0 },
516
+ moduleStats: { all: 0, bad: 0 },
517
+ started: +new Date,
518
+ updateRate: 1000,
519
+ blocking: false,
520
+ autostart: true,
521
+ autorun: false,
522
+ filter: "",
523
+ queue: [],
524
+ semaphore: 0
525
+ });
526
+
527
+ var tests = id( "qunit-tests" ),
528
+ banner = id( "qunit-banner" ),
529
+ result = id( "qunit-testresult" );
530
+
531
+ if ( tests ) {
532
+ tests.innerHTML = "";
533
+ }
534
+
535
+ if ( banner ) {
536
+ banner.className = "";
537
+ }
538
+
539
+ if ( result ) {
540
+ result.parentNode.removeChild( result );
541
+ }
542
+
543
+ if ( tests ) {
544
+ result = document.createElement( "p" );
545
+ result.id = "qunit-testresult";
546
+ result.className = "result";
547
+ tests.parentNode.insertBefore( result, tests );
548
+ result.innerHTML = 'Running...<br/>&nbsp;';
549
+ }
550
+ },
551
+
552
+ /**
553
+ * Resets the test setup. Useful for tests that modify the DOM.
554
+ *
555
+ * If jQuery is available, uses jQuery's html(), otherwise just innerHTML.
556
+ */
557
+ reset: function() {
558
+ if ( window.jQuery ) {
559
+ jQuery( "#qunit-fixture" ).html( config.fixture );
560
+ } else {
561
+ var main = id( 'qunit-fixture' );
562
+ if ( main ) {
563
+ main.innerHTML = config.fixture;
564
+ }
565
+ }
566
+ },
567
+
568
+ /**
569
+ * Trigger an event on an element.
570
+ *
571
+ * @example triggerEvent( document.body, "click" );
572
+ *
573
+ * @param DOMElement elem
574
+ * @param String type
575
+ */
576
+ triggerEvent: function( elem, type, event ) {
577
+ if ( document.createEvent ) {
578
+ event = document.createEvent("MouseEvents");
579
+ event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
580
+ 0, 0, 0, 0, 0, false, false, false, false, 0, null);
581
+ elem.dispatchEvent( event );
582
+
583
+ } else if ( elem.fireEvent ) {
584
+ elem.fireEvent("on"+type);
585
+ }
586
+ },
587
+
588
+ // Safe object type checking
589
+ is: function( type, obj ) {
590
+ return QUnit.objectType( obj ) == type;
591
+ },
592
+
593
+ objectType: function( obj ) {
594
+ if (typeof obj === "undefined") {
595
+ return "undefined";
596
+
597
+ // consider: typeof null === object
598
+ }
599
+ if (obj === null) {
600
+ return "null";
601
+ }
602
+
603
+ var type = Object.prototype.toString.call( obj )
604
+ .match(/^\[object\s(.*)\]$/)[1] || '';
605
+
606
+ switch (type) {
607
+ case 'Number':
608
+ if (isNaN(obj)) {
609
+ return "nan";
610
+ } else {
611
+ return "number";
612
+ }
613
+ case 'String':
614
+ case 'Boolean':
615
+ case 'Array':
616
+ case 'Date':
617
+ case 'RegExp':
618
+ case 'Function':
619
+ return type.toLowerCase();
620
+ }
621
+ if (typeof obj === "object") {
622
+ return "object";
623
+ }
624
+ return undefined;
625
+ },
626
+
627
+ push: function(result, actual, expected, message) {
628
+ var details = {
629
+ result: result,
630
+ message: message,
631
+ actual: actual,
632
+ expected: expected
633
+ };
634
+
635
+ message = escapeHtml(message) || (result ? "okay" : "failed");
636
+ message = '<span class="test-message">' + message + "</span>";
637
+ expected = escapeHtml(QUnit.jsDump.parse(expected));
638
+ actual = escapeHtml(QUnit.jsDump.parse(actual));
639
+ var output = message + '<table><tr class="test-expected"><th>Expected: </th><td><pre>' + expected + '</pre></td></tr>';
640
+ if (actual != expected) {
641
+ output += '<tr class="test-actual"><th>Result: </th><td><pre>' + actual + '</pre></td></tr>';
642
+ output += '<tr class="test-diff"><th>Diff: </th><td><pre>' + QUnit.diff(expected, actual) +'</pre></td></tr>';
643
+ }
644
+ if (!result) {
645
+ var source = sourceFromStacktrace();
646
+ if (source) {
647
+ details.source = source;
648
+ output += '<tr class="test-source"><th>Source: </th><td><pre>' + escapeHtml(source) + '</pre></td></tr>';
649
+ }
650
+ }
651
+ output += "</table>";
652
+
653
+ QUnit.log(details);
654
+
655
+ config.current.assertions.push({
656
+ result: !!result,
657
+ message: output
658
+ });
659
+ },
660
+
661
+ url: function( params ) {
662
+ params = extend( extend( {}, QUnit.urlParams ), params );
663
+ var querystring = "?",
664
+ key;
665
+ for ( key in params ) {
666
+ querystring += encodeURIComponent( key ) + "=" +
667
+ encodeURIComponent( params[ key ] ) + "&";
668
+ }
669
+ return window.location.pathname + querystring.slice( 0, -1 );
670
+ },
671
+
672
+ extend: extend,
673
+ id: id,
674
+ addEvent: addEvent,
675
+
676
+ // Logging callbacks; all receive a single argument with the listed properties
677
+ // run test/logs.html for any related changes
678
+ begin: function() {},
679
+ // done: { failed, passed, total, runtime }
680
+ done: function() {},
681
+ // log: { result, actual, expected, message }
682
+ log: function() {},
683
+ // testStart: { name }
684
+ testStart: function() {},
685
+ // testDone: { name, failed, passed, total }
686
+ testDone: function() {},
687
+ // moduleStart: { name }
688
+ moduleStart: function() {},
689
+ // moduleDone: { name, failed, passed, total }
690
+ moduleDone: function() {}
691
+ });
692
+
693
+ if ( typeof document === "undefined" || document.readyState === "complete" ) {
694
+ config.autorun = true;
695
+ }
696
+
697
+ QUnit.load = function() {
698
+ QUnit.begin({});
699
+
700
+ // Initialize the config, saving the execution queue
701
+ var oldconfig = extend({}, config);
702
+ QUnit.init();
703
+ extend(config, oldconfig);
704
+
705
+ config.blocking = false;
706
+
707
+ var urlConfigHtml = '', len = config.urlConfig.length;
708
+ for ( var i = 0, val; i < len, val = config.urlConfig[i]; i++ ) {
709
+ config[val] = QUnit.urlParams[val];
710
+ urlConfigHtml += '<label><input name="' + val + '" type="checkbox"' + ( config[val] ? ' checked="checked"' : '' ) + '>' + val + '</label>';
711
+ }
712
+
713
+ var userAgent = id("qunit-userAgent");
714
+ if ( userAgent ) {
715
+ userAgent.innerHTML = navigator.userAgent;
716
+ }
717
+ var banner = id("qunit-header");
718
+ if ( banner ) {
719
+ banner.innerHTML = '<a href="' + QUnit.url({ filter: undefined }) + '"> ' + banner.innerHTML + '</a> ' + urlConfigHtml;
720
+ addEvent( banner, "change", function( event ) {
721
+ var params = {};
722
+ params[ event.target.name ] = event.target.checked ? true : undefined;
723
+ window.location = QUnit.url( params );
724
+ });
725
+ }
726
+
727
+ var toolbar = id("qunit-testrunner-toolbar");
728
+ if ( toolbar ) {
729
+ var filter = document.createElement("input");
730
+ filter.type = "checkbox";
731
+ filter.id = "qunit-filter-pass";
732
+ addEvent( filter, "click", function() {
733
+ var ol = document.getElementById("qunit-tests");
734
+ if ( filter.checked ) {
735
+ ol.className = ol.className + " hidepass";
736
+ } else {
737
+ var tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " ";
738
+ ol.className = tmp.replace(/ hidepass /, " ");
739
+ }
740
+ if ( defined.sessionStorage ) {
741
+ if (filter.checked) {
742
+ sessionStorage.setItem("qunit-filter-passed-tests", "true");
743
+ } else {
744
+ sessionStorage.removeItem("qunit-filter-passed-tests");
745
+ }
746
+ }
747
+ });
748
+ if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) {
749
+ filter.checked = true;
750
+ var ol = document.getElementById("qunit-tests");
751
+ ol.className = ol.className + " hidepass";
752
+ }
753
+ toolbar.appendChild( filter );
754
+
755
+ var label = document.createElement("label");
756
+ label.setAttribute("for", "qunit-filter-pass");
757
+ label.innerHTML = "Hide passed tests";
758
+ toolbar.appendChild( label );
759
+ }
760
+
761
+ var main = id('qunit-fixture');
762
+ if ( main ) {
763
+ config.fixture = main.innerHTML;
764
+ }
765
+
766
+ if (config.autostart) {
767
+ QUnit.start();
768
+ }
769
+ };
770
+
771
+ addEvent(window, "load", QUnit.load);
772
+
773
+ function done() {
774
+ config.autorun = true;
775
+
776
+ // Log the last module results
777
+ if ( config.currentModule ) {
778
+ QUnit.moduleDone( {
779
+ name: config.currentModule,
780
+ failed: config.moduleStats.bad,
781
+ passed: config.moduleStats.all - config.moduleStats.bad,
782
+ total: config.moduleStats.all
783
+ } );
784
+ }
785
+
786
+ var banner = id("qunit-banner"),
787
+ tests = id("qunit-tests"),
788
+ runtime = +new Date - config.started,
789
+ passed = config.stats.all - config.stats.bad,
790
+ html = [
791
+ 'Tests completed in ',
792
+ runtime,
793
+ ' milliseconds.<br/>',
794
+ '<span class="passed">',
795
+ passed,
796
+ '</span> tests of <span class="total">',
797
+ config.stats.all,
798
+ '</span> passed, <span class="failed">',
799
+ config.stats.bad,
800
+ '</span> failed.'
801
+ ].join('');
802
+
803
+ if ( banner ) {
804
+ banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass");
805
+ }
806
+
807
+ if ( tests ) {
808
+ id( "qunit-testresult" ).innerHTML = html;
809
+ }
810
+
811
+ if ( config.altertitle && typeof document !== "undefined" && document.title ) {
812
+ // show ✖ for good, ✔ for bad suite result in title
813
+ // use escape sequences in case file gets loaded with non-utf-8-charset
814
+ document.title = [
815
+ (config.stats.bad ? "\u2716" : "\u2714"),
816
+ document.title.replace(/^[\u2714\u2716] /i, "")
817
+ ].join(" ");
818
+ }
819
+
820
+ QUnit.done( {
821
+ failed: config.stats.bad,
822
+ passed: passed,
823
+ total: config.stats.all,
824
+ runtime: runtime
825
+ } );
826
+ }
827
+
828
+ function validTest( name ) {
829
+ var filter = config.filter,
830
+ run = false;
831
+
832
+ if ( !filter ) {
833
+ return true;
834
+ }
835
+
836
+ var not = filter.charAt( 0 ) === "!";
837
+ if ( not ) {
838
+ filter = filter.slice( 1 );
839
+ }
840
+
841
+ if ( name.indexOf( filter ) !== -1 ) {
842
+ return !not;
843
+ }
844
+
845
+ if ( not ) {
846
+ run = true;
847
+ }
848
+
849
+ return run;
850
+ }
851
+
852
+ // so far supports only Firefox, Chrome and Opera (buggy)
853
+ // could be extended in the future to use something like https://github.com/csnover/TraceKit
854
+ function sourceFromStacktrace() {
855
+ try {
856
+ throw new Error();
857
+ } catch ( e ) {
858
+ if (e.stacktrace) {
859
+ // Opera
860
+ return e.stacktrace.split("\n")[6];
861
+ } else if (e.stack) {
862
+ // Firefox, Chrome
863
+ return e.stack.split("\n")[4];
864
+ } else if (e.sourceURL) {
865
+ // Safari, PhantomJS
866
+ // TODO sourceURL points at the 'throw new Error' line above, useless
867
+ //return e.sourceURL + ":" + e.line;
868
+ }
869
+ }
870
+ }
871
+
872
+ function escapeHtml(s) {
873
+ if (!s) {
874
+ return "";
875
+ }
876
+ s = s + "";
877
+ return s.replace(/[\&"<>\\]/g, function(s) {
878
+ switch(s) {
879
+ case "&": return "&amp;";
880
+ case "\\": return "\\\\";
881
+ case '"': return '\"';
882
+ case "<": return "&lt;";
883
+ case ">": return "&gt;";
884
+ default: return s;
885
+ }
886
+ });
887
+ }
888
+
889
+ function synchronize( callback ) {
890
+ config.queue.push( callback );
891
+
892
+ if ( config.autorun && !config.blocking ) {
893
+ process();
894
+ }
895
+ }
896
+
897
+ function process() {
898
+ var start = (new Date()).getTime();
899
+
900
+ while ( config.queue.length && !config.blocking ) {
901
+ if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) {
902
+ config.queue.shift()();
903
+ } else {
904
+ window.setTimeout( process, 13 );
905
+ break;
906
+ }
907
+ }
908
+ if (!config.blocking && !config.queue.length) {
909
+ done();
910
+ }
911
+ }
912
+
913
+ function saveGlobal() {
914
+ config.pollution = [];
915
+
916
+ if ( config.noglobals ) {
917
+ for ( var key in window ) {
918
+ config.pollution.push( key );
919
+ }
920
+ }
921
+ }
922
+
923
+ function checkPollution( name ) {
924
+ var old = config.pollution;
925
+ saveGlobal();
926
+
927
+ var newGlobals = diff( config.pollution, old );
928
+ if ( newGlobals.length > 0 ) {
929
+ ok( false, "Introduced global variable(s): " + newGlobals.join(", ") );
930
+ }
931
+
932
+ var deletedGlobals = diff( old, config.pollution );
933
+ if ( deletedGlobals.length > 0 ) {
934
+ ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") );
935
+ }
936
+ }
937
+
938
+ // returns a new Array with the elements that are in a but not in b
939
+ function diff( a, b ) {
940
+ var result = a.slice();
941
+ for ( var i = 0; i < result.length; i++ ) {
942
+ for ( var j = 0; j < b.length; j++ ) {
943
+ if ( result[i] === b[j] ) {
944
+ result.splice(i, 1);
945
+ i--;
946
+ break;
947
+ }
948
+ }
949
+ }
950
+ return result;
951
+ }
952
+
953
+ function fail(message, exception, callback) {
954
+ if ( typeof console !== "undefined" && console.error && console.warn ) {
955
+ console.error(message);
956
+ console.error(exception);
957
+ console.warn(callback.toString());
958
+
959
+ } else if ( window.opera && opera.postError ) {
960
+ opera.postError(message, exception, callback.toString);
961
+ }
962
+ }
963
+
964
+ function extend(a, b) {
965
+ for ( var prop in b ) {
966
+ if ( b[prop] === undefined ) {
967
+ delete a[prop];
968
+ } else {
969
+ a[prop] = b[prop];
970
+ }
971
+ }
972
+
973
+ return a;
974
+ }
975
+
976
+ function addEvent(elem, type, fn) {
977
+ if ( elem.addEventListener ) {
978
+ elem.addEventListener( type, fn, false );
979
+ } else if ( elem.attachEvent ) {
980
+ elem.attachEvent( "on" + type, fn );
981
+ } else {
982
+ fn();
983
+ }
984
+ }
985
+
986
+ function id(name) {
987
+ return !!(typeof document !== "undefined" && document && document.getElementById) &&
988
+ document.getElementById( name );
989
+ }
990
+
991
+ // Test for equality any JavaScript type.
992
+ // Discussions and reference: http://philrathe.com/articles/equiv
993
+ // Test suites: http://philrathe.com/tests/equiv
994
+ // Author: Philippe Rathé <prathe@gmail.com>
995
+ QUnit.equiv = function () {
996
+
997
+ var innerEquiv; // the real equiv function
998
+ var callers = []; // stack to decide between skip/abort functions
999
+ var parents = []; // stack to avoiding loops from circular referencing
1000
+
1001
+ // Call the o related callback with the given arguments.
1002
+ function bindCallbacks(o, callbacks, args) {
1003
+ var prop = QUnit.objectType(o);
1004
+ if (prop) {
1005
+ if (QUnit.objectType(callbacks[prop]) === "function") {
1006
+ return callbacks[prop].apply(callbacks, args);
1007
+ } else {
1008
+ return callbacks[prop]; // or undefined
1009
+ }
1010
+ }
1011
+ }
1012
+
1013
+ var callbacks = function () {
1014
+
1015
+ // for string, boolean, number and null
1016
+ function useStrictEquality(b, a) {
1017
+ if (b instanceof a.constructor || a instanceof b.constructor) {
1018
+ // to catch short annotaion VS 'new' annotation of a
1019
+ // declaration
1020
+ // e.g. var i = 1;
1021
+ // var j = new Number(1);
1022
+ return a == b;
1023
+ } else {
1024
+ return a === b;
1025
+ }
1026
+ }
1027
+
1028
+ return {
1029
+ "string" : useStrictEquality,
1030
+ "boolean" : useStrictEquality,
1031
+ "number" : useStrictEquality,
1032
+ "null" : useStrictEquality,
1033
+ "undefined" : useStrictEquality,
1034
+
1035
+ "nan" : function(b) {
1036
+ return isNaN(b);
1037
+ },
1038
+
1039
+ "date" : function(b, a) {
1040
+ return QUnit.objectType(b) === "date"
1041
+ && a.valueOf() === b.valueOf();
1042
+ },
1043
+
1044
+ "regexp" : function(b, a) {
1045
+ return QUnit.objectType(b) === "regexp"
1046
+ && a.source === b.source && // the regex itself
1047
+ a.global === b.global && // and its modifers
1048
+ // (gmi) ...
1049
+ a.ignoreCase === b.ignoreCase
1050
+ && a.multiline === b.multiline;
1051
+ },
1052
+
1053
+ // - skip when the property is a method of an instance (OOP)
1054
+ // - abort otherwise,
1055
+ // initial === would have catch identical references anyway
1056
+ "function" : function() {
1057
+ var caller = callers[callers.length - 1];
1058
+ return caller !== Object && typeof caller !== "undefined";
1059
+ },
1060
+
1061
+ "array" : function(b, a) {
1062
+ var i, j, loop;
1063
+ var len;
1064
+
1065
+ // b could be an object literal here
1066
+ if (!(QUnit.objectType(b) === "array")) {
1067
+ return false;
1068
+ }
1069
+
1070
+ len = a.length;
1071
+ if (len !== b.length) { // safe and faster
1072
+ return false;
1073
+ }
1074
+
1075
+ // track reference to avoid circular references
1076
+ parents.push(a);
1077
+ for (i = 0; i < len; i++) {
1078
+ loop = false;
1079
+ for (j = 0; j < parents.length; j++) {
1080
+ if (parents[j] === a[i]) {
1081
+ loop = true;// dont rewalk array
1082
+ }
1083
+ }
1084
+ if (!loop && !innerEquiv(a[i], b[i])) {
1085
+ parents.pop();
1086
+ return false;
1087
+ }
1088
+ }
1089
+ parents.pop();
1090
+ return true;
1091
+ },
1092
+
1093
+ "object" : function(b, a) {
1094
+ var i, j, loop;
1095
+ var eq = true; // unless we can proove it
1096
+ var aProperties = [], bProperties = []; // collection of
1097
+ // strings
1098
+
1099
+ // comparing constructors is more strict than using
1100
+ // instanceof
1101
+ if (a.constructor !== b.constructor) {
1102
+ return false;
1103
+ }
1104
+
1105
+ // stack constructor before traversing properties
1106
+ callers.push(a.constructor);
1107
+ // track reference to avoid circular references
1108
+ parents.push(a);
1109
+
1110
+ for (i in a) { // be strict: don't ensures hasOwnProperty
1111
+ // and go deep
1112
+ loop = false;
1113
+ for (j = 0; j < parents.length; j++) {
1114
+ if (parents[j] === a[i])
1115
+ loop = true; // don't go down the same path
1116
+ // twice
1117
+ }
1118
+ aProperties.push(i); // collect a's properties
1119
+
1120
+ if (!loop && !innerEquiv(a[i], b[i])) {
1121
+ eq = false;
1122
+ break;
1123
+ }
1124
+ }
1125
+
1126
+ callers.pop(); // unstack, we are done
1127
+ parents.pop();
1128
+
1129
+ for (i in b) {
1130
+ bProperties.push(i); // collect b's properties
1131
+ }
1132
+
1133
+ // Ensures identical properties name
1134
+ return eq
1135
+ && innerEquiv(aProperties.sort(), bProperties
1136
+ .sort());
1137
+ }
1138
+ };
1139
+ }();
1140
+
1141
+ innerEquiv = function() { // can take multiple arguments
1142
+ var args = Array.prototype.slice.apply(arguments);
1143
+ if (args.length < 2) {
1144
+ return true; // end transition
1145
+ }
1146
+
1147
+ return (function(a, b) {
1148
+ if (a === b) {
1149
+ return true; // catch the most you can
1150
+ } else if (a === null || b === null || typeof a === "undefined"
1151
+ || typeof b === "undefined"
1152
+ || QUnit.objectType(a) !== QUnit.objectType(b)) {
1153
+ return false; // don't lose time with error prone cases
1154
+ } else {
1155
+ return bindCallbacks(a, callbacks, [ b, a ]);
1156
+ }
1157
+
1158
+ // apply transition with (1..n) arguments
1159
+ })(args[0], args[1])
1160
+ && arguments.callee.apply(this, args.splice(1,
1161
+ args.length - 1));
1162
+ };
1163
+
1164
+ return innerEquiv;
1165
+
1166
+ }();
1167
+
1168
+ /**
1169
+ * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com |
1170
+ * http://flesler.blogspot.com Licensed under BSD
1171
+ * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008
1172
+ *
1173
+ * @projectDescription Advanced and extensible data dumping for Javascript.
1174
+ * @version 1.0.0
1175
+ * @author Ariel Flesler
1176
+ * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
1177
+ */
1178
+ QUnit.jsDump = (function() {
1179
+ function quote( str ) {
1180
+ return '"' + str.toString().replace(/"/g, '\\"') + '"';
1181
+ };
1182
+ function literal( o ) {
1183
+ return o + '';
1184
+ };
1185
+ function join( pre, arr, post ) {
1186
+ var s = jsDump.separator(),
1187
+ base = jsDump.indent(),
1188
+ inner = jsDump.indent(1);
1189
+ if ( arr.join )
1190
+ arr = arr.join( ',' + s + inner );
1191
+ if ( !arr )
1192
+ return pre + post;
1193
+ return [ pre, inner + arr, base + post ].join(s);
1194
+ };
1195
+ function array( arr, stack ) {
1196
+ var i = arr.length, ret = Array(i);
1197
+ this.up();
1198
+ while ( i-- )
1199
+ ret[i] = this.parse( arr[i] , undefined , stack);
1200
+ this.down();
1201
+ return join( '[', ret, ']' );
1202
+ };
1203
+
1204
+ var reName = /^function (\w+)/;
1205
+
1206
+ var jsDump = {
1207
+ parse:function( obj, type, stack ) { //type is used mostly internally, you can fix a (custom)type in advance
1208
+ stack = stack || [ ];
1209
+ var parser = this.parsers[ type || this.typeOf(obj) ];
1210
+ type = typeof parser;
1211
+ var inStack = inArray(obj, stack);
1212
+ if (inStack != -1) {
1213
+ return 'recursion('+(inStack - stack.length)+')';
1214
+ }
1215
+ //else
1216
+ if (type == 'function') {
1217
+ stack.push(obj);
1218
+ var res = parser.call( this, obj, stack );
1219
+ stack.pop();
1220
+ return res;
1221
+ }
1222
+ // else
1223
+ return (type == 'string') ? parser : this.parsers.error;
1224
+ },
1225
+ typeOf:function( obj ) {
1226
+ var type;
1227
+ if ( obj === null ) {
1228
+ type = "null";
1229
+ } else if (typeof obj === "undefined") {
1230
+ type = "undefined";
1231
+ } else if (QUnit.is("RegExp", obj)) {
1232
+ type = "regexp";
1233
+ } else if (QUnit.is("Date", obj)) {
1234
+ type = "date";
1235
+ } else if (QUnit.is("Function", obj)) {
1236
+ type = "function";
1237
+ } else if (typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined") {
1238
+ type = "window";
1239
+ } else if (obj.nodeType === 9) {
1240
+ type = "document";
1241
+ } else if (obj.nodeType) {
1242
+ type = "node";
1243
+ } else if (typeof obj === "object" && typeof obj.length === "number" && obj.length >= 0) {
1244
+ type = "array";
1245
+ } else {
1246
+ type = typeof obj;
1247
+ }
1248
+ return type;
1249
+ },
1250
+ separator:function() {
1251
+ return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? '&nbsp;' : ' ';
1252
+ },
1253
+ indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing
1254
+ if ( !this.multiline )
1255
+ return '';
1256
+ var chr = this.indentChar;
1257
+ if ( this.HTML )
1258
+ chr = chr.replace(/\t/g,' ').replace(/ /g,'&nbsp;');
1259
+ return Array( this._depth_ + (extra||0) ).join(chr);
1260
+ },
1261
+ up:function( a ) {
1262
+ this._depth_ += a || 1;
1263
+ },
1264
+ down:function( a ) {
1265
+ this._depth_ -= a || 1;
1266
+ },
1267
+ setParser:function( name, parser ) {
1268
+ this.parsers[name] = parser;
1269
+ },
1270
+ // The next 3 are exposed so you can use them
1271
+ quote:quote,
1272
+ literal:literal,
1273
+ join:join,
1274
+ //
1275
+ _depth_: 1,
1276
+ // This is the list of parsers, to modify them, use jsDump.setParser
1277
+ parsers:{
1278
+ window: '[Window]',
1279
+ document: '[Document]',
1280
+ error:'[ERROR]', //when no parser is found, shouldn't happen
1281
+ unknown: '[Unknown]',
1282
+ 'null':'null',
1283
+ 'undefined':'undefined',
1284
+ 'function':function( fn ) {
1285
+ var ret = 'function',
1286
+ name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE
1287
+ if ( name )
1288
+ ret += ' ' + name;
1289
+ ret += '(';
1290
+
1291
+ ret = [ ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join('');
1292
+ return join( ret, QUnit.jsDump.parse(fn,'functionCode'), '}' );
1293
+ },
1294
+ array: array,
1295
+ nodelist: array,
1296
+ arguments: array,
1297
+ object:function( map, stack ) {
1298
+ var ret = [ ];
1299
+ QUnit.jsDump.up();
1300
+ for ( var key in map ) {
1301
+ var val = map[key];
1302
+ ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(val, undefined, stack));
1303
+ }
1304
+ QUnit.jsDump.down();
1305
+ return join( '{', ret, '}' );
1306
+ },
1307
+ node:function( node ) {
1308
+ var open = QUnit.jsDump.HTML ? '&lt;' : '<',
1309
+ close = QUnit.jsDump.HTML ? '&gt;' : '>';
1310
+
1311
+ var tag = node.nodeName.toLowerCase(),
1312
+ ret = open + tag;
1313
+
1314
+ for ( var a in QUnit.jsDump.DOMAttrs ) {
1315
+ var val = node[QUnit.jsDump.DOMAttrs[a]];
1316
+ if ( val )
1317
+ ret += ' ' + a + '=' + QUnit.jsDump.parse( val, 'attribute' );
1318
+ }
1319
+ return ret + close + open + '/' + tag + close;
1320
+ },
1321
+ functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function
1322
+ var l = fn.length;
1323
+ if ( !l ) return '';
1324
+
1325
+ var args = Array(l);
1326
+ while ( l-- )
1327
+ args[l] = String.fromCharCode(97+l);//97 is 'a'
1328
+ return ' ' + args.join(', ') + ' ';
1329
+ },
1330
+ key:quote, //object calls it internally, the key part of an item in a map
1331
+ functionCode:'[code]', //function calls it internally, it's the content of the function
1332
+ attribute:quote, //node calls it internally, it's an html attribute value
1333
+ string:quote,
1334
+ date:quote,
1335
+ regexp:literal, //regex
1336
+ number:literal,
1337
+ 'boolean':literal
1338
+ },
1339
+ DOMAttrs:{//attributes to dump from nodes, name=>realName
1340
+ id:'id',
1341
+ name:'name',
1342
+ 'class':'className'
1343
+ },
1344
+ HTML:false,//if true, entities are escaped ( <, >, \t, space and \n )
1345
+ indentChar:' ',//indentation unit
1346
+ multiline:true //if true, items in a collection, are separated by a \n, else just a space.
1347
+ };
1348
+
1349
+ return jsDump;
1350
+ })();
1351
+
1352
+ // from Sizzle.js
1353
+ function getText( elems ) {
1354
+ var ret = "", elem;
1355
+
1356
+ for ( var i = 0; elems[i]; i++ ) {
1357
+ elem = elems[i];
1358
+
1359
+ // Get the text from text nodes and CDATA nodes
1360
+ if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
1361
+ ret += elem.nodeValue;
1362
+
1363
+ // Traverse everything else, except comment nodes
1364
+ } else if ( elem.nodeType !== 8 ) {
1365
+ ret += getText( elem.childNodes );
1366
+ }
1367
+ }
1368
+
1369
+ return ret;
1370
+ };
1371
+
1372
+ //from jquery.js
1373
+ function inArray( elem, array ) {
1374
+ if ( array.indexOf ) {
1375
+ return array.indexOf( elem );
1376
+ }
1377
+
1378
+ for ( var i = 0, length = array.length; i < length; i++ ) {
1379
+ if ( array[ i ] === elem ) {
1380
+ return i;
1381
+ }
1382
+ }
1383
+
1384
+ return -1;
1385
+ }
1386
+
1387
+ /*
1388
+ * Javascript Diff Algorithm
1389
+ * By John Resig (http://ejohn.org/)
1390
+ * Modified by Chu Alan "sprite"
1391
+ *
1392
+ * Released under the MIT license.
1393
+ *
1394
+ * More Info:
1395
+ * http://ejohn.org/projects/javascript-diff-algorithm/
1396
+ *
1397
+ * Usage: QUnit.diff(expected, actual)
1398
+ *
1399
+ * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over"
1400
+ */
1401
+ QUnit.diff = (function() {
1402
+ function diff(o, n) {
1403
+ var ns = {};
1404
+ var os = {};
1405
+
1406
+ for (var i = 0; i < n.length; i++) {
1407
+ if (ns[n[i]] == null)
1408
+ ns[n[i]] = {
1409
+ rows: [],
1410
+ o: null
1411
+ };
1412
+ ns[n[i]].rows.push(i);
1413
+ }
1414
+
1415
+ for (var i = 0; i < o.length; i++) {
1416
+ if (os[o[i]] == null)
1417
+ os[o[i]] = {
1418
+ rows: [],
1419
+ n: null
1420
+ };
1421
+ os[o[i]].rows.push(i);
1422
+ }
1423
+
1424
+ for (var i in ns) {
1425
+ if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) {
1426
+ n[ns[i].rows[0]] = {
1427
+ text: n[ns[i].rows[0]],
1428
+ row: os[i].rows[0]
1429
+ };
1430
+ o[os[i].rows[0]] = {
1431
+ text: o[os[i].rows[0]],
1432
+ row: ns[i].rows[0]
1433
+ };
1434
+ }
1435
+ }
1436
+
1437
+ for (var i = 0; i < n.length - 1; i++) {
1438
+ if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null &&
1439
+ n[i + 1] == o[n[i].row + 1]) {
1440
+ n[i + 1] = {
1441
+ text: n[i + 1],
1442
+ row: n[i].row + 1
1443
+ };
1444
+ o[n[i].row + 1] = {
1445
+ text: o[n[i].row + 1],
1446
+ row: i + 1
1447
+ };
1448
+ }
1449
+ }
1450
+
1451
+ for (var i = n.length - 1; i > 0; i--) {
1452
+ if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null &&
1453
+ n[i - 1] == o[n[i].row - 1]) {
1454
+ n[i - 1] = {
1455
+ text: n[i - 1],
1456
+ row: n[i].row - 1
1457
+ };
1458
+ o[n[i].row - 1] = {
1459
+ text: o[n[i].row - 1],
1460
+ row: i - 1
1461
+ };
1462
+ }
1463
+ }
1464
+
1465
+ return {
1466
+ o: o,
1467
+ n: n
1468
+ };
1469
+ }
1470
+
1471
+ return function(o, n) {
1472
+ o = o.replace(/\s+$/, '');
1473
+ n = n.replace(/\s+$/, '');
1474
+ var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/));
1475
+
1476
+ var str = "";
1477
+
1478
+ var oSpace = o.match(/\s+/g);
1479
+ if (oSpace == null) {
1480
+ oSpace = [" "];
1481
+ }
1482
+ else {
1483
+ oSpace.push(" ");
1484
+ }
1485
+ var nSpace = n.match(/\s+/g);
1486
+ if (nSpace == null) {
1487
+ nSpace = [" "];
1488
+ }
1489
+ else {
1490
+ nSpace.push(" ");
1491
+ }
1492
+
1493
+ if (out.n.length == 0) {
1494
+ for (var i = 0; i < out.o.length; i++) {
1495
+ str += '<del>' + out.o[i] + oSpace[i] + "</del>";
1496
+ }
1497
+ }
1498
+ else {
1499
+ if (out.n[0].text == null) {
1500
+ for (n = 0; n < out.o.length && out.o[n].text == null; n++) {
1501
+ str += '<del>' + out.o[n] + oSpace[n] + "</del>";
1502
+ }
1503
+ }
1504
+
1505
+ for (var i = 0; i < out.n.length; i++) {
1506
+ if (out.n[i].text == null) {
1507
+ str += '<ins>' + out.n[i] + nSpace[i] + "</ins>";
1508
+ }
1509
+ else {
1510
+ var pre = "";
1511
+
1512
+ for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++) {
1513
+ pre += '<del>' + out.o[n] + oSpace[n] + "</del>";
1514
+ }
1515
+ str += " " + out.n[i].text + nSpace[i] + pre;
1516
+ }
1517
+ }
1518
+ }
1519
+
1520
+ return str;
1521
+ };
1522
+ })();
1523
+
1524
+ })(this);
1525
+
1526
+ ;
1527
+ TI"asset_paths;
1528
+ F["M/Users/collin/Code/alpha-simprini-engine/app/assets/javascripts/qunit.jsI"dependency_paths;
1529
+ F[{I" path;
1530
+ F"M/Users/collin/Code/alpha-simprini-engine/app/assets/javascripts/qunit.jsI"
1531
+ mtime;
1532
+ FIu: Time
1533
+ T: offseti���I"hexdigest;
1534
+ F"%df690f89e1aded5a95d70e79b5c193ffI"
1535
+ F"%a697d8e69dd5bf8f3a29159773d6c5f5