guff-compass 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
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,1056 @@
1
+ if ( jQuery.css ) {
2
+
3
+ module("css", { teardown: moduleTeardown });
4
+
5
+ test("css(String|Hash)", function() {
6
+ expect( 41 );
7
+
8
+ equal( jQuery("#qunit-fixture").css("display"), "block", "Check for css property \"display\"" );
9
+
10
+ var $child, div, div2, width, height, child, prctval, checkval, old;
11
+
12
+ $child = jQuery("#nothiddendivchild").css({ "width": "20%", "height": "20%" });
13
+ notEqual( $child.css("width"), "20px", "Retrieving a width percentage on the child of a hidden div returns percentage" );
14
+ notEqual( $child.css("height"), "20px", "Retrieving a height percentage on the child of a hidden div returns percentage" );
15
+
16
+ div = jQuery( "<div>" );
17
+
18
+ // These should be "auto" (or some better value)
19
+ // temporarily provide "0px" for backwards compat
20
+ equal( div.css("width"), "0px", "Width on disconnected node." );
21
+ equal( div.css("height"), "0px", "Height on disconnected node." );
22
+
23
+ div.css({ "width": 4, "height": 4 });
24
+
25
+ equal( div.css("width"), "4px", "Width on disconnected node." );
26
+ equal( div.css("height"), "4px", "Height on disconnected node." );
27
+
28
+ div2 = jQuery( "<div style='display:none;'><input type='text' style='height:20px;'/><textarea style='height:20px;'/><div style='height:20px;'></div></div>").appendTo("body");
29
+
30
+ equal( div2.find("input").css("height"), "20px", "Height on hidden input." );
31
+ equal( div2.find("textarea").css("height"), "20px", "Height on hidden textarea." );
32
+ equal( div2.find("div").css("height"), "20px", "Height on hidden textarea." );
33
+
34
+ div2.remove();
35
+
36
+ // handle negative numbers by setting to zero #11604
37
+ jQuery("#nothiddendiv").css( {"width": 1, "height": 1} );
38
+
39
+ width = parseFloat(jQuery("#nothiddendiv").css("width"));
40
+ height = parseFloat(jQuery("#nothiddendiv").css("height"));
41
+ jQuery("#nothiddendiv").css({ "overflow":"hidden", "width": -1, "height": -1 });
42
+ equal( parseFloat(jQuery("#nothiddendiv").css("width")), 0, "Test negative width set to 0");
43
+ equal( parseFloat(jQuery("#nothiddendiv").css("height")), 0, "Test negative height set to 0");
44
+
45
+ equal( jQuery("<div style='display: none;'>").css("display"), "none", "Styles on disconnected nodes");
46
+
47
+ jQuery("#floatTest").css({"float": "right"});
48
+ equal( jQuery("#floatTest").css("float"), "right", "Modified CSS float using \"float\": Assert float is right");
49
+ jQuery("#floatTest").css({"font-size": "30px"});
50
+ equal( jQuery("#floatTest").css("font-size"), "30px", "Modified CSS font-size: Assert font-size is 30px");
51
+ jQuery.each("0,0.25,0.5,0.75,1".split(","), function(i, n) {
52
+ jQuery("#foo").css({"opacity": n});
53
+
54
+ equal( jQuery("#foo").css("opacity"), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
55
+ jQuery("#foo").css({"opacity": parseFloat(n)});
56
+ equal( jQuery("#foo").css("opacity"), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
57
+ });
58
+ jQuery("#foo").css({"opacity": ""});
59
+ equal( jQuery("#foo").css("opacity"), "1", "Assert opacity is 1 when set to an empty String" );
60
+
61
+ equal( jQuery("#empty").css("opacity"), "0", "Assert opacity is accessible via filter property set in stylesheet in IE" );
62
+ jQuery("#empty").css({ "opacity": "1" });
63
+ equal( jQuery("#empty").css("opacity"), "1", "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" );
64
+ jQuery.support.opacity ?
65
+ ok(true, "Requires the same number of tests"):
66
+ ok( ~jQuery("#empty")[0].currentStyle.filter.indexOf("gradient"), "Assert setting opacity doesn't overwrite other filters of the stylesheet in IE" );
67
+
68
+ div = jQuery("#nothiddendiv");
69
+ child = jQuery("#nothiddendivchild");
70
+
71
+ equal( parseInt(div.css("fontSize"), 10), 16, "Verify fontSize px set." );
72
+ equal( parseInt(div.css("font-size"), 10), 16, "Verify fontSize px set." );
73
+ equal( parseInt(child.css("fontSize"), 10), 16, "Verify fontSize px set." );
74
+ equal( parseInt(child.css("font-size"), 10), 16, "Verify fontSize px set." );
75
+
76
+ child.css("height", "100%");
77
+ equal( child[0].style.height, "100%", "Make sure the height is being set correctly." );
78
+
79
+ child.attr("class", "em");
80
+ equal( parseInt(child.css("fontSize"), 10), 32, "Verify fontSize em set." );
81
+
82
+ // Have to verify this as the result depends upon the browser's CSS
83
+ // support for font-size percentages
84
+ child.attr("class", "prct");
85
+ prctval = parseInt(child.css("fontSize"), 10);
86
+ checkval = 0;
87
+ if ( prctval === 16 || prctval === 24 ) {
88
+ checkval = prctval;
89
+ }
90
+
91
+ equal( prctval, checkval, "Verify fontSize % set." );
92
+
93
+ equal( typeof child.css("width"), "string", "Make sure that a string width is returned from css('width')." );
94
+
95
+ old = child[0].style.height;
96
+
97
+ // Test NaN
98
+ child.css("height", parseFloat("zoo"));
99
+ equal( child[0].style.height, old, "Make sure height isn't changed on NaN." );
100
+
101
+ // Test null
102
+ child.css("height", null);
103
+ equal( child[0].style.height, old, "Make sure height isn't changed on null." );
104
+
105
+ old = child[0].style.fontSize;
106
+
107
+ // Test NaN
108
+ child.css("font-size", parseFloat("zoo"));
109
+ equal( child[0].style.fontSize, old, "Make sure font-size isn't changed on NaN." );
110
+
111
+ // Test null
112
+ child.css("font-size", null);
113
+ equal( child[0].style.fontSize, old, "Make sure font-size isn't changed on null." );
114
+ });
115
+
116
+ test("css() explicit and relative values", function() {
117
+ expect( 30 );
118
+ var $elem = jQuery("#nothiddendiv");
119
+
120
+ $elem.css({ "width": 1, "height": 1, "paddingLeft": "1px", "opacity": 1 });
121
+ equal( $elem.css("width"), "1px", "Initial css set or width/height works (hash)" );
122
+ equal( $elem.css("paddingLeft"), "1px", "Initial css set of paddingLeft works (hash)" );
123
+ equal( $elem.css("opacity"), "1", "Initial css set of opacity works (hash)" );
124
+
125
+ $elem.css({ width: "+=9" });
126
+ equal( $elem.css("width"), "10px", "'+=9' on width (hash)" );
127
+
128
+ $elem.css({ "width": "-=9" });
129
+ equal( $elem.css("width"), "1px", "'-=9' on width (hash)" );
130
+
131
+ $elem.css({ "width": "+=9px" });
132
+ equal( $elem.css("width"), "10px", "'+=9px' on width (hash)" );
133
+
134
+ $elem.css({ "width": "-=9px" });
135
+ equal( $elem.css("width"), "1px", "'-=9px' on width (hash)" );
136
+
137
+ $elem.css( "width", "+=9" );
138
+ equal( $elem.css("width"), "10px", "'+=9' on width (params)" );
139
+
140
+ $elem.css( "width", "-=9" ) ;
141
+ equal( $elem.css("width"), "1px", "'-=9' on width (params)" );
142
+
143
+ $elem.css( "width", "+=9px" );
144
+ equal( $elem.css("width"), "10px", "'+=9px' on width (params)" );
145
+
146
+ $elem.css( "width", "-=9px" );
147
+ equal( $elem.css("width"), "1px", "'-=9px' on width (params)" );
148
+
149
+ $elem.css( "width", "-=-9px" );
150
+ equal( $elem.css("width"), "10px", "'-=-9px' on width (params)" );
151
+
152
+ $elem.css( "width", "+=-9px" );
153
+ equal( $elem.css("width"), "1px", "'+=-9px' on width (params)" );
154
+
155
+ $elem.css({ "paddingLeft": "+=4" });
156
+ equal( $elem.css("paddingLeft"), "5px", "'+=4' on paddingLeft (hash)" );
157
+
158
+ $elem.css({ "paddingLeft": "-=4" });
159
+ equal( $elem.css("paddingLeft"), "1px", "'-=4' on paddingLeft (hash)" );
160
+
161
+ $elem.css({ "paddingLeft": "+=4px" });
162
+ equal( $elem.css("paddingLeft"), "5px", "'+=4px' on paddingLeft (hash)" );
163
+
164
+ $elem.css({ "paddingLeft": "-=4px" });
165
+ equal( $elem.css("paddingLeft"), "1px", "'-=4px' on paddingLeft (hash)" );
166
+
167
+ $elem.css({ "padding-left": "+=4" });
168
+ equal( $elem.css("paddingLeft"), "5px", "'+=4' on padding-left (hash)" );
169
+
170
+ $elem.css({ "padding-left": "-=4" });
171
+ equal( $elem.css("paddingLeft"), "1px", "'-=4' on padding-left (hash)" );
172
+
173
+ $elem.css({ "padding-left": "+=4px" });
174
+ equal( $elem.css("paddingLeft"), "5px", "'+=4px' on padding-left (hash)" );
175
+
176
+ $elem.css({ "padding-left": "-=4px" });
177
+ equal( $elem.css("paddingLeft"), "1px", "'-=4px' on padding-left (hash)" );
178
+
179
+ $elem.css( "paddingLeft", "+=4" );
180
+ equal( $elem.css("paddingLeft"), "5px", "'+=4' on paddingLeft (params)" );
181
+
182
+ $elem.css( "paddingLeft", "-=4" );
183
+ equal( $elem.css("paddingLeft"), "1px", "'-=4' on paddingLeft (params)" );
184
+
185
+ $elem.css( "padding-left", "+=4px" );
186
+ equal( $elem.css("paddingLeft"), "5px", "'+=4px' on padding-left (params)" );
187
+
188
+ $elem.css( "padding-left", "-=4px" );
189
+ equal( $elem.css("paddingLeft"), "1px", "'-=4px' on padding-left (params)" );
190
+
191
+ $elem.css({ "opacity": "-=0.5" });
192
+ equal( $elem.css("opacity"), "0.5", "'-=0.5' on opacity (hash)" );
193
+
194
+ $elem.css({ "opacity": "+=0.5" });
195
+ equal( $elem.css("opacity"), "1", "'+=0.5' on opacity (hash)" );
196
+
197
+ $elem.css( "opacity", "-=0.5" );
198
+ equal( $elem.css("opacity"), "0.5", "'-=0.5' on opacity (params)" );
199
+
200
+ $elem.css( "opacity", "+=0.5" );
201
+ equal( $elem.css("opacity"), "1", "'+=0.5' on opacity (params)" );
202
+
203
+ $elem.css( "order", 2 );
204
+ equal( $elem.css("order"), "2", "2 on order" );
205
+ });
206
+
207
+ test("css(String, Object)", function() {
208
+ expect( 19 );
209
+ var j, div, display, ret, success;
210
+
211
+ jQuery("#nothiddendiv").css("top", "-1em");
212
+ ok( jQuery("#nothiddendiv").css("top"), -16, "Check negative number in EMs." );
213
+
214
+ jQuery("#floatTest").css("float", "left");
215
+ equal( jQuery("#floatTest").css("float"), "left", "Modified CSS float using \"float\": Assert float is left");
216
+ jQuery("#floatTest").css("font-size", "20px");
217
+ equal( jQuery("#floatTest").css("font-size"), "20px", "Modified CSS font-size: Assert font-size is 20px");
218
+
219
+ jQuery.each("0,0.25,0.5,0.75,1".split(","), function(i, n) {
220
+ jQuery("#foo").css("opacity", n);
221
+ equal( jQuery("#foo").css("opacity"), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
222
+ jQuery("#foo").css("opacity", parseFloat(n));
223
+ equal( jQuery("#foo").css("opacity"), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
224
+ });
225
+ jQuery("#foo").css("opacity", "");
226
+ equal( jQuery("#foo").css("opacity"), "1", "Assert opacity is 1 when set to an empty String" );
227
+
228
+ // using contents will get comments regular, text, and comment nodes
229
+ j = jQuery("#nonnodes").contents();
230
+ j.css("overflow", "visible");
231
+ equal( j.css("overflow"), "visible", "Check node,textnode,comment css works" );
232
+ // opera sometimes doesn't update 'display' correctly, see #2037
233
+ jQuery("#t2037")[0].innerHTML = jQuery("#t2037")[0].innerHTML;
234
+ equal( jQuery("#t2037 .hidden").css("display"), "none", "Make sure browser thinks it is hidden" );
235
+
236
+ div = jQuery("#nothiddendiv");
237
+ display = div.css("display");
238
+ ret = div.css("display", undefined);
239
+
240
+ equal( ret, div, "Make sure setting undefined returns the original set." );
241
+ equal( div.css("display"), display, "Make sure that the display wasn't changed." );
242
+
243
+ // Test for Bug #5509
244
+ success = true;
245
+ try {
246
+ jQuery("#foo").css("backgroundColor", "rgba(0, 0, 0, 0.1)");
247
+ }
248
+ catch (e) {
249
+ success = false;
250
+ }
251
+ ok( success, "Setting RGBA values does not throw Error" );
252
+ });
253
+
254
+ test( "css(Array)", function() {
255
+ expect( 2 );
256
+
257
+ var expectedMany = {
258
+ "overflow": "visible",
259
+ "width": "16px"
260
+ },
261
+ expectedSingle = {
262
+ "width": "16px"
263
+ },
264
+ elem = jQuery("<div></div>").appendTo("#qunit-fixture");
265
+
266
+ deepEqual( elem.css( expectedMany ).css([ "overflow", "width" ]), expectedMany, "Getting multiple element array" );
267
+ deepEqual( elem.css( expectedSingle ).css([ "width" ]), expectedSingle, "Getting single element array" );
268
+ });
269
+
270
+ if ( !jQuery.support.opacity ) {
271
+ test("css(String, Object) for MSIE", function() {
272
+ expect( 5 );
273
+ // for #1438, IE throws JS error when filter exists but doesn't have opacity in it
274
+ jQuery("#foo").css("filter", "progid:DXImageTransform.Microsoft.Chroma(color='red');");
275
+ equal( jQuery("#foo").css("opacity"), "1", "Assert opacity is 1 when a different filter is set in IE, #1438" );
276
+
277
+ var filterVal = "progid:DXImageTransform.Microsoft.Alpha(opacity=30) progid:DXImageTransform.Microsoft.Blur(pixelradius=5)",
278
+ filterVal2 = "progid:DXImageTransform.Microsoft.alpha(opacity=100) progid:DXImageTransform.Microsoft.Blur(pixelradius=5)",
279
+ filterVal3 = "progid:DXImageTransform.Microsoft.Blur(pixelradius=5)";
280
+ jQuery("#foo").css("filter", filterVal);
281
+ equal( jQuery("#foo").css("filter"), filterVal, "css('filter', val) works" );
282
+ jQuery("#foo").css("opacity", 1);
283
+ equal( jQuery("#foo").css("filter"), filterVal2, "Setting opacity in IE doesn't duplicate opacity filter" );
284
+ equal( jQuery("#foo").css("opacity"), 1, "Setting opacity in IE with other filters works" );
285
+ jQuery("#foo").css("filter", filterVal3).css("opacity", 1);
286
+ ok( jQuery("#foo").css("filter").indexOf(filterVal3) !== -1, "Setting opacity in IE doesn't clobber other filters" );
287
+ });
288
+
289
+ test( "Setting opacity to 1 properly removes filter: style (#6652)", function() {
290
+ var rfilter = /filter:[^;]*/i,
291
+ test = jQuery( "#t6652" ).css( "opacity", 1 ),
292
+ test2 = test.find( "div" ).css( "opacity", 1 );
293
+
294
+ function hasFilter( elem ) {
295
+ var match = rfilter.exec( elem[0].style.cssText );
296
+ if ( match ) {
297
+ return true;
298
+ }
299
+ return false;
300
+ }
301
+ expect( 2 );
302
+ ok( !hasFilter( test ), "Removed filter attribute on element without filter in stylesheet" );
303
+ ok( hasFilter( test2 ), "Filter attribute remains on element that had filter in stylesheet" );
304
+ });
305
+ }
306
+
307
+ test("css(String, Function)", function() {
308
+ expect(3);
309
+
310
+ var index,
311
+ sizes = ["10px", "20px", "30px"];
312
+
313
+ jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
314
+ "<div class='cssFunction'></div>" +
315
+ "<div class='cssFunction'></div></div>")
316
+ .appendTo("body");
317
+
318
+ index = 0;
319
+
320
+ jQuery("#cssFunctionTest div").css("font-size", function() {
321
+ var size = sizes[index];
322
+ index++;
323
+ return size;
324
+ });
325
+
326
+ index = 0;
327
+
328
+ jQuery("#cssFunctionTest div").each(function() {
329
+ var computedSize = jQuery(this).css("font-size"),
330
+ expectedSize = sizes[index];
331
+ equal( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
332
+ index++;
333
+ });
334
+
335
+ jQuery("#cssFunctionTest").remove();
336
+ });
337
+
338
+ test("css(String, Function) with incoming value", function() {
339
+ expect(3);
340
+
341
+ var index,
342
+ sizes = ["10px", "20px", "30px"];
343
+
344
+ jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
345
+ "<div class='cssFunction'></div>" +
346
+ "<div class='cssFunction'></div></div>")
347
+ .appendTo("body");
348
+
349
+ index = 0;
350
+
351
+ jQuery("#cssFunctionTest div").css("font-size", function() {
352
+ var size = sizes[index];
353
+ index++;
354
+ return size;
355
+ });
356
+
357
+ index = 0;
358
+
359
+ jQuery("#cssFunctionTest div").css("font-size", function(i, computedSize) {
360
+ var expectedSize = sizes[index];
361
+ equal( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
362
+ index++;
363
+ return computedSize;
364
+ });
365
+
366
+ jQuery("#cssFunctionTest").remove();
367
+ });
368
+
369
+ test("css(Object) where values are Functions", function() {
370
+ expect(3);
371
+
372
+ var index,
373
+ sizes = ["10px", "20px", "30px"];
374
+
375
+ jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
376
+ "<div class='cssFunction'></div>" +
377
+ "<div class='cssFunction'></div></div>")
378
+ .appendTo("body");
379
+
380
+ index = 0;
381
+
382
+ jQuery("#cssFunctionTest div").css({"fontSize": function() {
383
+ var size = sizes[index];
384
+ index++;
385
+ return size;
386
+ }});
387
+
388
+ index = 0;
389
+
390
+ jQuery("#cssFunctionTest div").each(function() {
391
+ var computedSize = jQuery(this).css("font-size"),
392
+ expectedSize = sizes[index];
393
+ equal( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
394
+ index++;
395
+ });
396
+
397
+ jQuery("#cssFunctionTest").remove();
398
+ });
399
+
400
+ test("css(Object) where values are Functions with incoming values", function() {
401
+ expect(3);
402
+
403
+ var index,
404
+ sizes = ["10px", "20px", "30px"];
405
+
406
+ jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
407
+ "<div class='cssFunction'></div>" +
408
+ "<div class='cssFunction'></div></div>")
409
+ .appendTo("body");
410
+
411
+ index = 0;
412
+
413
+ jQuery("#cssFunctionTest div").css({"fontSize": function() {
414
+ var size = sizes[index];
415
+ index++;
416
+ return size;
417
+ }});
418
+
419
+ index = 0;
420
+
421
+ jQuery("#cssFunctionTest div").css({"font-size": function(i, computedSize) {
422
+ var expectedSize = sizes[index];
423
+ equal( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
424
+ index++;
425
+ return computedSize;
426
+ }});
427
+
428
+ jQuery("#cssFunctionTest").remove();
429
+ });
430
+
431
+ test("show(); hide()", function() {
432
+ expect(22);
433
+
434
+ var hiddendiv, div, pass, old, test;
435
+
436
+ hiddendiv = jQuery("div.hidden");
437
+ hiddendiv.hide();
438
+ equal( hiddendiv.css("display"), "none", "Non-detached div hidden" );
439
+ hiddendiv.show();
440
+ equal( hiddendiv.css("display"), "block", "Pre-hidden div shown" );
441
+
442
+ div = jQuery("<div>").hide();
443
+ equal( div.css("display"), "none", "Detached div hidden" );
444
+ div.appendTo("#qunit-fixture").show();
445
+ equal( div.css("display"), "block", "Pre-hidden div shown" );
446
+
447
+ QUnit.reset();
448
+
449
+ hiddendiv = jQuery("div.hidden");
450
+
451
+ equal(jQuery.css( hiddendiv[0], "display"), "none", "hiddendiv is display: none");
452
+
453
+ hiddendiv.css("display", "block");
454
+ equal(jQuery.css( hiddendiv[0], "display"), "block", "hiddendiv is display: block");
455
+
456
+ hiddendiv.show();
457
+ equal(jQuery.css( hiddendiv[0], "display"), "block", "hiddendiv is display: block");
458
+
459
+ hiddendiv.css("display","");
460
+
461
+ pass = true;
462
+ div = jQuery("#qunit-fixture div");
463
+ div.show().each(function(){
464
+ if ( this.style.display === "none" ) {
465
+ pass = false;
466
+ }
467
+ });
468
+ ok( pass, "Show" );
469
+
470
+ // #show-tests * is set display: none in CSS
471
+ jQuery("#qunit-fixture").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id='test-table'></table>");
472
+
473
+ old = jQuery("#test-table").show().css("display") !== "table";
474
+ jQuery("#test-table").remove();
475
+
476
+ test = {
477
+ "div" : "block",
478
+ "p" : "block",
479
+ "a" : "inline",
480
+ "code" : "inline",
481
+ "pre" : "block",
482
+ "span" : "inline",
483
+ "table" : old ? "block" : "table",
484
+ "thead" : old ? "block" : "table-header-group",
485
+ "tbody" : old ? "block" : "table-row-group",
486
+ "tr" : old ? "block" : "table-row",
487
+ "th" : old ? "block" : "table-cell",
488
+ "td" : old ? "block" : "table-cell",
489
+ "ul" : "block",
490
+ "li" : old ? "block" : "list-item"
491
+ };
492
+
493
+ jQuery.each(test, function(selector, expected) {
494
+ var elem = jQuery(selector, "#show-tests").show();
495
+ equal( elem.css("display"), expected, "Show using correct display type for " + selector );
496
+ });
497
+
498
+ // Make sure that showing or hiding a text node doesn't cause an error
499
+ jQuery("<div>test</div> text <span>test</span>").show().remove();
500
+ jQuery("<div>test</div> text <span>test</span>").hide().remove();
501
+ });
502
+
503
+ test("show() resolves correct default display #8099", function() {
504
+ expect(7);
505
+ var tt8099 = jQuery("<tt/>").appendTo("body"),
506
+ dfn8099 = jQuery("<dfn/>", { "html": "foo"}).appendTo("body");
507
+
508
+ equal( tt8099.css("display"), "none", "default display override for all tt" );
509
+ equal( tt8099.show().css("display"), "inline", "Correctly resolves display:inline" );
510
+
511
+ equal( jQuery("#foo").hide().show().css("display"), "block", "Correctly resolves display:block after hide/show" );
512
+
513
+ equal( tt8099.hide().css("display"), "none", "default display override for all tt" );
514
+ equal( tt8099.show().css("display"), "inline", "Correctly resolves display:inline" );
515
+
516
+ equal( dfn8099.css("display"), "none", "default display override for all dfn" );
517
+ equal( dfn8099.show().css("display"), "inline", "Correctly resolves display:inline" );
518
+
519
+ tt8099.remove();
520
+ dfn8099.remove();
521
+ });
522
+
523
+ test( "show() resolves correct default display for detached nodes", function(){
524
+ expect( 13 );
525
+
526
+ var div, span, tr, trDisplay;
527
+
528
+ div = jQuery("<div class='hidden'>");
529
+ div.show().appendTo("#qunit-fixture");
530
+ equal( div.css("display"), "block", "Make sure a detached, pre-hidden( through stylesheets ) div is visible." );
531
+
532
+ div = jQuery("<div style='display: none'>");
533
+ div.show().appendTo("#qunit-fixture");
534
+ equal( div.css("display"), "block", "Make sure a detached, pre-hidden( through inline style ) div is visible." );
535
+
536
+ span = jQuery("<span class='hidden'/>");
537
+ span.show().appendTo("#qunit-fixture");
538
+ equal( span.css("display"), "inline", "Make sure a detached, pre-hidden( through stylesheets ) span has default display." );
539
+
540
+ span = jQuery("<span style='display: inline'/>");
541
+ span.show().appendTo("#qunit-fixture");
542
+ equal( span.css("display"), "inline", "Make sure a detached, pre-hidden( through inline style ) span has default display." );
543
+
544
+ div = jQuery("<div><div class='hidden'></div></div>").children("div");
545
+ div.show().appendTo("#qunit-fixture");
546
+ equal( div.css("display"), "block", "Make sure a detached, pre-hidden( through stylesheets ) div inside another visible div is visible." );
547
+
548
+ div = jQuery("<div><div style='display: none'></div></div>").children("div");
549
+ div.show().appendTo("#qunit-fixture");
550
+ equal( div.css("display"), "block", "Make sure a detached, pre-hidden( through inline style ) div inside another visible div is visible." );
551
+
552
+ div = jQuery("div.hidden");
553
+ div.detach().show();
554
+ equal( div.css("display"), "block", "Make sure a detached( through detach() ), pre-hidden div is visible." );
555
+ div.remove();
556
+
557
+ span = jQuery("<span>");
558
+ span.appendTo("#qunit-fixture").detach().show().appendTo("#qunit-fixture" );
559
+ equal( span.css("display"), "inline", "Make sure a detached( through detach() ), pre-hidden span has default display." );
560
+ span.remove();
561
+
562
+ div = jQuery("<div>");
563
+ div.show().appendTo("#qunit-fixture");
564
+ ok( !!div.get( 0 ).style.display, "Make sure not hidden div has a inline style." );
565
+ div.remove();
566
+
567
+ div = jQuery( document.createElement("div") );
568
+ div.show().appendTo("#qunit-fixture");
569
+ equal( div.css("display"), "block", "Make sure a pre-created element has default display." );
570
+ div.remove();
571
+
572
+ div = jQuery("<div style='display: inline'/>");
573
+ div.show().appendTo("#qunit-fixture");
574
+ equal( div.css("display"), "inline", "Make sure that element has same display when it was created." );
575
+ div.remove();
576
+
577
+ tr = jQuery("<tr/>");
578
+ jQuery("#table").append( tr );
579
+ trDisplay = tr.css( "display" );
580
+ tr.detach().hide().show();
581
+
582
+ equal( tr[ 0 ].style.display, trDisplay, "For detached tr elements, display should always be like for attached trs" );
583
+ tr.remove();
584
+
585
+ span = jQuery("<span/>").hide().show();
586
+ equal( span[ 0 ].style.display, "inline", "For detached span elements, display should always be inline" );
587
+ span.remove();
588
+ });
589
+
590
+ test("show() resolves correct default display #10227", function() {
591
+ expect(2);
592
+
593
+ var body = jQuery("body");
594
+ body.append(
595
+ "<p id='ddisplay'>a<style>body{display:none}</style></p>"
596
+ );
597
+
598
+ equal( body.css("display"), "none", "Initial display: none" );
599
+
600
+ body.show();
601
+ equal( body.css("display"), "block", "Correct display: block" );
602
+
603
+ jQuery("#ddisplay").remove();
604
+ QUnit.expectJqData( body[0], "olddisplay" );
605
+ });
606
+
607
+ test("show() resolves correct default display when iframe display:none #12904", function() {
608
+ expect(2);
609
+
610
+ var ddisplay = jQuery(
611
+ "<p id='ddisplay'>a<style>p{display:none}iframe{display:none !important}</style></p>"
612
+ ).appendTo("body");
613
+
614
+ equal( ddisplay.css("display"), "none", "Initial display: none" );
615
+
616
+ ddisplay.show();
617
+ equal( ddisplay.css("display"), "block", "Correct display: block" );
618
+
619
+ ddisplay.remove();
620
+ });
621
+
622
+ test("toggle()", function() {
623
+ expect(9);
624
+ var div, oldHide,
625
+ x = jQuery("#foo");
626
+
627
+ ok( x.is(":visible"), "is visible" );
628
+ x.toggle();
629
+ ok( x.is(":hidden"), "is hidden" );
630
+ x.toggle();
631
+ ok( x.is(":visible"), "is visible again" );
632
+
633
+ x.toggle(true);
634
+ ok( x.is(":visible"), "is visible" );
635
+ x.toggle(false);
636
+ ok( x.is(":hidden"), "is hidden" );
637
+ x.toggle(true);
638
+ ok( x.is(":visible"), "is visible again" );
639
+
640
+ div = jQuery("<div style='display:none'><div></div></div>").appendTo("#qunit-fixture");
641
+ x = div.find("div");
642
+ strictEqual( x.toggle().css( "display" ), "none", "is hidden" );
643
+ strictEqual( x.toggle().css( "display" ), "block", "is visible" );
644
+
645
+ // Ensure hide() is called when toggled (#12148)
646
+ oldHide = jQuery.fn.hide;
647
+ jQuery.fn.hide = function() {
648
+ ok( true, name + " method called on toggle" );
649
+ return oldHide.apply( this, arguments );
650
+ };
651
+ x.toggle( name === "show" );
652
+ jQuery.fn.hide = oldHide;
653
+ });
654
+
655
+ test("hide hidden elements (bug #7141)", function() {
656
+ expect(3);
657
+ QUnit.reset();
658
+
659
+ var div = jQuery("<div style='display:none'></div>").appendTo("#qunit-fixture");
660
+ equal( div.css("display"), "none", "Element is hidden by default" );
661
+ div.hide();
662
+ ok( !jQuery._data(div, "olddisplay"), "olddisplay is undefined after hiding an already-hidden element" );
663
+ div.show();
664
+ equal( div.css("display"), "block", "Show a double-hidden element" );
665
+
666
+ div.remove();
667
+ });
668
+
669
+ test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function () {
670
+ expect(4);
671
+
672
+ var $checkedtest = jQuery("#checkedtest");
673
+ jQuery.css($checkedtest[0], "height");
674
+
675
+ ok( jQuery("input[type='radio']", $checkedtest).first().attr("checked"), "Check first radio still checked." );
676
+ ok( !jQuery("input[type='radio']", $checkedtest).last().attr("checked"), "Check last radio still NOT checked." );
677
+ ok( jQuery("input[type='checkbox']", $checkedtest).first().attr("checked"), "Check first checkbox still checked." );
678
+ ok( !jQuery("input[type='checkbox']", $checkedtest).last().attr("checked"), "Check last checkbox still NOT checked." );
679
+ });
680
+
681
+ test("internal ref to elem.runtimeStyle (bug #7608)", function () {
682
+ expect(1);
683
+ var result = true;
684
+
685
+ try {
686
+ jQuery("#foo").css( { "width": "0%" } ).css("width");
687
+ } catch (e) {
688
+ result = false;
689
+ }
690
+
691
+ ok( result, "elem.runtimeStyle does not throw exception" );
692
+ });
693
+
694
+ test("marginRight computed style (bug #3333)", function() {
695
+ expect(1);
696
+
697
+ var $div = jQuery("#foo");
698
+ $div.css({
699
+ "width": "1px",
700
+ "marginRight": 0
701
+ });
702
+
703
+ equal($div.css("marginRight"), "0px", "marginRight correctly calculated with a width and display block");
704
+ });
705
+
706
+ test("box model properties incorrectly returning % instead of px, see #10639 and #12088", function() {
707
+ expect( 2 );
708
+
709
+ var container = jQuery("<div/>").width( 400 ).appendTo("#qunit-fixture"),
710
+ el = jQuery("<div/>").css({ "width": "50%", "marginRight": "50%" }).appendTo( container ),
711
+ el2 = jQuery("<div/>").css({ "width": "50%", "minWidth": "300px", "marginLeft": "25%" }).appendTo( container );
712
+
713
+ equal( el.css("marginRight"), "200px", "css('marginRight') returning % instead of px, see #10639" );
714
+ equal( el2.css("marginLeft"), "100px", "css('marginLeft') returning incorrect pixel value, see #12088" );
715
+ });
716
+
717
+ test("jQuery.cssProps behavior, (bug #8402)", function() {
718
+ expect( 2 );
719
+
720
+ var div = jQuery( "<div>" ).appendTo(document.body).css({
721
+ "position": "absolute",
722
+ "top": 0,
723
+ "left": 10
724
+ });
725
+ jQuery.cssProps.top = "left";
726
+ equal( div.css("top"), "10px", "the fixed property is used when accessing the computed style");
727
+ div.css("top", "100px");
728
+ equal( div[0].style.left, "100px", "the fixed property is used when setting the style");
729
+ // cleanup jQuery.cssProps
730
+ jQuery.cssProps.top = undefined;
731
+ });
732
+
733
+ test("widows & orphans #8936", function () {
734
+
735
+ var $p = jQuery("<p>").appendTo("#qunit-fixture");
736
+
737
+ if ( "widows" in $p[0].style ) {
738
+ expect(4);
739
+ $p.css({
740
+ "widows": 0,
741
+ "orphans": 0
742
+ });
743
+
744
+ equal( $p.css("widows") || jQuery.style( $p[0], "widows" ), 0, "widows correctly start with value 0");
745
+ equal( $p.css("orphans") || jQuery.style( $p[0], "orphans" ), 0, "orphans correctly start with value 0");
746
+
747
+ $p.css({
748
+ "widows": 3,
749
+ "orphans": 3
750
+ });
751
+
752
+ equal( $p.css("widows") || jQuery.style( $p[0], "widows" ), 3, "widows correctly set to 3");
753
+ equal( $p.css("orphans") || jQuery.style( $p[0], "orphans" ), 3, "orphans correctly set to 3");
754
+ } else {
755
+
756
+ expect(1);
757
+ ok( true, "jQuery does not attempt to test for style props that definitely don't exist in older versions of IE");
758
+ }
759
+
760
+
761
+ $p.remove();
762
+ });
763
+
764
+ test("can't get css for disconnected in IE<9, see #10254 and #8388", function() {
765
+ expect( 2 );
766
+ var span, div;
767
+
768
+ span = jQuery( "<span/>" ).css( "background-image", "url(data/1x1.jpg)" );
769
+ notEqual( span.css( "background-image" ), null, "can't get background-image in IE<9, see #10254" );
770
+
771
+ div = jQuery( "<div/>" ).css( "top", 10 );
772
+ equal( div.css( "top" ), "10px", "can't get top in IE<9, see #8388" );
773
+ });
774
+
775
+ test("can't get background-position in IE<9, see #10796", function() {
776
+ var div = jQuery( "<div/>" ).appendTo( "#qunit-fixture" ),
777
+ units = [
778
+ "0 0",
779
+ "12px 12px",
780
+ "13px 12em",
781
+ "12em 13px",
782
+ "12em center",
783
+ "+12em center",
784
+ "12.2em center",
785
+ "center center"
786
+ ],
787
+ l = units.length,
788
+ i = 0;
789
+
790
+ expect( l );
791
+
792
+ for( ; i < l; i++ ) {
793
+ div.css( "background-position", units [ i ] );
794
+ ok( div.css( "background-position" ), "can't get background-position in IE<9, see #10796" );
795
+ }
796
+ });
797
+
798
+ test("percentage properties for bottom and right in IE<9 should not be incorrectly transformed to pixels, see #11311", function() {
799
+ expect( 1 );
800
+ var div = jQuery("<div style='position: absolute; width: 1px; height: 20px; bottom:50%;'></div>").appendTo( "#qunit-fixture" );
801
+ ok( window.getComputedStyle || div.css( "bottom" ) === "50%", "position properties get incorrectly transformed in IE<8, see #11311" );
802
+ });
803
+
804
+ if ( jQuery.fn.offset ) {
805
+ test("percentage properties for left and top should be transformed to pixels, see #9505", function() {
806
+ expect( 2 );
807
+ var parent = jQuery("<div style='position:relative;width:200px;height:200px;margin:0;padding:0;border-width:0'></div>").appendTo( "#qunit-fixture" ),
808
+ div = jQuery("<div style='position: absolute; width: 20px; height: 20px; top:50%; left:50%'></div>").appendTo( parent );
809
+
810
+ equal( div.css("top"), "100px", "position properties not transformed to pixels, see #9505" );
811
+ equal( div.css("left"), "100px", "position properties not transformed to pixels, see #9505" );
812
+ });
813
+ }
814
+
815
+ test("Do not append px (#9548, #12990)", function() {
816
+ expect( 2 );
817
+
818
+ var $div = jQuery("<div>").appendTo("#qunit-fixture");
819
+
820
+ $div.css( "fill-opacity", 1 );
821
+ equal( $div.css("fill-opacity"), 1, "Do not append px to 'fill-opacity'" );
822
+
823
+ $div.css( "column-count", 1 );
824
+ if ( $div.css("column-count") ) {
825
+ equal( $div.css("column-count"), 1, "Do not append px to 'column-count'" );
826
+ } else {
827
+ ok( true, "No support for column-count CSS property" );
828
+ }
829
+ });
830
+
831
+ test("css('width') and css('height') should respect box-sizing, see #11004", function() {
832
+ expect( 4 );
833
+
834
+ var el_dis = jQuery("<div style='width:300px;height:300px;margin:2px;padding:2px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;'>test</div>"),
835
+ el = el_dis.clone().appendTo("#qunit-fixture");
836
+
837
+ equal( el.css("width"), el.css("width", el.css("width")).css("width"), "css('width') is not respecting box-sizing, see #11004");
838
+ equal( el_dis.css("width"), el_dis.css("width", el_dis.css("width")).css("width"), "css('width') is not respecting box-sizing for disconnected element, see #11004");
839
+ equal( el.css("height"), el.css("height", el.css("height")).css("height"), "css('height') is not respecting box-sizing, see #11004");
840
+ equal( el_dis.css("height"), el_dis.css("height", el_dis.css("height")).css("height"), "css('height') is not respecting box-sizing for disconnected element, see #11004");
841
+ });
842
+
843
+ test("certain css values of 'normal' should be convertable to a number, see #8627", function() {
844
+ expect ( 2 );
845
+
846
+ var el = jQuery("<div style='letter-spacing:normal;font-weight:normal;'>test</div>").appendTo("#qunit-fixture");
847
+
848
+ ok( jQuery.isNumeric( parseFloat( el.css("letterSpacing") ) ), "css('letterSpacing') not convertable to number, see #8627" );
849
+ ok( jQuery.isNumeric( parseFloat( el.css("fontWeight") ) ), "css('fontWeight') not convertable to number, see #8627" );
850
+ });
851
+
852
+ // only run this test in IE9
853
+ if ( document.documentMode === 9 ) {
854
+ test( ".css('filter') returns a string in IE9, see #12537", 1, function() {
855
+ equal( jQuery("<div style='-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFFFFF, endColorstr=#ECECEC)\";'></div>").css("filter"), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFFFFF, endColorstr=#ECECEC)", "IE9 returns the correct value from css('filter')." );
856
+ });
857
+ }
858
+
859
+ test( "cssHooks - expand", function() {
860
+ expect( 15 );
861
+ var result,
862
+ properties = {
863
+ margin: [ "marginTop", "marginRight", "marginBottom", "marginLeft" ],
864
+ borderWidth: [ "borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
865
+ padding: [ "paddingTop", "paddingRight", "paddingBottom", "paddingLeft" ]
866
+ };
867
+
868
+ jQuery.each( properties, function( property, keys ) {
869
+ var hook = jQuery.cssHooks[ property ],
870
+ expected = {};
871
+ jQuery.each( keys, function( _, key ) {
872
+ expected[ key ] = 10;
873
+ });
874
+ result = hook.expand( 10 );
875
+ deepEqual( result, expected, property + " expands properly with a number" );
876
+
877
+ jQuery.each( keys, function( _, key ) {
878
+ expected[ key ] = "10px";
879
+ });
880
+ result = hook.expand( "10px" );
881
+ deepEqual( result, expected, property + " expands properly with '10px'" );
882
+
883
+ expected[ keys[1] ] = expected[ keys[3] ] = "20px";
884
+ result = hook.expand( "10px 20px" );
885
+ deepEqual( result, expected, property + " expands properly with '10px 20px'" );
886
+
887
+ expected[ keys[2] ] = "30px";
888
+ result = hook.expand( "10px 20px 30px" );
889
+ deepEqual( result, expected, property + " expands properly with '10px 20px 30px'" );
890
+
891
+ expected[ keys[3] ] = "40px";
892
+ result = hook.expand( "10px 20px 30px 40px" );
893
+ deepEqual( result, expected, property + " expands properly with '10px 20px 30px 40px'" );
894
+
895
+ });
896
+
897
+ });
898
+
899
+ test( "css opacity consistency across browsers (#12685)", function() {
900
+ expect( 4 );
901
+
902
+ var el,
903
+ fixture = jQuery("#qunit-fixture");
904
+
905
+ // Append style element
906
+ jQuery("<style>.opacityWithSpaces_t12685 { opacity: 0.1; filter: alpha(opacity = 10); } .opacityNoSpaces_t12685 { opacity: 0.2; filter: alpha(opacity=20); }</style>").appendTo( fixture );
907
+
908
+ el = jQuery("<div class='opacityWithSpaces_t12685'></div>").appendTo(fixture);
909
+
910
+ equal( Math.round( el.css("opacity") * 100 ), 10, "opacity from style sheet (filter:alpha with spaces)" );
911
+ el.removeClass("opacityWithSpaces_t12685").addClass("opacityNoSpaces_t12685");
912
+ equal( Math.round( el.css("opacity") * 100 ), 20, "opacity from style sheet (filter:alpha without spaces)" );
913
+ el.css( "opacity", 0.3 );
914
+ equal( Math.round( el.css("opacity") * 100 ), 30, "override opacity" );
915
+ el.css( "opacity", "" );
916
+ equal( Math.round( el.css("opacity") * 100 ), 20, "remove opacity override" );
917
+ });
918
+
919
+ test( ":visible/:hidden selectors", function() {
920
+ expect( 13 );
921
+
922
+ ok( jQuery("#nothiddendiv").is(":visible"), "Modifying CSS display: Assert element is visible" );
923
+ jQuery("#nothiddendiv").css({ display: "none" });
924
+ ok( !jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is hidden" );
925
+ jQuery("#nothiddendiv").css({"display": "block"});
926
+ ok( jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is visible");
927
+ ok( jQuery(window).is(":visible") || true, "Calling is(':visible') on window does not throw an exception (#10267)");
928
+ ok( jQuery(document).is(":visible") || true, "Calling is(':visible') on document does not throw an exception (#10267)");
929
+
930
+ ok( jQuery("#nothiddendiv").is(":visible"), "Modifying CSS display: Assert element is visible");
931
+ jQuery("#nothiddendiv").css("display", "none");
932
+ ok( !jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is hidden");
933
+ jQuery("#nothiddendiv").css("display", "block");
934
+ ok( jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is visible");
935
+
936
+ // ok( !jQuery("#siblingspan").is(":visible"), "Span with no content not visible (#13132)" );
937
+ // var $newDiv = jQuery("<div><span></span></div>").appendTo("#qunit-fixture");
938
+ // equal( $newDiv.find(":visible").length, 0, "Span with no content not visible (#13132)" );
939
+ // var $br = jQuery("<br/>").appendTo("#qunit-fixture");
940
+ // ok( !$br.is(":visible"), "br element not visible (#10406)");
941
+
942
+ var $table = jQuery("#table");
943
+ $table.html("<tr><td style='display:none'>cell</td><td>cell</td></tr>");
944
+ equal(jQuery("#table td:visible").length, 1, "hidden cell is not perceived as visible (#4512). Works on table elements");
945
+ $table.css("display", "none").html("<tr><td>cell</td><td>cell</td></tr>");
946
+ equal(jQuery("#table td:visible").length, 0, "hidden cell children not perceived as visible (#4512)");
947
+
948
+ t( "Is Visible", "#qunit-fixture div:visible:lt(2)", ["foo", "nothiddendiv"] );
949
+ t( "Is Not Hidden", "#qunit-fixture:hidden", [] );
950
+ t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] );
951
+ });
952
+
953
+ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Element's Style (#8908)", 24, function() {
954
+ var baseUrl = document.location.href.replace( /([^\/]*)$/, "" ),
955
+ styles = [{
956
+ name: "backgroundAttachment",
957
+ value: ["fixed"],
958
+ expected: [ "scroll" ]
959
+ },{
960
+ name: "backgroundColor",
961
+ value: [ "rgb(255, 0, 0)", "rgb(255,0,0)", "#ff0000" ],
962
+ expected: ["transparent"]
963
+ }, {
964
+ // Firefox returns auto's value
965
+ name: "backgroundImage",
966
+ value: [ "url('test.png')", "url(" + baseUrl + "test.png)", "url(\"" + baseUrl + "test.png\")" ],
967
+ expected: [ "none", "url(\"http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif\")" ]
968
+ }, {
969
+ name: "backgroundPosition",
970
+ value: ["5% 5%"],
971
+ expected: [ "0% 0%", "-1000px 0px", "-1000px 0%" ]
972
+ }, {
973
+ // Firefox returns no-repeat
974
+ name: "backgroundRepeat",
975
+ value: ["repeat-y"],
976
+ expected: [ "repeat", "no-repeat" ]
977
+ }, {
978
+ name: "backgroundClip",
979
+ value: ["padding-box"],
980
+ expected: ["border-box"]
981
+ }, {
982
+ name: "backgroundOrigin",
983
+ value: ["content-box"],
984
+ expected: ["padding-box"]
985
+ }, {
986
+ name: "backgroundSize",
987
+ value: ["80px 60px"],
988
+ expected: [ "auto auto" ]
989
+ }];
990
+
991
+ jQuery.each(styles, function( index, style ) {
992
+ var $clone, $clonedChildren,
993
+ $source = jQuery( "#firstp" ),
994
+ source = $source[ 0 ],
995
+ $children = $source.children();
996
+
997
+ style.expected = style.expected.concat( [ "", "auto" ] );
998
+
999
+ if ( source.style[ style.name ] === undefined ) {
1000
+ ok( true, style.name + ": style isn't supported and therefore not an issue" );
1001
+ ok( true );
1002
+ ok( true );
1003
+ return true;
1004
+ }
1005
+
1006
+ $source.css( style.name, style.value[ 0 ] );
1007
+ $children.css( style.name, style.value[ 0 ] );
1008
+
1009
+ $clone = $source.clone();
1010
+ $clonedChildren = $clone.children();
1011
+
1012
+ $clone.css( style.name, "" );
1013
+ $clonedChildren.css( style.name, "" );
1014
+
1015
+ window.setTimeout(function() {
1016
+ notEqual( $clone.css( style.name ), style.value[ 0 ], "Cloned css was changed" );
1017
+
1018
+ ok( jQuery.inArray( $source.css( style.name ) !== -1, style.value ),
1019
+ "Clearing clone.css() doesn't affect source.css(): " + style.name +
1020
+ "; result: " + $source.css( style.name ) +
1021
+ "; expected: " + style.value.join( "," ) );
1022
+
1023
+ ok( jQuery.inArray( $children.css( style.name ) !== -1, style.value ),
1024
+ "Clearing clonedChildren.css() doesn't affect children.css(): " + style.name +
1025
+ "; result: " + $children.css( style.name ) +
1026
+ "; expected: " + style.value.join( "," ) );
1027
+ }, 100 );
1028
+ });
1029
+
1030
+ window.setTimeout( start, 1000 );
1031
+ });
1032
+
1033
+ asyncTest( "Make sure initialized display value for disconnected nodes is correct (#13310)", 4, function() {
1034
+ var display = jQuery("#display").css("display"),
1035
+ div = jQuery("<div/>");
1036
+
1037
+ equal( div.css( "display", "inline" ).hide().show().appendTo("body").css( "display" ), "inline", "Initialized display value has returned" );
1038
+ div.remove();
1039
+
1040
+ div.css( "display", "none" ).hide();
1041
+ equal( jQuery._data( div[ 0 ], "olddisplay" ), undefined, "olddisplay is undefined after hiding a detached and hidden element" );
1042
+ div.remove();
1043
+
1044
+ div.css( "display", "inline-block" ).hide().appendTo("body").fadeIn(function() {
1045
+ equal( div.css( "display" ), "inline-block", "Initialized display value has returned" );
1046
+ div.remove();
1047
+
1048
+ start();
1049
+ });
1050
+
1051
+ equal( jQuery._data( jQuery("#display").css( "display", "inline" ).hide()[ 0 ], "olddisplay" ), display,
1052
+ "display: * !Important value should used as initialized display" );
1053
+ jQuery._removeData( jQuery("#display")[ 0 ] );
1054
+ });
1055
+
1056
+ }