guff-compass 0.7.0

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 (186) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +21 -0
  3. data/.gitignore +6 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +21 -0
  6. data/demo/bower_components/jquery/.bower.json +21 -0
  7. data/demo/bower_components/jquery/.editorconfig +43 -0
  8. data/demo/bower_components/jquery/.gitattributes +2 -0
  9. data/demo/bower_components/jquery/.gitignore +14 -0
  10. data/demo/bower_components/jquery/.gitmodules +6 -0
  11. data/demo/bower_components/jquery/.jshintrc +17 -0
  12. data/demo/bower_components/jquery/.mailmap +94 -0
  13. data/demo/bower_components/jquery/AUTHORS.txt +170 -0
  14. data/demo/bower_components/jquery/CONTRIBUTING.md +216 -0
  15. data/demo/bower_components/jquery/Gruntfile.js +594 -0
  16. data/demo/bower_components/jquery/MIT-LICENSE.txt +21 -0
  17. data/demo/bower_components/jquery/README.md +398 -0
  18. data/demo/bower_components/jquery/bower.json +11 -0
  19. data/demo/bower_components/jquery/build/release-notes.js +59 -0
  20. data/demo/bower_components/jquery/build/release.js +316 -0
  21. data/demo/bower_components/jquery/component.json +15 -0
  22. data/demo/bower_components/jquery/composer.json +35 -0
  23. data/demo/bower_components/jquery/jquery-migrate.js +511 -0
  24. data/demo/bower_components/jquery/jquery-migrate.min.js +3 -0
  25. data/demo/bower_components/jquery/jquery.js +9789 -0
  26. data/demo/bower_components/jquery/jquery.min.js +6 -0
  27. data/demo/bower_components/jquery/jquery.min.map +1 -0
  28. data/demo/bower_components/jquery/package.json +38 -0
  29. data/demo/bower_components/jquery/speed/benchmark.js +15 -0
  30. data/demo/bower_components/jquery/speed/benchmarker.css +65 -0
  31. data/demo/bower_components/jquery/speed/benchmarker.js +181 -0
  32. data/demo/bower_components/jquery/speed/closest.html +39 -0
  33. data/demo/bower_components/jquery/speed/css.html +82 -0
  34. data/demo/bower_components/jquery/speed/event.html +58 -0
  35. data/demo/bower_components/jquery/speed/filter.html +183 -0
  36. data/demo/bower_components/jquery/speed/find.html +179 -0
  37. data/demo/bower_components/jquery/speed/index.html +72 -0
  38. data/demo/bower_components/jquery/speed/jquery-basis.js +6238 -0
  39. data/demo/bower_components/jquery/speed/slice.vs.concat.html +47 -0
  40. data/demo/bower_components/jquery/src/.jshintrc +27 -0
  41. data/demo/bower_components/jquery/src/ajax.js +855 -0
  42. data/demo/bower_components/jquery/src/ajax/jsonp.js +80 -0
  43. data/demo/bower_components/jquery/src/ajax/script.js +86 -0
  44. data/demo/bower_components/jquery/src/ajax/xhr.js +207 -0
  45. data/demo/bower_components/jquery/src/attributes.js +659 -0
  46. data/demo/bower_components/jquery/src/callbacks.js +197 -0
  47. data/demo/bower_components/jquery/src/core.js +981 -0
  48. data/demo/bower_components/jquery/src/css.js +661 -0
  49. data/demo/bower_components/jquery/src/data.js +336 -0
  50. data/demo/bower_components/jquery/src/deferred.js +141 -0
  51. data/demo/bower_components/jquery/src/deprecated.js +11 -0
  52. data/demo/bower_components/jquery/src/dimensions.js +41 -0
  53. data/demo/bower_components/jquery/src/effects.js +732 -0
  54. data/demo/bower_components/jquery/src/event-alias.js +32 -0
  55. data/demo/bower_components/jquery/src/event.js +995 -0
  56. data/demo/bower_components/jquery/src/exports.js +21 -0
  57. data/demo/bower_components/jquery/src/intro.js +20 -0
  58. data/demo/bower_components/jquery/src/manipulation.js +744 -0
  59. data/demo/bower_components/jquery/src/offset.js +169 -0
  60. data/demo/bower_components/jquery/src/outro.js +2 -0
  61. data/demo/bower_components/jquery/src/queue.js +146 -0
  62. data/demo/bower_components/jquery/src/serialize.js +99 -0
  63. data/demo/bower_components/jquery/src/sizzle-jquery.js +7 -0
  64. data/demo/bower_components/jquery/src/support.js +246 -0
  65. data/demo/bower_components/jquery/src/traversing.js +283 -0
  66. data/demo/bower_components/jquery/src/wrap.js +66 -0
  67. data/demo/bower_components/jquery/test/.jshintignore +3 -0
  68. data/demo/bower_components/jquery/test/.jshintrc +60 -0
  69. data/demo/bower_components/jquery/test/data/1x1.jpg +0 -0
  70. data/demo/bower_components/jquery/test/data/ajax/unreleasedXHR.html +25 -0
  71. data/demo/bower_components/jquery/test/data/atom+xml.php +4 -0
  72. data/demo/bower_components/jquery/test/data/badcall.js +1 -0
  73. data/demo/bower_components/jquery/test/data/badjson.js +1 -0
  74. data/demo/bower_components/jquery/test/data/cleanScript.html +10 -0
  75. data/demo/bower_components/jquery/test/data/core/cc_on.html +22 -0
  76. data/demo/bower_components/jquery/test/data/dashboard.xml +11 -0
  77. data/demo/bower_components/jquery/test/data/dimensions/documentLarge.html +17 -0
  78. data/demo/bower_components/jquery/test/data/dimensions/documentSmall.html +21 -0
  79. data/demo/bower_components/jquery/test/data/echoData.php +1 -0
  80. data/demo/bower_components/jquery/test/data/echoQuery.php +1 -0
  81. data/demo/bower_components/jquery/test/data/errorWithJSON.php +6 -0
  82. data/demo/bower_components/jquery/test/data/errorWithText.php +5 -0
  83. data/demo/bower_components/jquery/test/data/etag.php +21 -0
  84. data/demo/bower_components/jquery/test/data/evalScript.php +1 -0
  85. data/demo/bower_components/jquery/test/data/event/focusElem.html +16 -0
  86. data/demo/bower_components/jquery/test/data/event/longLoadScript.php +4 -0
  87. data/demo/bower_components/jquery/test/data/event/promiseReady.html +17 -0
  88. data/demo/bower_components/jquery/test/data/event/syncReady.html +23 -0
  89. data/demo/bower_components/jquery/test/data/headers.php +18 -0
  90. data/demo/bower_components/jquery/test/data/if_modified_since.php +20 -0
  91. data/demo/bower_components/jquery/test/data/iframe.html +8 -0
  92. data/demo/bower_components/jquery/test/data/jquery-1.9.1.ajax_xhr.min.js +5 -0
  93. data/demo/bower_components/jquery/test/data/json.php +13 -0
  94. data/demo/bower_components/jquery/test/data/json_obj.js +1 -0
  95. data/demo/bower_components/jquery/test/data/jsonp.php +14 -0
  96. data/demo/bower_components/jquery/test/data/manipulation/iframe-denied.html +36 -0
  97. data/demo/bower_components/jquery/test/data/name.html +1 -0
  98. data/demo/bower_components/jquery/test/data/name.php +24 -0
  99. data/demo/bower_components/jquery/test/data/nocontent.php +5 -0
  100. data/demo/bower_components/jquery/test/data/offset/absolute.html +41 -0
  101. data/demo/bower_components/jquery/test/data/offset/body.html +26 -0
  102. data/demo/bower_components/jquery/test/data/offset/fixed.html +34 -0
  103. data/demo/bower_components/jquery/test/data/offset/relative.html +31 -0
  104. data/demo/bower_components/jquery/test/data/offset/scroll.html +39 -0
  105. data/demo/bower_components/jquery/test/data/offset/static.html +31 -0
  106. data/demo/bower_components/jquery/test/data/offset/table.html +43 -0
  107. data/demo/bower_components/jquery/test/data/params_html.php +12 -0
  108. data/demo/bower_components/jquery/test/data/readywaitasset.js +1 -0
  109. data/demo/bower_components/jquery/test/data/readywaitloader.js +25 -0
  110. data/demo/bower_components/jquery/test/data/script.php +11 -0
  111. data/demo/bower_components/jquery/test/data/selector/html5_selector.html +114 -0
  112. data/demo/bower_components/jquery/test/data/selector/sizzle_cache.html +21 -0
  113. data/demo/bower_components/jquery/test/data/statusText.php +5 -0
  114. data/demo/bower_components/jquery/test/data/support/bodyBackground.html +28 -0
  115. data/demo/bower_components/jquery/test/data/support/boxSizing.html +19 -0
  116. data/demo/bower_components/jquery/test/data/support/csp.js +3 -0
  117. data/demo/bower_components/jquery/test/data/support/csp.php +22 -0
  118. data/demo/bower_components/jquery/test/data/support/shrinkWrapBlocks.html +23 -0
  119. data/demo/bower_components/jquery/test/data/support/testElementCrash.html +17 -0
  120. data/demo/bower_components/jquery/test/data/test.html +7 -0
  121. data/demo/bower_components/jquery/test/data/test.js +3 -0
  122. data/demo/bower_components/jquery/test/data/test.php +7 -0
  123. data/demo/bower_components/jquery/test/data/test2.html +5 -0
  124. data/demo/bower_components/jquery/test/data/test3.html +3 -0
  125. data/demo/bower_components/jquery/test/data/testinit.js +264 -0
  126. data/demo/bower_components/jquery/test/data/testrunner.js +371 -0
  127. data/demo/bower_components/jquery/test/data/testsuite.css +155 -0
  128. data/demo/bower_components/jquery/test/data/text.php +12 -0
  129. data/demo/bower_components/jquery/test/data/ua.txt +272 -0
  130. data/demo/bower_components/jquery/test/data/with_fries.xml +25 -0
  131. data/demo/bower_components/jquery/test/data/with_fries_over_jsonp.php +7 -0
  132. data/demo/bower_components/jquery/test/delegatetest.html +228 -0
  133. data/demo/bower_components/jquery/test/hovertest.html +158 -0
  134. data/demo/bower_components/jquery/test/index.html +337 -0
  135. data/demo/bower_components/jquery/test/jquery.js +5 -0
  136. data/demo/bower_components/jquery/test/localfile.html +75 -0
  137. data/demo/bower_components/jquery/test/networkerror.html +84 -0
  138. data/demo/bower_components/jquery/test/readywait.html +70 -0
  139. data/demo/bower_components/jquery/test/unit/ajax.js +2016 -0
  140. data/demo/bower_components/jquery/test/unit/attributes.js +1388 -0
  141. data/demo/bower_components/jquery/test/unit/callbacks.js +342 -0
  142. data/demo/bower_components/jquery/test/unit/core.js +1360 -0
  143. data/demo/bower_components/jquery/test/unit/css.js +1056 -0
  144. data/demo/bower_components/jquery/test/unit/data.js +645 -0
  145. data/demo/bower_components/jquery/test/unit/deferred.js +436 -0
  146. data/demo/bower_components/jquery/test/unit/deprecated.js +8 -0
  147. data/demo/bower_components/jquery/test/unit/dimensions.js +472 -0
  148. data/demo/bower_components/jquery/test/unit/effects.js +2242 -0
  149. data/demo/bower_components/jquery/test/unit/event.js +2755 -0
  150. data/demo/bower_components/jquery/test/unit/exports.js +7 -0
  151. data/demo/bower_components/jquery/test/unit/manipulation.js +2120 -0
  152. data/demo/bower_components/jquery/test/unit/offset.js +559 -0
  153. data/demo/bower_components/jquery/test/unit/queue.js +314 -0
  154. data/demo/bower_components/jquery/test/unit/selector.js +172 -0
  155. data/demo/bower_components/jquery/test/unit/serialize.js +148 -0
  156. data/demo/bower_components/jquery/test/unit/support.js +370 -0
  157. data/demo/bower_components/jquery/test/unit/traversing.js +797 -0
  158. data/demo/bower_components/jquery/test/unit/wrap.js +265 -0
  159. data/demo/bower_components/jquery/test/xhtml.php +5 -0
  160. data/demo/index.html +347 -0
  161. data/demo/styles/main.css +208 -0
  162. data/demo/styles/main.scss +138 -0
  163. data/docs/docco.css +506 -0
  164. data/docs/guff.html +1127 -0
  165. data/docs/public/fonts/aller-bold.eot +0 -0
  166. data/docs/public/fonts/aller-bold.ttf +0 -0
  167. data/docs/public/fonts/aller-bold.woff +0 -0
  168. data/docs/public/fonts/aller-light.eot +0 -0
  169. data/docs/public/fonts/aller-light.ttf +0 -0
  170. data/docs/public/fonts/aller-light.woff +0 -0
  171. data/docs/public/fonts/novecento-bold.eot +0 -0
  172. data/docs/public/fonts/novecento-bold.ttf +0 -0
  173. data/docs/public/fonts/novecento-bold.woff +0 -0
  174. data/docs/public/stylesheets/normalize.css +375 -0
  175. data/guff.gemspec +16 -0
  176. data/guff.scss +514 -0
  177. data/gulpfile.js +67 -0
  178. data/lib/guff.rb +4 -0
  179. data/lib/stylesheets/_guff.scss +514 -0
  180. data/package.json +19 -0
  181. data/src/_functions.scss +57 -0
  182. data/src/_mixins.scss +301 -0
  183. data/src/_reset.scss +67 -0
  184. data/src/_settings.scss +22 -0
  185. data/src/_typography.scss +67 -0
  186. metadata +259 -0
@@ -0,0 +1,23 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ * {
7
+ -webkit-box-sizing: border-box;
8
+ -moz-box-sizing: border-box;
9
+ box-sizing: border-box;
10
+ }
11
+ </style>
12
+ </head>
13
+ <body>
14
+ <div>
15
+ <script src="../../jquery.js"></script>
16
+ </div>
17
+ <script>
18
+ jQuery(function() {
19
+ window.parent.iframeCallback( jQuery.support.shrinkWrapBlocks );
20
+ });
21
+ </script>
22
+ </body>
23
+ </html>
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <style>
6
+ body {
7
+ background: url('../1x1.jpg');
8
+ }
9
+ </style>
10
+ <script src="../../jquery.js"></script>
11
+ </head>
12
+ <body>
13
+ <script>
14
+ window.parent.iframeCallback();
15
+ </script>
16
+ </body>
17
+ </html>
@@ -0,0 +1,7 @@
1
+ html text<br/>
2
+ <script type="text/javascript">/* <![CDATA[ */
3
+ testFoo = "foo"; jQuery('#foo').html('foo');
4
+ ok( true, "test.html executed" );
5
+ /* ]]> */</script>
6
+ <script src="data/test.js"></script>
7
+ blabla
@@ -0,0 +1,3 @@
1
+ this.testBar = "bar";
2
+ jQuery("#ap").html("bar");
3
+ ok( true, "test.js executed");
@@ -0,0 +1,7 @@
1
+ html text<br/>
2
+ <script type="text/javascript">/* <![CDATA[ */
3
+ testFoo = "foo"; jQuery('#foo').html('foo');
4
+ ok( true, "test.php executed" );
5
+ /* ]]> */</script>
6
+ <script src="data/test.js?<?php srand(); echo time() . '' . rand(); ?>"></script>
7
+ blabla
@@ -0,0 +1,5 @@
1
+ <script type="text/javascript">
2
+ var testFoo = "foo";
3
+ jQuery('#foo').html('foo');
4
+ ok( true, "test2.html executed" );
5
+ </script>
@@ -0,0 +1,3 @@
1
+ <div class="user">This is a user</div>
2
+ <div class="user">This is a user</div>
3
+ <div class="teacher">This is a teacher</div>
@@ -0,0 +1,264 @@
1
+ /*jshint multistr:true, quotmark:false */
2
+
3
+ var amdDefined, fireNative,
4
+ originaljQuery = this.jQuery || "jQuery",
5
+ original$ = this.$ || "$",
6
+ // see RFC 2606
7
+ externalHost = "example.com";
8
+
9
+ this.hasPHP = true;
10
+ this.isLocal = window.location.protocol === "file:";
11
+
12
+ // For testing .noConflict()
13
+ this.jQuery = originaljQuery;
14
+ this.$ = original$;
15
+
16
+ /**
17
+ * Set up a mock AMD define function for testing AMD registration.
18
+ */
19
+ function define( name, dependencies, callback ) {
20
+ amdDefined = callback();
21
+ }
22
+
23
+ define.amd = {};
24
+
25
+ /**
26
+ * Returns an array of elements with the given IDs
27
+ * @example q("main", "foo", "bar")
28
+ * @result [<div id="main">, <span id="foo">, <input id="bar">]
29
+ */
30
+ this.q = function() {
31
+ var r = [],
32
+ i = 0;
33
+
34
+ for ( ; i < arguments.length; i++ ) {
35
+ r.push( document.getElementById( arguments[i] ) );
36
+ }
37
+ return r;
38
+ };
39
+
40
+ /**
41
+ * Asserts that a select matches the given IDs
42
+ * @param {String} a - Assertion name
43
+ * @param {String} b - Sizzle selector
44
+ * @param {String} c - Array of ids to construct what is expected
45
+ * @example t("Check for something", "//[a]", ["foo", "baar"]);
46
+ * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar'
47
+ */
48
+ this.t = function( a, b, c ) {
49
+ var f = jQuery(b).get(),
50
+ s = "",
51
+ i = 0;
52
+
53
+ for ( ; i < f.length; i++ ) {
54
+ s += ( s && "," ) + '"' + f[ i ].id + '"';
55
+ }
56
+
57
+ deepEqual(f, q.apply( q, c ), a + " (" + b + ")");
58
+ };
59
+
60
+ this.createDashboardXML = function() {
61
+ var string = '<?xml version="1.0" encoding="UTF-8"?> \
62
+ <dashboard> \
63
+ <locations class="foo"> \
64
+ <location for="bar" checked="different"> \
65
+ <infowindowtab normal="ab" mixedCase="yes"> \
66
+ <tab title="Location"><![CDATA[blabla]]></tab> \
67
+ <tab title="Users"><![CDATA[blublu]]></tab> \
68
+ </infowindowtab> \
69
+ </location> \
70
+ </locations> \
71
+ </dashboard>';
72
+
73
+ return jQuery.parseXML(string);
74
+ };
75
+
76
+ this.createWithFriesXML = function() {
77
+ var string = '<?xml version="1.0" encoding="UTF-8"?> \
78
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" \
79
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" \
80
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> \
81
+ <soap:Body> \
82
+ <jsconf xmlns="http://{{ externalHost }}/ns1"> \
83
+ <response xmlns:ab="http://{{ externalHost }}/ns2"> \
84
+ <meta> \
85
+ <component id="seite1" class="component"> \
86
+ <properties xmlns:cd="http://{{ externalHost }}/ns3"> \
87
+ <property name="prop1"> \
88
+ <thing /> \
89
+ <value>1</value> \
90
+ </property> \
91
+ <property name="prop2"> \
92
+ <thing att="something" /> \
93
+ </property> \
94
+ <foo_bar>foo</foo_bar> \
95
+ </properties> \
96
+ </component> \
97
+ </meta> \
98
+ </response> \
99
+ </jsconf> \
100
+ </soap:Body> \
101
+ </soap:Envelope>';
102
+
103
+ return jQuery.parseXML( string.replace( /\{\{\s*externalHost\s*\}\}/g, externalHost ) );
104
+ };
105
+
106
+ this.createXMLFragment = function() {
107
+ var xml, frag;
108
+ if ( window.ActiveXObject ) {
109
+ xml = new ActiveXObject("msxml2.domdocument");
110
+ } else {
111
+ xml = document.implementation.createDocument( "", "", null );
112
+ }
113
+
114
+ if ( xml ) {
115
+ frag = xml.createElement("data");
116
+ }
117
+
118
+ return frag;
119
+ };
120
+
121
+ fireNative = document.createEvent ?
122
+ function( node, type ) {
123
+ var event = document.createEvent('HTMLEvents');
124
+ event.initEvent( type, true, true );
125
+ node.dispatchEvent( event );
126
+ } :
127
+ function( node, type ) {
128
+ var event = document.createEventObject();
129
+ node.fireEvent( 'on' + type, event );
130
+ };
131
+
132
+ /**
133
+ * Add random number to url to stop caching
134
+ *
135
+ * @example url("data/test.html")
136
+ * @result "data/test.html?10538358428943"
137
+ *
138
+ * @example url("data/test.php?foo=bar")
139
+ * @result "data/test.php?foo=bar&10538358345554"
140
+ */
141
+ function url( value ) {
142
+ return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random() * 100000, 10);
143
+ }
144
+
145
+ // Ajax testing helper
146
+ this.ajaxTest = function( title, expect, options ) {
147
+ var requestOptions;
148
+ if ( jQuery.isFunction( options ) ) {
149
+ options = options();
150
+ }
151
+ options = options || [];
152
+ requestOptions = options.requests || options.request || options;
153
+ if ( !jQuery.isArray( requestOptions ) ) {
154
+ requestOptions = [ requestOptions ];
155
+ }
156
+ asyncTest( title, expect, function() {
157
+ if ( options.setup ) {
158
+ options.setup();
159
+ }
160
+
161
+ var completed = false,
162
+ remaining = requestOptions.length,
163
+ complete = function() {
164
+ if ( !completed && --remaining === 0 ) {
165
+ completed = true;
166
+ delete ajaxTest.abort;
167
+ if ( options.teardown ) {
168
+ options.teardown();
169
+ }
170
+ start();
171
+ }
172
+ },
173
+ requests = jQuery.map( requestOptions, function( options ) {
174
+ var request = ( options.create || jQuery.ajax )( options ),
175
+ callIfDefined = function( deferType, optionType ) {
176
+ var handler = options[ deferType ] || !!options[ optionType ];
177
+ return function( _, status ) {
178
+ if ( !completed ) {
179
+ if ( !handler ) {
180
+ ok( false, "unexpected " + status );
181
+ } else if ( jQuery.isFunction( handler ) ) {
182
+ handler.apply( this, arguments );
183
+ }
184
+ }
185
+ };
186
+ };
187
+
188
+ if ( options.afterSend ) {
189
+ options.afterSend( request );
190
+ }
191
+
192
+ return request
193
+ .done( callIfDefined( "done", "success" ) )
194
+ .fail( callIfDefined( "fail", "error" ) )
195
+ .always( complete );
196
+ });
197
+
198
+ ajaxTest.abort = function( reason ) {
199
+ if ( !completed ) {
200
+ completed = true;
201
+ delete ajaxTest.abort;
202
+ ok( false, "aborted " + reason );
203
+ jQuery.each( requests, function( i, request ) {
204
+ request.abort();
205
+ });
206
+ }
207
+ };
208
+ });
209
+ };
210
+
211
+
212
+ this.testIframe = function( fileName, name, fn ) {
213
+
214
+ test(name, function() {
215
+ // pause execution for now
216
+ stop();
217
+
218
+ // load fixture in iframe
219
+ var iframe = loadFixture(),
220
+ win = iframe.contentWindow,
221
+ interval = setInterval( function() {
222
+ if ( win && win.jQuery && win.jQuery.isReady ) {
223
+ clearInterval( interval );
224
+ // continue
225
+ start();
226
+ // call actual tests passing the correct jQuery instance to use
227
+ fn.call( this, win.jQuery, win, win.document );
228
+ document.body.removeChild( iframe );
229
+ iframe = null;
230
+ }
231
+ }, 15 );
232
+ });
233
+
234
+ function loadFixture() {
235
+ var src = url("./data/" + fileName + ".html"),
236
+ iframe = jQuery("<iframe />").appendTo("body")[0];
237
+ iframe.style.cssText = "width: 500px; height: 500px; position: absolute; top: -600px; left: -600px; visibility: hidden;";
238
+ iframe.contentWindow.location = src;
239
+ return iframe;
240
+ }
241
+ };
242
+
243
+ this.testIframeWithCallback = function( title, fileName, func ) {
244
+
245
+ test( title, function() {
246
+ var iframe;
247
+
248
+ stop();
249
+ window.iframeCallback = function() {
250
+ var self = this,
251
+ args = arguments;
252
+ setTimeout(function() {
253
+ window.iframeCallback = undefined;
254
+ iframe.remove();
255
+ func.apply( self, args );
256
+ func = function() {};
257
+ start();
258
+ }, 0 );
259
+ };
260
+ iframe = jQuery( "<div/>" ).append(
261
+ jQuery( "<iframe/>" ).attr( "src", url( "./data/" + fileName ) )
262
+ ).appendTo( "body" );
263
+ });
264
+ };
@@ -0,0 +1,371 @@
1
+ /**
2
+ * Allow the test suite to run with other libs or jQuery's.
3
+ */
4
+ jQuery.noConflict();
5
+
6
+ // For checking globals pollution despite auto-created globals in various environments
7
+ jQuery.each( [ jQuery.expando, "getInterface", "Packages", "java", "netscape" ], function( i, name ) {
8
+ window[ name ] = window[ name ];
9
+ });
10
+
11
+ // Expose Sizzle for Sizzle's selector tests
12
+ // We remove Sizzle's globalization in jQuery
13
+ var Sizzle = Sizzle || jQuery.find,
14
+
15
+ // Allow subprojects to test against their own fixtures
16
+ qunitModule = QUnit.module,
17
+ qunitTest = QUnit.test;
18
+
19
+ this.testSubproject = function( label, url, risTests ) {
20
+ var sub, fixture, fixtureHTML,
21
+ fixtureReplaced = false;
22
+
23
+ // Don't let subproject tests jump the gun
24
+ QUnit.config.reorder = false;
25
+
26
+ // Create module
27
+ module( label );
28
+
29
+ // Duckpunch QUnit
30
+ // TODO restore parent fixture on teardown to support reordering
31
+ module = QUnit.module = function( name ) {
32
+ var args = arguments;
33
+
34
+ // Remember subproject-scoped module name
35
+ sub = name;
36
+
37
+ // Override
38
+ args[0] = label;
39
+ return qunitModule.apply( this, args );
40
+ };
41
+ test = function( name ) {
42
+ var args = arguments,
43
+ i = args.length - 1;
44
+
45
+ // Prepend subproject-scoped module name to test name
46
+ args[0] = sub + ": " + name;
47
+
48
+ // Find test function and wrap to require subproject fixture
49
+ for ( ; i >= 0; i-- ) {
50
+ if ( originaljQuery.isFunction( args[i] ) ) {
51
+ args[i] = requireFixture( args[i] );
52
+ break;
53
+ }
54
+ }
55
+
56
+ return qunitTest.apply( this, args );
57
+ };
58
+
59
+ // Load tests and fixture from subproject
60
+ // Test order matters, so we must be synchronous and throw an error on load failure
61
+ originaljQuery.ajax( url, {
62
+ async: false,
63
+ dataType: "html",
64
+ error: function( jqXHR, status ) {
65
+ throw new Error( "Could not load: " + url + " (" + status + ")" );
66
+ },
67
+ success: function( data, status, jqXHR ) {
68
+ var page = originaljQuery.parseHTML(
69
+ // replace html/head with dummy elements so they are represented in the DOM
70
+ ( data || "" ).replace( /<\/?((!DOCTYPE|html|head)\b.*?)>/gi, "[$1]" ),
71
+ document,
72
+ true
73
+ );
74
+
75
+ if ( !page || !page.length ) {
76
+ this.error( jqXHR, "no data" );
77
+ }
78
+ page = originaljQuery( page );
79
+
80
+ // Include subproject tests
81
+ page.filter("script[src]").add( page.find("script[src]") ).each(function() {
82
+ var src = originaljQuery( this ).attr("src"),
83
+ html = "<script src='" + url + src + "'></script>";
84
+ if ( risTests.test( src ) ) {
85
+ if ( originaljQuery.isReady ) {
86
+ originaljQuery("head").first().append( html );
87
+ } else {
88
+ document.write( html );
89
+ }
90
+ }
91
+ });
92
+
93
+ // Get the fixture, including content outside of #qunit-fixture
94
+ fixture = page.find("[id='qunit-fixture']");
95
+ fixtureHTML = fixture.html();
96
+ fixture.empty();
97
+ while ( fixture.length && !fixture.prevAll("[id='qunit']").length ) {
98
+ fixture = fixture.parent();
99
+ }
100
+ fixture = fixture.add( fixture.nextAll() );
101
+ }
102
+ });
103
+
104
+ function requireFixture( fn ) {
105
+ return function() {
106
+ if ( !fixtureReplaced ) {
107
+ // Make sure that we retrieved a fixture for the subproject
108
+ if ( !fixture.length ) {
109
+ ok( false, "Found subproject fixture" );
110
+ return;
111
+ }
112
+
113
+ // Replace the current fixture, including content outside of #qunit-fixture
114
+ var oldFixture = originaljQuery("#qunit-fixture");
115
+ while ( oldFixture.length && !oldFixture.prevAll("[id='qunit']").length ) {
116
+ oldFixture = oldFixture.parent();
117
+ }
118
+ oldFixture.nextAll().remove();
119
+ oldFixture.replaceWith( fixture );
120
+
121
+ // WARNING: UNDOCUMENTED INTERFACE
122
+ QUnit.config.fixture = fixtureHTML;
123
+ QUnit.reset();
124
+ if ( originaljQuery("#qunit-fixture").html() !== fixtureHTML ) {
125
+ ok( false, "Copied subproject fixture" );
126
+ return;
127
+ }
128
+
129
+ fixtureReplaced = true;
130
+ }
131
+
132
+ fn.apply( this, arguments );
133
+ };
134
+ }
135
+ };
136
+
137
+ // Register globals for cleanup and the cleanup code itself
138
+ // Explanation at http://perfectionkills.com/understanding-delete/#ie_bugs
139
+ this.Globals = (function() {
140
+ var globals = {};
141
+ return {
142
+ register: function( name ) {
143
+ globals[ name ] = true;
144
+ jQuery.globalEval( "var " + name + " = undefined;" );
145
+ },
146
+ cleanup: function() {
147
+ var name,
148
+ current = globals;
149
+ globals = {};
150
+ for ( name in current ) {
151
+ jQuery.globalEval( "try { " +
152
+ "delete " + ( jQuery.support.deleteExpando ? "window['" + name + "']" : name ) +
153
+ "; } catch( x ) {}" );
154
+ }
155
+ }
156
+ };
157
+ })();
158
+
159
+ // Sandbox start for great justice
160
+ (function() {
161
+ var oldStart = window.start;
162
+ window.start = function() {
163
+ oldStart();
164
+ };
165
+ })();
166
+
167
+ /**
168
+ * QUnit hooks
169
+ */
170
+ (function() {
171
+ // Store the old counts so that we only assert on tests that have actually leaked,
172
+ // instead of asserting every time a test has leaked sometime in the past
173
+ var oldCacheLength = 0,
174
+ oldFragmentsLength = 0,
175
+ oldActive = 0,
176
+
177
+ expectedDataKeys = {},
178
+
179
+ splice = [].splice,
180
+ reset = QUnit.reset,
181
+ ajaxSettings = jQuery.ajaxSettings;
182
+
183
+ function keys(o) {
184
+ var ret, key;
185
+ if ( Object.keys ) {
186
+ ret = Object.keys( o );
187
+ } else {
188
+ ret = [];
189
+ for ( key in o ) {
190
+ ret.push( key );
191
+ }
192
+ }
193
+ ret.sort();
194
+ return ret;
195
+ }
196
+
197
+ /**
198
+ * @param {jQuery|HTMLElement|Object|Array} elems Target (or array of targets) for jQuery.data.
199
+ * @param {string} key
200
+ */
201
+ QUnit.expectJqData = function( elems, key ) {
202
+ var i, elem, expando;
203
+ QUnit.current_testEnvironment.checkJqData = true;
204
+
205
+ if ( elems.jquery && elems.toArray ) {
206
+ elems = elems.toArray();
207
+ }
208
+ if ( !jQuery.isArray( elems ) ) {
209
+ elems = [ elems ];
210
+ }
211
+
212
+ for ( i = 0; i < elems.length; i++ ) {
213
+ elem = elems[i];
214
+
215
+ // jQuery.data only stores data for nodes in jQuery.cache,
216
+ // for other data targets the data is stored in the object itself,
217
+ // in that case we can't test that target for memory leaks.
218
+ // But we don't have to since in that case the data will/must will
219
+ // be available as long as the object is not garbage collected by
220
+ // the js engine, and when it is, the data will be removed with it.
221
+ if ( !elem.nodeType ) {
222
+ // Fixes false positives for dataTests(window), dataTests({}).
223
+ continue;
224
+ }
225
+
226
+ expando = elem[ jQuery.expando ];
227
+
228
+ if ( expando === undefined ) {
229
+ // In this case the element exists fine, but
230
+ // jQuery.data (or internal data) was never (in)directly
231
+ // called.
232
+ // Since this method was called it means some data was
233
+ // expected to be found, but since there is nothing, fail early
234
+ // (instead of in teardown).
235
+ notStrictEqual( expando, undefined, "Target for expectJqData must have an expando, for else there can be no data to expect." );
236
+ } else {
237
+ if ( expectedDataKeys[expando] ) {
238
+ expectedDataKeys[expando].push( key );
239
+ } else {
240
+ expectedDataKeys[expando] = [ key ];
241
+ }
242
+ }
243
+ }
244
+ };
245
+ QUnit.config.urlConfig.push( {
246
+ id: "jqdata",
247
+ label: "Always check jQuery.data",
248
+ tooltip: "Trigger QUnit.expectJqData detection for all tests instead of just the ones that call it"
249
+ } );
250
+
251
+ /**
252
+ * Ensures that tests have cleaned up properly after themselves. Should be passed as the
253
+ * teardown function on all modules' lifecycle object.
254
+ */
255
+ this.moduleTeardown = function() {
256
+ var i,
257
+ expectedKeys, actualKeys,
258
+ fragmentsLength = 0,
259
+ cacheLength = 0;
260
+
261
+ // Only look for jQuery data problems if this test actually
262
+ // provided some information to compare against.
263
+ if ( QUnit.urlParams.jqdata || this.checkJqData ) {
264
+ for ( i in jQuery.cache ) {
265
+ expectedKeys = expectedDataKeys[i];
266
+ actualKeys = jQuery.cache[i] ? keys( jQuery.cache[i] ) : jQuery.cache[i];
267
+ if ( !QUnit.equiv( expectedKeys, actualKeys ) ) {
268
+ deepEqual( actualKeys, expectedKeys, "Expected keys exist in jQuery.cache" );
269
+ }
270
+ delete jQuery.cache[i];
271
+ delete expectedDataKeys[i];
272
+ }
273
+ // In case it was removed from cache before (or never there in the first place)
274
+ for ( i in expectedDataKeys ) {
275
+ deepEqual( expectedDataKeys[i], undefined, "No unexpected keys were left in jQuery.cache (#" + i + ")" );
276
+ delete expectedDataKeys[i];
277
+ }
278
+ }
279
+
280
+ // Reset data register
281
+ expectedDataKeys = {};
282
+
283
+ // Check for (and clean up, if possible) incomplete animations/requests/etc.
284
+ if ( jQuery.timers && jQuery.timers.length !== 0 ) {
285
+ equal( jQuery.timers.length, 0, "No timers are still running" );
286
+ splice.call( jQuery.timers, 0, jQuery.timers.length );
287
+ jQuery.fx.stop();
288
+ }
289
+ if ( jQuery.active !== undefined && jQuery.active !== oldActive ) {
290
+ equal( jQuery.active, oldActive, "No AJAX requests are still active" );
291
+ if ( ajaxTest.abort ) {
292
+ ajaxTest.abort("active requests");
293
+ }
294
+ oldActive = jQuery.active;
295
+ }
296
+
297
+ // Allow QUnit.reset to clean up any attached elements before checking for leaks
298
+ QUnit.reset();
299
+
300
+ for ( i in jQuery.cache ) {
301
+ ++cacheLength;
302
+ }
303
+
304
+ jQuery.fragments = {};
305
+
306
+ for ( i in jQuery.fragments ) {
307
+ ++fragmentsLength;
308
+ }
309
+
310
+ // Because QUnit doesn't have a mechanism for retrieving the number of expected assertions for a test,
311
+ // if we unconditionally assert any of these, the test will fail with too many assertions :|
312
+ if ( cacheLength !== oldCacheLength ) {
313
+ equal( cacheLength, oldCacheLength, "No unit tests leak memory in jQuery.cache" );
314
+ oldCacheLength = cacheLength;
315
+ }
316
+ if ( fragmentsLength !== oldFragmentsLength ) {
317
+ equal( fragmentsLength, oldFragmentsLength, "No unit tests leak memory in jQuery.fragments" );
318
+ oldFragmentsLength = fragmentsLength;
319
+ }
320
+ };
321
+
322
+ QUnit.done(function() {
323
+ // Remove our own fixtures outside #qunit-fixture
324
+ jQuery("#qunit ~ *").remove();
325
+ });
326
+
327
+ // jQuery-specific QUnit.reset
328
+ QUnit.reset = function() {
329
+
330
+ // Ensure jQuery events and data on the fixture are properly removed
331
+ jQuery("#qunit-fixture").empty();
332
+
333
+ // Reset internal jQuery state
334
+ jQuery.event.global = {};
335
+ if ( ajaxSettings ) {
336
+ jQuery.ajaxSettings = jQuery.extend( true, {}, ajaxSettings );
337
+ } else {
338
+ delete jQuery.ajaxSettings;
339
+ }
340
+
341
+ // Cleanup globals
342
+ Globals.cleanup();
343
+
344
+ // Let QUnit reset the fixture
345
+ reset.apply( this, arguments );
346
+ };
347
+ })();
348
+
349
+ /**
350
+ * QUnit configuration
351
+ */
352
+ // Max time for stop() and asyncTest() until it aborts test
353
+ // and start()'s the next test.
354
+ QUnit.config.testTimeout = 20 * 1000; // 20 seconds
355
+
356
+ // Enforce an "expect" argument or expect() call in all test bodies.
357
+ QUnit.config.requireExpects = true;
358
+
359
+ /**
360
+ * Load the TestSwarm listener if swarmURL is in the address.
361
+ */
362
+ (function() {
363
+ var url = window.location.search;
364
+ url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + "swarmURL=".length ) );
365
+
366
+ if ( !url || url.indexOf("http") !== 0 ) {
367
+ return;
368
+ }
369
+
370
+ document.write("<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date()).getTime() + "'></scr" + "ipt>");
371
+ })();