compass-sass37 1.1.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 (562) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.markdown +1 -0
  3. data/Rakefile +237 -0
  4. data/VERSION +1 -0
  5. data/VERSION_NAME +1 -0
  6. data/bin/compass +45 -0
  7. data/features/command_line.feature +195 -0
  8. data/features/extensions.feature +27 -0
  9. data/features/step_definitions/command_line_steps.rb +268 -0
  10. data/features/step_definitions/extension_steps.rb +24 -0
  11. data/lib/compass/actions.rb +116 -0
  12. data/lib/compass/app_integration/stand_alone/configuration_defaults.rb +32 -0
  13. data/lib/compass/app_integration/stand_alone/installer.rb +83 -0
  14. data/lib/compass/app_integration/stand_alone.rb +22 -0
  15. data/lib/compass/app_integration.rb +39 -0
  16. data/lib/compass/commands/base.rb +44 -0
  17. data/lib/compass/commands/clean_project.rb +79 -0
  18. data/lib/compass/commands/create_project.rb +131 -0
  19. data/lib/compass/commands/default.rb +50 -0
  20. data/lib/compass/commands/extension_command.rb +60 -0
  21. data/lib/compass/commands/help.rb +85 -0
  22. data/lib/compass/commands/imports.rb +35 -0
  23. data/lib/compass/commands/installer_command.rb +32 -0
  24. data/lib/compass/commands/interactive.rb +61 -0
  25. data/lib/compass/commands/list_frameworks.rb +39 -0
  26. data/lib/compass/commands/print_version.rb +88 -0
  27. data/lib/compass/commands/project_base.rb +103 -0
  28. data/lib/compass/commands/project_stats.rb +178 -0
  29. data/lib/compass/commands/project_structure.rb +93 -0
  30. data/lib/compass/commands/registry.rb +40 -0
  31. data/lib/compass/commands/sprite.rb +89 -0
  32. data/lib/compass/commands/stamp_pattern.rb +90 -0
  33. data/lib/compass/commands/unpack_extension.rb +120 -0
  34. data/lib/compass/commands/update_project.rb +148 -0
  35. data/lib/compass/commands/validate_project.rb +77 -0
  36. data/lib/compass/commands/watch_project.rb +117 -0
  37. data/lib/compass/commands/write_configuration.rb +125 -0
  38. data/lib/compass/commands.rb +14 -0
  39. data/lib/compass/compiler.rb +249 -0
  40. data/lib/compass/configuration/comments.rb +62 -0
  41. data/lib/compass/configuration/file_data.rb +21 -0
  42. data/lib/compass/configuration/helpers.rb +113 -0
  43. data/lib/compass/configuration/serialization.rb +95 -0
  44. data/lib/compass/dependencies.rb +12 -0
  45. data/lib/compass/deprecation.rb +19 -0
  46. data/lib/compass/errors.rb +9 -0
  47. data/lib/compass/exec/command_option_parser.rb +23 -0
  48. data/lib/compass/exec/global_options_parser.rb +59 -0
  49. data/lib/compass/exec/helpers.rb +21 -0
  50. data/lib/compass/exec/project_options_parser.rb +74 -0
  51. data/lib/compass/exec/sub_command_ui.rb +51 -0
  52. data/lib/compass/exec.rb +23 -0
  53. data/lib/compass/generated_version.rb +4 -0
  54. data/lib/compass/installers/bare_installer.rb +58 -0
  55. data/lib/compass/installers/base.rb +187 -0
  56. data/lib/compass/installers/manifest.rb +161 -0
  57. data/lib/compass/installers/manifest_installer.rb +61 -0
  58. data/lib/compass/installers/template_context.rb +44 -0
  59. data/lib/compass/installers.rb +3 -0
  60. data/lib/compass/logger.rb +140 -0
  61. data/lib/compass/quick_cache.rb +15 -0
  62. data/lib/compass/rails.rb +2 -0
  63. data/lib/compass/sass_compiler.rb +152 -0
  64. data/lib/compass/sass_extensions/functions/sprites.rb +305 -0
  65. data/lib/compass/sass_extensions/functions.rb +15 -0
  66. data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb +35 -0
  67. data/lib/compass/sass_extensions/sprites/engines.rb +25 -0
  68. data/lib/compass/sass_extensions/sprites/image.rb +162 -0
  69. data/lib/compass/sass_extensions/sprites/image_methods.rb +52 -0
  70. data/lib/compass/sass_extensions/sprites/image_row.rb +47 -0
  71. data/lib/compass/sass_extensions/sprites/images.rb +29 -0
  72. data/lib/compass/sass_extensions/sprites/layout/diagonal.rb +42 -0
  73. data/lib/compass/sass_extensions/sprites/layout/horizontal.rb +66 -0
  74. data/lib/compass/sass_extensions/sprites/layout/smart.rb +33 -0
  75. data/lib/compass/sass_extensions/sprites/layout/vertical.rb +68 -0
  76. data/lib/compass/sass_extensions/sprites/layout.rb +39 -0
  77. data/lib/compass/sass_extensions/sprites/layout_methods.rb +53 -0
  78. data/lib/compass/sass_extensions/sprites/row_fitter.rb +92 -0
  79. data/lib/compass/sass_extensions/sprites/sprite_map.rb +93 -0
  80. data/lib/compass/sass_extensions/sprites/sprite_methods.rb +136 -0
  81. data/lib/compass/sass_extensions/sprites.rb +21 -0
  82. data/lib/compass/sass_extensions.rb +9 -0
  83. data/lib/compass/sprite_importer/binding.rb +11 -0
  84. data/lib/compass/sprite_importer/content.erb +87 -0
  85. data/lib/compass/sprite_importer.rb +117 -0
  86. data/lib/compass/stats.rb +99 -0
  87. data/lib/compass/test_case.rb +38 -0
  88. data/lib/compass/validator.rb +16 -0
  89. data/lib/compass/version.rb +42 -0
  90. data/lib/compass.rb +39 -0
  91. data/test/fixtures/extensions/only_stylesheets/compass_init.rb +1 -0
  92. data/test/fixtures/extensions/only_stylesheets/scss/only_stylesheets/foo.scss +3 -0
  93. data/test/fixtures/fonts/bgrove.base64.txt +1 -0
  94. data/test/fixtures/fonts/bgrove.ttf +0 -0
  95. data/test/fixtures/sprites/public/images/bad_extensions/ten-by-ten.gif +0 -0
  96. data/test/fixtures/sprites/public/images/bad_extensions/twenty-by-twenty.jpg +0 -0
  97. data/test/fixtures/sprites/public/images/bool/false.png +0 -0
  98. data/test/fixtures/sprites/public/images/bool/true.png +0 -0
  99. data/test/fixtures/sprites/public/images/colors/blue.png +0 -0
  100. data/test/fixtures/sprites/public/images/colors/yellow.png +0 -0
  101. data/test/fixtures/sprites/public/images/focus/ten-by-ten.png +0 -0
  102. data/test/fixtures/sprites/public/images/focus/ten-by-ten_active.png +0 -0
  103. data/test/fixtures/sprites/public/images/focus/ten-by-ten_focus.png +0 -0
  104. data/test/fixtures/sprites/public/images/focus/ten-by-ten_hover.png +0 -0
  105. data/test/fixtures/sprites/public/images/focus/ten-by-ten_target.png +0 -0
  106. data/test/fixtures/sprites/public/images/image_row/large.png +0 -0
  107. data/test/fixtures/sprites/public/images/image_row/large_square.png +0 -0
  108. data/test/fixtures/sprites/public/images/image_row/medium.png +0 -0
  109. data/test/fixtures/sprites/public/images/image_row/small.png +0 -0
  110. data/test/fixtures/sprites/public/images/image_row/tall.png +0 -0
  111. data/test/fixtures/sprites/public/images/ko/default_background.png +0 -0
  112. data/test/fixtures/sprites/public/images/ko/starbg26x27.png +0 -0
  113. data/test/fixtures/sprites/public/images/nested/squares/ten-by-ten.png +0 -0
  114. data/test/fixtures/sprites/public/images/numeric/200.png +0 -0
  115. data/test/fixtures/sprites/public/images/prefix/20-by-20.png +0 -0
  116. data/test/fixtures/sprites/public/images/prefix/ten-by-ten.png +0 -0
  117. data/test/fixtures/sprites/public/images/repeat_x/five.png +0 -0
  118. data/test/fixtures/sprites/public/images/repeat_x/four.png +0 -0
  119. data/test/fixtures/sprites/public/images/repeat_x/one.png +0 -0
  120. data/test/fixtures/sprites/public/images/repeat_x/three.png +0 -0
  121. data/test/fixtures/sprites/public/images/repeat_x/two.png +0 -0
  122. data/test/fixtures/sprites/public/images/selectors/ten-by-ten.png +0 -0
  123. data/test/fixtures/sprites/public/images/selectors/ten-by-ten_active.png +0 -0
  124. data/test/fixtures/sprites/public/images/selectors/ten-by-ten_hover.png +0 -0
  125. data/test/fixtures/sprites/public/images/selectors/ten-by-ten_target.png +0 -0
  126. data/test/fixtures/sprites/public/images/squares/ten-by-ten.png +0 -0
  127. data/test/fixtures/sprites/public/images/squares/twenty-by-twenty.png +0 -0
  128. data/test/fixtures/stylesheets/busted_font_urls/config.rb +32 -0
  129. data/test/fixtures/stylesheets/busted_font_urls/css/screen.css +9 -0
  130. data/test/fixtures/stylesheets/busted_font_urls/fonts/feed.ttf +0 -0
  131. data/test/fixtures/stylesheets/busted_font_urls/fonts/grid.ttf +0 -0
  132. data/test/fixtures/stylesheets/busted_font_urls/fonts/sub/dk.ttf +0 -0
  133. data/test/fixtures/stylesheets/busted_font_urls/sass/screen.sass +14 -0
  134. data/test/fixtures/stylesheets/busted_image_urls/config.rb +29 -0
  135. data/test/fixtures/stylesheets/busted_image_urls/css/screen.css +9 -0
  136. data/test/fixtures/stylesheets/busted_image_urls/images/feed.png +0 -0
  137. data/test/fixtures/stylesheets/busted_image_urls/images/flags/dk.png +0 -0
  138. data/test/fixtures/stylesheets/busted_image_urls/images/grid.png +0 -0
  139. data/test/fixtures/stylesheets/busted_image_urls/sass/screen.sass +14 -0
  140. data/test/fixtures/stylesheets/compass/100x150.jpg +0 -0
  141. data/test/fixtures/stylesheets/compass/config.rb +18 -0
  142. data/test/fixtures/stylesheets/compass/css/animation-with-legacy-ie.css +22 -0
  143. data/test/fixtures/stylesheets/compass/css/animation.css +22 -0
  144. data/test/fixtures/stylesheets/compass/css/appearance.css +3 -0
  145. data/test/fixtures/stylesheets/compass/css/background-clip.css +11 -0
  146. data/test/fixtures/stylesheets/compass/css/background-origin.css +11 -0
  147. data/test/fixtures/stylesheets/compass/css/background-size.css +17 -0
  148. data/test/fixtures/stylesheets/compass/css/border_radius.css +14 -0
  149. data/test/fixtures/stylesheets/compass/css/box-sizing.css +14 -0
  150. data/test/fixtures/stylesheets/compass/css/box.css +103 -0
  151. data/test/fixtures/stylesheets/compass/css/box_shadow.css +24 -0
  152. data/test/fixtures/stylesheets/compass/css/brightness.css +14 -0
  153. data/test/fixtures/stylesheets/compass/css/browser-support.css +335 -0
  154. data/test/fixtures/stylesheets/compass/css/color.css +18 -0
  155. data/test/fixtures/stylesheets/compass/css/columns.css +134 -0
  156. data/test/fixtures/stylesheets/compass/css/filters.css +53 -0
  157. data/test/fixtures/stylesheets/compass/css/flexbox.css +94 -0
  158. data/test/fixtures/stylesheets/compass/css/fonts.css +8 -0
  159. data/test/fixtures/stylesheets/compass/css/force-wrap.css +9 -0
  160. data/test/fixtures/stylesheets/compass/css/gradients.css +222 -0
  161. data/test/fixtures/stylesheets/compass/css/grid_background.css +79 -0
  162. data/test/fixtures/stylesheets/compass/css/hyphenation.css +16 -0
  163. data/test/fixtures/stylesheets/compass/css/image_size.css +15 -0
  164. data/test/fixtures/stylesheets/compass/css/images.css +8 -0
  165. data/test/fixtures/stylesheets/compass/css/layout.css +16 -0
  166. data/test/fixtures/stylesheets/compass/css/legacy_clearfix.css +26 -0
  167. data/test/fixtures/stylesheets/compass/css/lists.css +145 -0
  168. data/test/fixtures/stylesheets/compass/css/opacity.css +7 -0
  169. data/test/fixtures/stylesheets/compass/css/print.css +11 -0
  170. data/test/fixtures/stylesheets/compass/css/regions.css +9 -0
  171. data/test/fixtures/stylesheets/compass/css/replacement.css +66 -0
  172. data/test/fixtures/stylesheets/compass/css/reset.css +59 -0
  173. data/test/fixtures/stylesheets/compass/css/selection.css +50 -0
  174. data/test/fixtures/stylesheets/compass/css/sprites_with_explicit_separator.css +19 -0
  175. data/test/fixtures/stylesheets/compass/css/stretching.css +66 -0
  176. data/test/fixtures/stylesheets/compass/css/support.css +116 -0
  177. data/test/fixtures/stylesheets/compass/css/text_shadow.css +29 -0
  178. data/test/fixtures/stylesheets/compass/css/transform.css +341 -0
  179. data/test/fixtures/stylesheets/compass/css/transition.css +116 -0
  180. data/test/fixtures/stylesheets/compass/css/typography/links/hover-link.css +4 -0
  181. data/test/fixtures/stylesheets/compass/css/units.css +34 -0
  182. data/test/fixtures/stylesheets/compass/css/user-interface.css +52 -0
  183. data/test/fixtures/stylesheets/compass/css/utilities.css +71 -0
  184. data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +42 -0
  185. data/test/fixtures/stylesheets/compass/css/vertical_rhythm_with_ems.css +53 -0
  186. data/test/fixtures/stylesheets/compass/css/vertical_rhythm_with_px.css +52 -0
  187. data/test/fixtures/stylesheets/compass/css/vertical_rhythm_with_rems.css +67 -0
  188. data/test/fixtures/stylesheets/compass/images/100x150.gif +0 -0
  189. data/test/fixtures/stylesheets/compass/images/100x150.jpeg +0 -0
  190. data/test/fixtures/stylesheets/compass/images/100x150.jpg +0 -0
  191. data/test/fixtures/stylesheets/compass/images/100x150.png +0 -0
  192. data/test/fixtures/stylesheets/compass/images/4x6.png +0 -0
  193. data/test/fixtures/stylesheets/compass/images/flag/ad.png +0 -0
  194. data/test/fixtures/stylesheets/compass/images/flag/ae.png +0 -0
  195. data/test/fixtures/stylesheets/compass/images/flag/af.png +0 -0
  196. data/test/fixtures/stylesheets/compass/images/flag/ag.png +0 -0
  197. data/test/fixtures/stylesheets/compass/images/flag/ai.png +0 -0
  198. data/test/fixtures/stylesheets/compass/images/flag/al.png +0 -0
  199. data/test/fixtures/stylesheets/compass/images/flag/am.png +0 -0
  200. data/test/fixtures/stylesheets/compass/images/flag/an.png +0 -0
  201. data/test/fixtures/stylesheets/compass/images/flag/ao.png +0 -0
  202. data/test/fixtures/stylesheets/compass/images/flag/ar.png +0 -0
  203. data/test/fixtures/stylesheets/compass/images/flag/as.png +0 -0
  204. data/test/fixtures/stylesheets/compass/images/flag/at.png +0 -0
  205. data/test/fixtures/stylesheets/compass/images/flag/au.png +0 -0
  206. data/test/fixtures/stylesheets/compass/images/flag/aw.png +0 -0
  207. data/test/fixtures/stylesheets/compass/images/flag/ax.png +0 -0
  208. data/test/fixtures/stylesheets/compass/images/flag/az.png +0 -0
  209. data/test/fixtures/stylesheets/compass/images/flag/ba.png +0 -0
  210. data/test/fixtures/stylesheets/compass/images/flag/bb.png +0 -0
  211. data/test/fixtures/stylesheets/compass/images/flag/bd.png +0 -0
  212. data/test/fixtures/stylesheets/compass/images/flag/be.png +0 -0
  213. data/test/fixtures/stylesheets/compass/images/flag/bf.png +0 -0
  214. data/test/fixtures/stylesheets/compass/images/flag/bg.png +0 -0
  215. data/test/fixtures/stylesheets/compass/images/flag/bh.png +0 -0
  216. data/test/fixtures/stylesheets/compass/images/flag/bi.png +0 -0
  217. data/test/fixtures/stylesheets/compass/images/flag/bj.png +0 -0
  218. data/test/fixtures/stylesheets/compass/images/flag/bm.png +0 -0
  219. data/test/fixtures/stylesheets/compass/images/flag/bn.png +0 -0
  220. data/test/fixtures/stylesheets/compass/images/flag/bo.png +0 -0
  221. data/test/fixtures/stylesheets/compass/images/flag/br.png +0 -0
  222. data/test/fixtures/stylesheets/compass/images/flag/bs.png +0 -0
  223. data/test/fixtures/stylesheets/compass/images/flag/bt.png +0 -0
  224. data/test/fixtures/stylesheets/compass/images/flag/bv.png +0 -0
  225. data/test/fixtures/stylesheets/compass/images/flag/bw.png +0 -0
  226. data/test/fixtures/stylesheets/compass/images/flag/by.png +0 -0
  227. data/test/fixtures/stylesheets/compass/images/flag/bz.png +0 -0
  228. data/test/fixtures/stylesheets/compass/images/flag/ca.png +0 -0
  229. data/test/fixtures/stylesheets/compass/images/flag/catalonia.png +0 -0
  230. data/test/fixtures/stylesheets/compass/images/flag/cc.png +0 -0
  231. data/test/fixtures/stylesheets/compass/images/flag/cd.png +0 -0
  232. data/test/fixtures/stylesheets/compass/images/flag/cf.png +0 -0
  233. data/test/fixtures/stylesheets/compass/images/flag/cg.png +0 -0
  234. data/test/fixtures/stylesheets/compass/images/flag/ch.png +0 -0
  235. data/test/fixtures/stylesheets/compass/images/flag/ci.png +0 -0
  236. data/test/fixtures/stylesheets/compass/images/flag/ck.png +0 -0
  237. data/test/fixtures/stylesheets/compass/images/flag/cl.png +0 -0
  238. data/test/fixtures/stylesheets/compass/images/flag/cm.png +0 -0
  239. data/test/fixtures/stylesheets/compass/images/flag/cn.png +0 -0
  240. data/test/fixtures/stylesheets/compass/images/flag/co.png +0 -0
  241. data/test/fixtures/stylesheets/compass/images/flag/cr.png +0 -0
  242. data/test/fixtures/stylesheets/compass/images/flag/cs.png +0 -0
  243. data/test/fixtures/stylesheets/compass/images/flag/cu.png +0 -0
  244. data/test/fixtures/stylesheets/compass/images/flag/cv.png +0 -0
  245. data/test/fixtures/stylesheets/compass/images/flag/cx.png +0 -0
  246. data/test/fixtures/stylesheets/compass/images/flag/cy.png +0 -0
  247. data/test/fixtures/stylesheets/compass/images/flag/cz.png +0 -0
  248. data/test/fixtures/stylesheets/compass/images/flag/de.png +0 -0
  249. data/test/fixtures/stylesheets/compass/images/flag/dj.png +0 -0
  250. data/test/fixtures/stylesheets/compass/images/flag/dk.png +0 -0
  251. data/test/fixtures/stylesheets/compass/images/flag/dm.png +0 -0
  252. data/test/fixtures/stylesheets/compass/images/flag/do.png +0 -0
  253. data/test/fixtures/stylesheets/compass/images/flag/dz.png +0 -0
  254. data/test/fixtures/stylesheets/compass/images/flag/ec.png +0 -0
  255. data/test/fixtures/stylesheets/compass/images/flag/ee.png +0 -0
  256. data/test/fixtures/stylesheets/compass/images/flag/eg.png +0 -0
  257. data/test/fixtures/stylesheets/compass/images/flag/eh.png +0 -0
  258. data/test/fixtures/stylesheets/compass/images/flag/england.png +0 -0
  259. data/test/fixtures/stylesheets/compass/images/flag/er.png +0 -0
  260. data/test/fixtures/stylesheets/compass/images/flag/es.png +0 -0
  261. data/test/fixtures/stylesheets/compass/images/flag/et.png +0 -0
  262. data/test/fixtures/stylesheets/compass/images/flag/europeanunion.png +0 -0
  263. data/test/fixtures/stylesheets/compass/images/flag/fam.png +0 -0
  264. data/test/fixtures/stylesheets/compass/images/flag/fi.png +0 -0
  265. data/test/fixtures/stylesheets/compass/images/flag/fj.png +0 -0
  266. data/test/fixtures/stylesheets/compass/images/flag/fk.png +0 -0
  267. data/test/fixtures/stylesheets/compass/images/flag/fm.png +0 -0
  268. data/test/fixtures/stylesheets/compass/images/flag/fo.png +0 -0
  269. data/test/fixtures/stylesheets/compass/images/flag/fr.png +0 -0
  270. data/test/fixtures/stylesheets/compass/images/flag/ga.png +0 -0
  271. data/test/fixtures/stylesheets/compass/images/flag/gb.png +0 -0
  272. data/test/fixtures/stylesheets/compass/images/flag/gd.png +0 -0
  273. data/test/fixtures/stylesheets/compass/images/flag/ge.png +0 -0
  274. data/test/fixtures/stylesheets/compass/images/flag/gf.png +0 -0
  275. data/test/fixtures/stylesheets/compass/images/flag/gh.png +0 -0
  276. data/test/fixtures/stylesheets/compass/images/flag/gi.png +0 -0
  277. data/test/fixtures/stylesheets/compass/images/flag/gl.png +0 -0
  278. data/test/fixtures/stylesheets/compass/images/flag/gm.png +0 -0
  279. data/test/fixtures/stylesheets/compass/images/flag/gn.png +0 -0
  280. data/test/fixtures/stylesheets/compass/images/flag/gp.png +0 -0
  281. data/test/fixtures/stylesheets/compass/images/flag/gq.png +0 -0
  282. data/test/fixtures/stylesheets/compass/images/flag/gr.png +0 -0
  283. data/test/fixtures/stylesheets/compass/images/flag/gs.png +0 -0
  284. data/test/fixtures/stylesheets/compass/images/flag/gt.png +0 -0
  285. data/test/fixtures/stylesheets/compass/images/flag/gu.png +0 -0
  286. data/test/fixtures/stylesheets/compass/images/flag/gw.png +0 -0
  287. data/test/fixtures/stylesheets/compass/images/flag/gy.png +0 -0
  288. data/test/fixtures/stylesheets/compass/images/flag/hk.png +0 -0
  289. data/test/fixtures/stylesheets/compass/images/flag/hm.png +0 -0
  290. data/test/fixtures/stylesheets/compass/images/flag/hn.png +0 -0
  291. data/test/fixtures/stylesheets/compass/images/flag/hr.png +0 -0
  292. data/test/fixtures/stylesheets/compass/images/flag/ht.png +0 -0
  293. data/test/fixtures/stylesheets/compass/images/flag/hu.png +0 -0
  294. data/test/fixtures/stylesheets/compass/images/flag/id-2.png +0 -0
  295. data/test/fixtures/stylesheets/compass/images/flag/ie.png +0 -0
  296. data/test/fixtures/stylesheets/compass/images/flag/il.png +0 -0
  297. data/test/fixtures/stylesheets/compass/images/flag/in.png +0 -0
  298. data/test/fixtures/stylesheets/compass/images/flag/io.png +0 -0
  299. data/test/fixtures/stylesheets/compass/images/flag/iq.png +0 -0
  300. data/test/fixtures/stylesheets/compass/images/flag/ir.png +0 -0
  301. data/test/fixtures/stylesheets/compass/images/flag/is.png +0 -0
  302. data/test/fixtures/stylesheets/compass/images/flag/it.png +0 -0
  303. data/test/fixtures/stylesheets/compass/images/flag/jm.png +0 -0
  304. data/test/fixtures/stylesheets/compass/images/flag/jo.png +0 -0
  305. data/test/fixtures/stylesheets/compass/images/flag/jp.png +0 -0
  306. data/test/fixtures/stylesheets/compass/images/flag/ke.png +0 -0
  307. data/test/fixtures/stylesheets/compass/images/flag/kg.png +0 -0
  308. data/test/fixtures/stylesheets/compass/images/flag/kh.png +0 -0
  309. data/test/fixtures/stylesheets/compass/images/flag/ki.png +0 -0
  310. data/test/fixtures/stylesheets/compass/images/flag/km.png +0 -0
  311. data/test/fixtures/stylesheets/compass/images/flag/kn.png +0 -0
  312. data/test/fixtures/stylesheets/compass/images/flag/kp.png +0 -0
  313. data/test/fixtures/stylesheets/compass/images/flag/kr.png +0 -0
  314. data/test/fixtures/stylesheets/compass/images/flag/kw.png +0 -0
  315. data/test/fixtures/stylesheets/compass/images/flag/ky.png +0 -0
  316. data/test/fixtures/stylesheets/compass/images/flag/kz.png +0 -0
  317. data/test/fixtures/stylesheets/compass/images/flag/la.png +0 -0
  318. data/test/fixtures/stylesheets/compass/images/flag/lb.png +0 -0
  319. data/test/fixtures/stylesheets/compass/images/flag/lc.png +0 -0
  320. data/test/fixtures/stylesheets/compass/images/flag/li.png +0 -0
  321. data/test/fixtures/stylesheets/compass/images/flag/lk.png +0 -0
  322. data/test/fixtures/stylesheets/compass/images/flag/lr.png +0 -0
  323. data/test/fixtures/stylesheets/compass/images/flag/ls.png +0 -0
  324. data/test/fixtures/stylesheets/compass/images/flag/lt.png +0 -0
  325. data/test/fixtures/stylesheets/compass/images/flag/lu.png +0 -0
  326. data/test/fixtures/stylesheets/compass/images/flag/lv.png +0 -0
  327. data/test/fixtures/stylesheets/compass/images/flag/ly.png +0 -0
  328. data/test/fixtures/stylesheets/compass/images/flag/ma.png +0 -0
  329. data/test/fixtures/stylesheets/compass/images/flag/mc.png +0 -0
  330. data/test/fixtures/stylesheets/compass/images/flag/md.png +0 -0
  331. data/test/fixtures/stylesheets/compass/images/flag/me.png +0 -0
  332. data/test/fixtures/stylesheets/compass/images/flag/mg.png +0 -0
  333. data/test/fixtures/stylesheets/compass/images/flag/mh.png +0 -0
  334. data/test/fixtures/stylesheets/compass/images/flag/mk.png +0 -0
  335. data/test/fixtures/stylesheets/compass/images/flag/ml.png +0 -0
  336. data/test/fixtures/stylesheets/compass/images/flag/mm.png +0 -0
  337. data/test/fixtures/stylesheets/compass/images/flag/mn.png +0 -0
  338. data/test/fixtures/stylesheets/compass/images/flag/mo.png +0 -0
  339. data/test/fixtures/stylesheets/compass/images/flag/mp.png +0 -0
  340. data/test/fixtures/stylesheets/compass/images/flag/mq.png +0 -0
  341. data/test/fixtures/stylesheets/compass/images/flag/mr.png +0 -0
  342. data/test/fixtures/stylesheets/compass/images/flag/ms.png +0 -0
  343. data/test/fixtures/stylesheets/compass/images/flag/mt.png +0 -0
  344. data/test/fixtures/stylesheets/compass/images/flag/mu.png +0 -0
  345. data/test/fixtures/stylesheets/compass/images/flag/mv.png +0 -0
  346. data/test/fixtures/stylesheets/compass/images/flag/mw.png +0 -0
  347. data/test/fixtures/stylesheets/compass/images/flag/mx.png +0 -0
  348. data/test/fixtures/stylesheets/compass/images/flag/my.png +0 -0
  349. data/test/fixtures/stylesheets/compass/images/flag/mz.png +0 -0
  350. data/test/fixtures/stylesheets/compass/images/flag/na.png +0 -0
  351. data/test/fixtures/stylesheets/compass/images/flag/nc.png +0 -0
  352. data/test/fixtures/stylesheets/compass/images/flag/ne.png +0 -0
  353. data/test/fixtures/stylesheets/compass/images/flag/nf.png +0 -0
  354. data/test/fixtures/stylesheets/compass/images/flag/ng.png +0 -0
  355. data/test/fixtures/stylesheets/compass/images/flag/ni.png +0 -0
  356. data/test/fixtures/stylesheets/compass/images/flag/nl.png +0 -0
  357. data/test/fixtures/stylesheets/compass/images/flag/no.png +0 -0
  358. data/test/fixtures/stylesheets/compass/images/flag/np.png +0 -0
  359. data/test/fixtures/stylesheets/compass/images/flag/nr.png +0 -0
  360. data/test/fixtures/stylesheets/compass/images/flag/nu.png +0 -0
  361. data/test/fixtures/stylesheets/compass/images/flag/nz.png +0 -0
  362. data/test/fixtures/stylesheets/compass/images/flag/om.png +0 -0
  363. data/test/fixtures/stylesheets/compass/images/flag/pa.png +0 -0
  364. data/test/fixtures/stylesheets/compass/images/flag/pe.png +0 -0
  365. data/test/fixtures/stylesheets/compass/images/flag/pf.png +0 -0
  366. data/test/fixtures/stylesheets/compass/images/flag/pg.png +0 -0
  367. data/test/fixtures/stylesheets/compass/images/flag/ph.png +0 -0
  368. data/test/fixtures/stylesheets/compass/images/flag/pk.png +0 -0
  369. data/test/fixtures/stylesheets/compass/images/flag/pl.png +0 -0
  370. data/test/fixtures/stylesheets/compass/images/flag/pm.png +0 -0
  371. data/test/fixtures/stylesheets/compass/images/flag/pn.png +0 -0
  372. data/test/fixtures/stylesheets/compass/images/flag/pr.png +0 -0
  373. data/test/fixtures/stylesheets/compass/images/flag/ps.png +0 -0
  374. data/test/fixtures/stylesheets/compass/images/flag/pt.png +0 -0
  375. data/test/fixtures/stylesheets/compass/images/flag/pw.png +0 -0
  376. data/test/fixtures/stylesheets/compass/images/flag/py.png +0 -0
  377. data/test/fixtures/stylesheets/compass/images/flag/qa.png +0 -0
  378. data/test/fixtures/stylesheets/compass/images/flag/re.png +0 -0
  379. data/test/fixtures/stylesheets/compass/images/flag/ro.png +0 -0
  380. data/test/fixtures/stylesheets/compass/images/flag/rs.png +0 -0
  381. data/test/fixtures/stylesheets/compass/images/flag/ru.png +0 -0
  382. data/test/fixtures/stylesheets/compass/images/flag/rw.png +0 -0
  383. data/test/fixtures/stylesheets/compass/images/flag/sa.png +0 -0
  384. data/test/fixtures/stylesheets/compass/images/flag/sb.png +0 -0
  385. data/test/fixtures/stylesheets/compass/images/flag/sc.png +0 -0
  386. data/test/fixtures/stylesheets/compass/images/flag/scotland.png +0 -0
  387. data/test/fixtures/stylesheets/compass/images/flag/sd.png +0 -0
  388. data/test/fixtures/stylesheets/compass/images/flag/se.png +0 -0
  389. data/test/fixtures/stylesheets/compass/images/flag/sg.png +0 -0
  390. data/test/fixtures/stylesheets/compass/images/flag/sh.png +0 -0
  391. data/test/fixtures/stylesheets/compass/images/flag/si.png +0 -0
  392. data/test/fixtures/stylesheets/compass/images/flag/sj.png +0 -0
  393. data/test/fixtures/stylesheets/compass/images/flag/sk.png +0 -0
  394. data/test/fixtures/stylesheets/compass/images/flag/sl.png +0 -0
  395. data/test/fixtures/stylesheets/compass/images/flag/sm.png +0 -0
  396. data/test/fixtures/stylesheets/compass/images/flag/sn.png +0 -0
  397. data/test/fixtures/stylesheets/compass/images/flag/so.png +0 -0
  398. data/test/fixtures/stylesheets/compass/images/flag/sr.png +0 -0
  399. data/test/fixtures/stylesheets/compass/images/flag/st.png +0 -0
  400. data/test/fixtures/stylesheets/compass/images/flag/sv.png +0 -0
  401. data/test/fixtures/stylesheets/compass/images/flag/sy.png +0 -0
  402. data/test/fixtures/stylesheets/compass/images/flag/sz.png +0 -0
  403. data/test/fixtures/stylesheets/compass/images/flag/tc.png +0 -0
  404. data/test/fixtures/stylesheets/compass/images/flag/td.png +0 -0
  405. data/test/fixtures/stylesheets/compass/images/flag/tf.png +0 -0
  406. data/test/fixtures/stylesheets/compass/images/flag/tg.png +0 -0
  407. data/test/fixtures/stylesheets/compass/images/flag/th.png +0 -0
  408. data/test/fixtures/stylesheets/compass/images/flag/tj.png +0 -0
  409. data/test/fixtures/stylesheets/compass/images/flag/tk.png +0 -0
  410. data/test/fixtures/stylesheets/compass/images/flag/tl.png +0 -0
  411. data/test/fixtures/stylesheets/compass/images/flag/tm.png +0 -0
  412. data/test/fixtures/stylesheets/compass/images/flag/tn.png +0 -0
  413. data/test/fixtures/stylesheets/compass/images/flag/to.png +0 -0
  414. data/test/fixtures/stylesheets/compass/images/flag/tr.png +0 -0
  415. data/test/fixtures/stylesheets/compass/images/flag/tt.png +0 -0
  416. data/test/fixtures/stylesheets/compass/images/flag/tv.png +0 -0
  417. data/test/fixtures/stylesheets/compass/images/flag/tw.png +0 -0
  418. data/test/fixtures/stylesheets/compass/images/flag/tz.png +0 -0
  419. data/test/fixtures/stylesheets/compass/images/flag/ua.png +0 -0
  420. data/test/fixtures/stylesheets/compass/images/flag/ug.png +0 -0
  421. data/test/fixtures/stylesheets/compass/images/flag/um.png +0 -0
  422. data/test/fixtures/stylesheets/compass/images/flag/us.png +0 -0
  423. data/test/fixtures/stylesheets/compass/images/flag/uy.png +0 -0
  424. data/test/fixtures/stylesheets/compass/images/flag/uz.png +0 -0
  425. data/test/fixtures/stylesheets/compass/images/flag/va.png +0 -0
  426. data/test/fixtures/stylesheets/compass/images/flag/vc.png +0 -0
  427. data/test/fixtures/stylesheets/compass/images/flag/ve.png +0 -0
  428. data/test/fixtures/stylesheets/compass/images/flag/vg.png +0 -0
  429. data/test/fixtures/stylesheets/compass/images/flag/vi.png +0 -0
  430. data/test/fixtures/stylesheets/compass/images/flag/vn.png +0 -0
  431. data/test/fixtures/stylesheets/compass/images/flag/vu.png +0 -0
  432. data/test/fixtures/stylesheets/compass/images/flag/wales.png +0 -0
  433. data/test/fixtures/stylesheets/compass/images/flag/wf.png +0 -0
  434. data/test/fixtures/stylesheets/compass/images/flag/ws.png +0 -0
  435. data/test/fixtures/stylesheets/compass/images/flag/ye.png +0 -0
  436. data/test/fixtures/stylesheets/compass/images/flag/yt.png +0 -0
  437. data/test/fixtures/stylesheets/compass/images/flag/za.png +0 -0
  438. data/test/fixtures/stylesheets/compass/images/flag/zm.png +0 -0
  439. data/test/fixtures/stylesheets/compass/images/flag/zw.png +0 -0
  440. data/test/fixtures/stylesheets/compass/images/flag-s5b4f509715.png +0 -0
  441. data/test/fixtures/stylesheets/compass/images/flag_states/foo.png +0 -0
  442. data/test/fixtures/stylesheets/compass/images/flag_states/foo_active.png +0 -0
  443. data/test/fixtures/stylesheets/compass/images/flag_states/foo_focus.png +0 -0
  444. data/test/fixtures/stylesheets/compass/images/flag_states/foo_hover.png +0 -0
  445. data/test/fixtures/stylesheets/compass/images/flag_states/foo_target.png +0 -0
  446. data/test/fixtures/stylesheets/compass/images/flag_states-sc42d7bf926.png +0 -0
  447. data/test/fixtures/stylesheets/compass/sass/animation-with-legacy-ie.scss +17 -0
  448. data/test/fixtures/stylesheets/compass/sass/animation.scss +13 -0
  449. data/test/fixtures/stylesheets/compass/sass/appearance.scss +5 -0
  450. data/test/fixtures/stylesheets/compass/sass/background-clip.scss +5 -0
  451. data/test/fixtures/stylesheets/compass/sass/background-origin.scss +5 -0
  452. data/test/fixtures/stylesheets/compass/sass/background-size.scss +7 -0
  453. data/test/fixtures/stylesheets/compass/sass/border_radius.scss +5 -0
  454. data/test/fixtures/stylesheets/compass/sass/box-sizing.scss +11 -0
  455. data/test/fixtures/stylesheets/compass/sass/box.sass +50 -0
  456. data/test/fixtures/stylesheets/compass/sass/box_shadow.scss +7 -0
  457. data/test/fixtures/stylesheets/compass/sass/brightness.scss +12 -0
  458. data/test/fixtures/stylesheets/compass/sass/browser-support.scss +30 -0
  459. data/test/fixtures/stylesheets/compass/sass/color.scss +25 -0
  460. data/test/fixtures/stylesheets/compass/sass/columns.scss +29 -0
  461. data/test/fixtures/stylesheets/compass/sass/filters.scss +25 -0
  462. data/test/fixtures/stylesheets/compass/sass/flexbox.scss +88 -0
  463. data/test/fixtures/stylesheets/compass/sass/fonts.sass +8 -0
  464. data/test/fixtures/stylesheets/compass/sass/force-wrap.scss +3 -0
  465. data/test/fixtures/stylesheets/compass/sass/gradients.sass +128 -0
  466. data/test/fixtures/stylesheets/compass/sass/grid_background.scss +34 -0
  467. data/test/fixtures/stylesheets/compass/sass/hyphenation.scss +11 -0
  468. data/test/fixtures/stylesheets/compass/sass/image_size.sass +15 -0
  469. data/test/fixtures/stylesheets/compass/sass/images.scss +9 -0
  470. data/test/fixtures/stylesheets/compass/sass/layout.sass +3 -0
  471. data/test/fixtures/stylesheets/compass/sass/legacy_clearfix.scss +14 -0
  472. data/test/fixtures/stylesheets/compass/sass/lists.scss +12 -0
  473. data/test/fixtures/stylesheets/compass/sass/opacity.scss +9 -0
  474. data/test/fixtures/stylesheets/compass/sass/print.sass +5 -0
  475. data/test/fixtures/stylesheets/compass/sass/regions.scss +4 -0
  476. data/test/fixtures/stylesheets/compass/sass/replacement.scss +22 -0
  477. data/test/fixtures/stylesheets/compass/sass/reset.sass +12 -0
  478. data/test/fixtures/stylesheets/compass/sass/selection.scss +41 -0
  479. data/test/fixtures/stylesheets/compass/sass/sprites_with_explicit_separator.scss +11 -0
  480. data/test/fixtures/stylesheets/compass/sass/stretching.sass +34 -0
  481. data/test/fixtures/stylesheets/compass/sass/support.scss +174 -0
  482. data/test/fixtures/stylesheets/compass/sass/text_shadow.scss +12 -0
  483. data/test/fixtures/stylesheets/compass/sass/transform.scss +87 -0
  484. data/test/fixtures/stylesheets/compass/sass/transition.scss +21 -0
  485. data/test/fixtures/stylesheets/compass/sass/typography/links/hover-link.scss +3 -0
  486. data/test/fixtures/stylesheets/compass/sass/units.scss +50 -0
  487. data/test/fixtures/stylesheets/compass/sass/user-interface.scss +28 -0
  488. data/test/fixtures/stylesheets/compass/sass/utilities.scss +33 -0
  489. data/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss +60 -0
  490. data/test/fixtures/stylesheets/compass/sass/vertical_rhythm_with_ems.scss +52 -0
  491. data/test/fixtures/stylesheets/compass/sass/vertical_rhythm_with_px.scss +50 -0
  492. data/test/fixtures/stylesheets/compass/sass/vertical_rhythm_with_rems.scss +50 -0
  493. data/test/fixtures/stylesheets/envtest/config.rb +9 -0
  494. data/test/fixtures/stylesheets/envtest/css/env.css +10 -0
  495. data/test/fixtures/stylesheets/envtest/sass/env.scss +19 -0
  496. data/test/fixtures/stylesheets/error/config.rb +10 -0
  497. data/test/fixtures/stylesheets/error/sass/screen.sass +2 -0
  498. data/test/fixtures/stylesheets/image_urls/config.rb +19 -0
  499. data/test/fixtures/stylesheets/image_urls/css/screen.css +5 -0
  500. data/test/fixtures/stylesheets/image_urls/images/grid.png +0 -0
  501. data/test/fixtures/stylesheets/image_urls/sass/screen.sass +8 -0
  502. data/test/fixtures/stylesheets/relative/assets/images/testing.png +0 -0
  503. data/test/fixtures/stylesheets/relative/config.rb +10 -0
  504. data/test/fixtures/stylesheets/relative/css/ie.css +1 -0
  505. data/test/fixtures/stylesheets/relative/css/print.css +1 -0
  506. data/test/fixtures/stylesheets/relative/css/screen.css +1 -0
  507. data/test/fixtures/stylesheets/relative/sass/ie.sass +5 -0
  508. data/test/fixtures/stylesheets/relative/sass/print.sass +3 -0
  509. data/test/fixtures/stylesheets/relative/sass/screen.sass +2 -0
  510. data/test/fixtures/stylesheets/sourcemaps/config.rb +10 -0
  511. data/test/fixtures/stylesheets/sourcemaps/css/another_simple.css +2 -0
  512. data/test/fixtures/stylesheets/sourcemaps/css/another_simple.css.map +7 -0
  513. data/test/fixtures/stylesheets/sourcemaps/css/simple.css +2 -0
  514. data/test/fixtures/stylesheets/sourcemaps/css/simple.css.map +7 -0
  515. data/test/fixtures/stylesheets/sourcemaps/css/with_libraries.css +2 -0
  516. data/test/fixtures/stylesheets/sourcemaps/css/with_libraries.css.map +7 -0
  517. data/test/fixtures/stylesheets/sourcemaps/sass/another_simple.scss +3 -0
  518. data/test/fixtures/stylesheets/sourcemaps/sass/simple.sass +2 -0
  519. data/test/fixtures/stylesheets/sourcemaps/sass/with_libraries.scss +5 -0
  520. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/config.rb +25 -0
  521. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/ie.scss +5 -0
  522. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/print.scss +3 -0
  523. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/screen.scss +6 -0
  524. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/ie.css +5 -0
  525. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/print.css +3 -0
  526. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/screen.css +68 -0
  527. data/test/fixtures/stylesheets/valid/config.rb +9 -0
  528. data/test/fixtures/stylesheets/valid/sass/another_simple.scss +3 -0
  529. data/test/fixtures/stylesheets/valid/sass/simple.sass +2 -0
  530. data/test/fixtures/stylesheets/with_sass_globbing/config.rb +26 -0
  531. data/test/fixtures/stylesheets/with_sass_globbing/css/screen.css +19 -0
  532. data/test/fixtures/stylesheets/with_sass_globbing/sass/partials/_1.scss +3 -0
  533. data/test/fixtures/stylesheets/with_sass_globbing/sass/partials/_2.scss +3 -0
  534. data/test/fixtures/stylesheets/with_sass_globbing/sass/partials/_3.scss +4 -0
  535. data/test/fixtures/stylesheets/with_sass_globbing/sass/screen.scss +3 -0
  536. data/test/helpers/command_line.rb +114 -0
  537. data/test/helpers/diff.rb +49 -0
  538. data/test/helpers/io.rb +36 -0
  539. data/test/helpers/rails.rb +55 -0
  540. data/test/helpers/test_case.rb +62 -0
  541. data/test/integrations/compass_test.rb +259 -0
  542. data/test/integrations/sprites_test.rb +1123 -0
  543. data/test/test_helper.rb +67 -0
  544. data/test/units/actions_test.rb +24 -0
  545. data/test/units/caniuse_test.rb +194 -0
  546. data/test/units/command_line_test.rb +60 -0
  547. data/test/units/compass_util_test.rb +11 -0
  548. data/test/units/compiler_test.rb +16 -0
  549. data/test/units/configuration_test.rb +618 -0
  550. data/test/units/regressions_test.rb +35 -0
  551. data/test/units/sass_extensions_test.rb +232 -0
  552. data/test/units/sass_extenstions/gradients_test.rb +30 -0
  553. data/test/units/sprites/engine_test.rb +48 -0
  554. data/test/units/sprites/image_row_test.rb +58 -0
  555. data/test/units/sprites/image_test.rb +116 -0
  556. data/test/units/sprites/images_test.rb +46 -0
  557. data/test/units/sprites/importer_test.rb +91 -0
  558. data/test/units/sprites/layout_test.rb +180 -0
  559. data/test/units/sprites/row_fitter_test.rb +66 -0
  560. data/test/units/sprites/sprite_command_test.rb +55 -0
  561. data/test/units/sprites/sprite_map_test.rb +169 -0
  562. metadata +1175 -0
@@ -0,0 +1,1123 @@
1
+ require 'test_helper'
2
+ require 'fileutils'
3
+ require 'compass'
4
+ require 'compass/logger'
5
+ require 'sass/plugin'
6
+
7
+
8
+ class SpritesTest < Test::Unit::TestCase
9
+
10
+ def setup
11
+ Compass.reset_configuration!
12
+ @images_project_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures', 'sprites', 'public'))
13
+ @images_src_dir = 'images'
14
+ @images_src_path = File.join(@images_project_path, @images_src_dir)
15
+ @images_tmp_dir = 'images-tmp'
16
+ @images_tmp_path = File.join(@images_project_path, @images_tmp_dir)
17
+ @generated_images_tmp_dir = 'generated-images-tmp'
18
+ @generated_images_tmp_path = File.join(@images_project_path, @generated_images_tmp_dir)
19
+ ::FileUtils.cp_r @images_src_path, @images_tmp_path
20
+ ::FileUtils.mkdir_p @generated_images_tmp_path
21
+ file = StringIO.new(<<-CONFIG)
22
+ project_path = "#{@images_project_path}"
23
+ images_dir = "#{@images_tmp_dir}"
24
+ CONFIG
25
+ Compass.add_configuration(file, "sprite_config")
26
+ Compass.configure_sass_plugin!
27
+ end
28
+
29
+ def teardown
30
+ Compass.reset_configuration!
31
+ ::FileUtils.rm_r @images_tmp_path
32
+ ::FileUtils.rm_rf @generated_images_tmp_path
33
+ end
34
+
35
+
36
+ def map_location(file)
37
+ map_files(file).first
38
+ end
39
+
40
+ def map_files(glob)
41
+ Dir.glob(File.join(@images_tmp_path, glob))
42
+ end
43
+
44
+ def image_size(file)
45
+ Compass::Core::SassExtensions::Functions::ImageSize::ImageProperties.new(map_location(file)).size
46
+ end
47
+
48
+ def image_md5(file)
49
+ md5 = Digest::MD5.new
50
+ md5.update IO.read(map_location(file))
51
+ md5.hexdigest
52
+ end
53
+
54
+ def render(scss)
55
+ options = Compass.sass_engine_options
56
+ options[:line_comments] = false
57
+ options[:style] = :expanded
58
+ options[:syntax] = :scss
59
+ options[:compass] ||= {}
60
+ options[:compass][:logger] ||= Compass::NullLogger.new
61
+ css = Sass::Engine.new(scss, options).render
62
+ # reformat to fit result of heredoc:
63
+ " #{css.gsub('@charset "UTF-8";', '').gsub(/\n/, "\n ").strip}\n"
64
+ end
65
+
66
+ def clean(string)
67
+ string.gsub("\n", '').gsub(' ', '')
68
+ end
69
+
70
+ it "should generate sprite classes" do
71
+ css = render <<-SCSS
72
+ @import "squares/*.png";
73
+ @include all-squares-sprites;
74
+ SCSS
75
+ assert_correct <<-CSS, css
76
+ .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
77
+ background-image: url('/images-tmp/squares-sbbc18e2129.png');
78
+ background-repeat: no-repeat;
79
+ }
80
+
81
+ .squares-ten-by-ten {
82
+ background-position: 0 0;
83
+ }
84
+
85
+ .squares-twenty-by-twenty {
86
+ background-position: 0 -10px;
87
+ }
88
+ CSS
89
+ assert_equal image_size('squares-s*.png'), [20, 30]
90
+ assert_equal image_md5('squares-s*.png'), '7349a0f4e88ea80abddcf6ac2486abe3'
91
+ end
92
+
93
+ it "should output and serve sprite files using the generated images directory" do
94
+ Compass.reset_configuration!
95
+ file = StringIO.new(<<-CONFIG)
96
+ images_path = #{@images_tmp_path.inspect}
97
+ generated_images_path = #{@generated_images_tmp_path.inspect}
98
+ http_generated_images_path = "/images/generated"
99
+ CONFIG
100
+ Compass.add_configuration(file, "sprite_config")
101
+ Compass.configure_sass_plugin!
102
+ css = render <<-SCSS
103
+ @import "squares/*.png";
104
+ @include all-squares-sprites;
105
+ SCSS
106
+ assert_not_nil Dir.glob("#{@generated_images_tmp_path}/squares-s*.png").first
107
+ assert_correct <<-CSS, css
108
+ .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
109
+ background-image: url('/images/generated/squares-sbbc18e2129.png');
110
+ background-repeat: no-repeat;
111
+ }
112
+
113
+ .squares-ten-by-ten {
114
+ background-position: 0 0;
115
+ }
116
+
117
+ .squares-twenty-by-twenty {
118
+ background-position: 0 -10px;
119
+ }
120
+ CSS
121
+ end
122
+
123
+ it "should generate sprite classes with dimensions" do
124
+ css = render <<-SCSS
125
+ $squares-sprite-dimensions: true;
126
+ @import "squares/*.png";
127
+ @include all-squares-sprites;
128
+ SCSS
129
+ assert_correct <<-CSS, css
130
+ .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
131
+ background-image: url('/images-tmp/squares-sbbc18e2129.png');
132
+ background-repeat: no-repeat;
133
+ }
134
+
135
+ .squares-ten-by-ten {
136
+ background-position: 0 0;
137
+ height: 10px;
138
+ width: 10px;
139
+ }
140
+
141
+ .squares-twenty-by-twenty {
142
+ background-position: 0 -10px;
143
+ height: 20px;
144
+ width: 20px;
145
+ }
146
+ CSS
147
+ assert_equal image_size('squares-s*.png'), [20, 30]
148
+ end
149
+
150
+ it "should provide sprite mixin" do
151
+ css = render <<-SCSS
152
+ @import "squares/*.png";
153
+
154
+ .cubicle {
155
+ @include squares-sprite("ten-by-ten");
156
+ }
157
+
158
+ .large-cube {
159
+ @include squares-sprite("twenty-by-twenty", true);
160
+ }
161
+ SCSS
162
+ assert_correct <<-CSS, css
163
+ .squares-sprite, .cubicle, .large-cube {
164
+ background-image: url('/images-tmp/squares-sbbc18e2129.png');
165
+ background-repeat: no-repeat;
166
+ }
167
+
168
+ .cubicle {
169
+ background-position: 0 0;
170
+ }
171
+
172
+ .large-cube {
173
+ background-position: 0 -10px;
174
+ height: 20px;
175
+ width: 20px;
176
+ }
177
+ CSS
178
+ assert_equal image_size('squares-s*.png'), [20, 30]
179
+ end
180
+
181
+ # CUSTOMIZATIONS:
182
+
183
+ it "should be possible to change the base class" do
184
+ css = render <<-SCSS
185
+ $squares-sprite-base-class: ".circles";
186
+ @import "squares/*.png";
187
+ SCSS
188
+ assert_correct <<-CSS, css
189
+ .circles {
190
+ background-image: url('/images-tmp/squares-sbbc18e2129.png');
191
+ background-repeat: no-repeat;
192
+ }
193
+ CSS
194
+ assert_equal image_size('squares-s*.png'), [20, 30]
195
+ end
196
+
197
+ it "should calculate the spacing between images but not before first image" do
198
+ css = render <<-SCSS
199
+ $squares-ten-by-ten-spacing: 33px;
200
+ @import "squares/*.png";
201
+ @include all-squares-sprites;
202
+ SCSS
203
+ assert_correct <<-CSS, css
204
+ .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
205
+ background-image: url('/images-tmp/squares-s563a5e0855.png');
206
+ background-repeat: no-repeat;
207
+ }
208
+
209
+ .squares-ten-by-ten {
210
+ background-position: 0 0;
211
+ }
212
+
213
+ .squares-twenty-by-twenty {
214
+ background-position: 0 -43px;
215
+ }
216
+ CSS
217
+ assert_equal image_size('squares-s*.png'), [20, 63]
218
+ end
219
+
220
+ it "should calculate the spacing between images" do
221
+ css = render <<-SCSS
222
+ $squares-twenty-by-twenty-spacing: 33px;
223
+ @import "squares/*.png";
224
+ @include all-squares-sprites;
225
+ SCSS
226
+ assert_correct <<-CSS, css
227
+ .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
228
+ background-image: url('/images-tmp/squares-s4ea353fa6d.png');
229
+ background-repeat: no-repeat;
230
+ }
231
+
232
+ .squares-ten-by-ten {
233
+ background-position: 0 0;
234
+ }
235
+
236
+ .squares-twenty-by-twenty {
237
+ background-position: 0 -43px;
238
+ }
239
+ CSS
240
+ assert_equal image_size('squares-s*.png'), [20, 63]
241
+ end
242
+
243
+ it "should calculate the maximum spacing between images" do
244
+ css = render <<-SCSS
245
+ $squares-ten-by-ten-spacing: 44px;
246
+ $squares-twenty-by-twenty-spacing: 33px;
247
+ @import "squares/*.png";
248
+ @include all-squares-sprites;
249
+ SCSS
250
+ assert_correct <<-CSS, css
251
+ .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
252
+ background-image: url('/images-tmp/squares-sf4771cb124.png');
253
+ background-repeat: no-repeat;
254
+ }
255
+
256
+ .squares-ten-by-ten {
257
+ background-position: 0 0;
258
+ }
259
+
260
+ .squares-twenty-by-twenty {
261
+ background-position: 0 -54px;
262
+ }
263
+ CSS
264
+ assert_equal image_size('squares-s*.png'), [20, 74]
265
+ end
266
+
267
+ it "should calculate the maximum spacing between images in reversed order" do
268
+ css = render <<-SCSS
269
+ $squares-ten-by-ten-spacing: 33px;
270
+ $squares-twenty-by-twenty-spacing: 44px;
271
+ @import "squares/*.png";
272
+ @include all-squares-sprites;
273
+ SCSS
274
+ assert_correct <<-CSS, css
275
+ .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
276
+ background-image: url('/images-tmp/squares-sc82d6f3cf4.png');
277
+ background-repeat: no-repeat;
278
+ }
279
+
280
+ .squares-ten-by-ten {
281
+ background-position: 0 0;
282
+ }
283
+
284
+ .squares-twenty-by-twenty {
285
+ background-position: 0 -54px;
286
+ }
287
+ CSS
288
+ assert_equal image_size('squares-s*.png'), [20, 74]
289
+ end
290
+
291
+ it "should calculate the default spacing between images" do
292
+ css = render <<-SCSS
293
+ $squares-spacing: 22px;
294
+ @import "squares/*.png";
295
+ @include all-squares-sprites;
296
+ SCSS
297
+ assert_correct <<-CSS, css
298
+ .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
299
+ background-image: url('/images-tmp/squares-s2f4aa65dcf.png');
300
+ background-repeat: no-repeat;
301
+ }
302
+
303
+ .squares-ten-by-ten {
304
+ background-position: 0 0;
305
+ }
306
+
307
+ .squares-twenty-by-twenty {
308
+ background-position: 0 -32px;
309
+ }
310
+ CSS
311
+ assert_equal image_size('squares-s*.png'), [20, 52]
312
+ end
313
+
314
+ it "should use position adjustments in functions" do
315
+ css = render <<-SCSS
316
+ $squares: sprite-map("squares/*.png", $position: 100%);
317
+ .squares-sprite {
318
+ background-image: $squares;
319
+ background-repeat: no-repeat;
320
+ }
321
+
322
+ .adjusted-percentage {
323
+ background-position: sprite-position($squares, ten-by-ten, 100%);
324
+ }
325
+
326
+ .adjusted-px-1 {
327
+ background-position: sprite-position($squares, ten-by-ten, 4px);
328
+ }
329
+
330
+ .adjusted-px-2 {
331
+ background-position: sprite-position($squares, twenty-by-twenty, -3px, 2px);
332
+ }
333
+ SCSS
334
+ assert_correct <<-CSS, css
335
+ .squares-sprite {
336
+ background-image: url('/images-tmp/squares-sce5dc30797.png');
337
+ background-repeat: no-repeat;
338
+ }
339
+
340
+ .adjusted-percentage {
341
+ background-position: 100% 0;
342
+ }
343
+
344
+ .adjusted-px-1 {
345
+ background-position: -6px 0;
346
+ }
347
+
348
+ .adjusted-px-2 {
349
+ background-position: -3px -8px;
350
+ }
351
+ CSS
352
+ assert_equal image_size('squares-s*.png'), [20, 30]
353
+ assert_equal image_md5('squares-s*.png'), '9cc7ce48cfaf304381c2d08adefd2fb6'
354
+ end
355
+
356
+ it "should use position adjustments in mixins" do
357
+ css = render <<-SCSS
358
+ $squares-position: 100%;
359
+ @import "squares/*.png";
360
+
361
+ .adjusted-percentage {
362
+ @include squares-sprite("ten-by-ten", $offset-x: 100%);
363
+ }
364
+
365
+ .adjusted-px-1 {
366
+ @include squares-sprite("ten-by-ten", $offset-x: 4px);
367
+ }
368
+
369
+ .adjusted-px-2 {
370
+ @include squares-sprite("twenty-by-twenty", $offset-x: -3px, $offset-y: 2px);
371
+ }
372
+ SCSS
373
+ assert_correct <<-CSS, css
374
+ .squares-sprite, .adjusted-percentage, .adjusted-px-1, .adjusted-px-2 {
375
+ background-image: url('/images-tmp/squares-sce5dc30797.png');
376
+ background-repeat: no-repeat;
377
+ }
378
+
379
+ .adjusted-percentage {
380
+ background-position: 100% 0;
381
+ }
382
+
383
+ .adjusted-px-1 {
384
+ background-position: -6px 0;
385
+ }
386
+
387
+ .adjusted-px-2 {
388
+ background-position: -3px -8px;
389
+ }
390
+ CSS
391
+ assert_equal image_size('squares-s*.png'), [20, 30]
392
+ assert_equal image_md5('squares-s*.png'), '9cc7ce48cfaf304381c2d08adefd2fb6'
393
+ end
394
+
395
+ it "should repeat the image" do
396
+ css = render <<-SCSS
397
+ $squares-repeat: repeat-x;
398
+ @import "squares/*.png";
399
+ @include all-squares-sprites;
400
+ SCSS
401
+ assert_correct <<-CSS, css
402
+ .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
403
+ background-image: url('/images-tmp/squares-s65c43cd573.png');
404
+ background-repeat: no-repeat;
405
+ }
406
+
407
+ .squares-ten-by-ten {
408
+ background-position: 0 0;
409
+ }
410
+
411
+ .squares-twenty-by-twenty {
412
+ background-position: 0 -10px;
413
+ }
414
+ CSS
415
+ assert_equal image_size('squares-s*.png'), [20, 30]
416
+ assert_equal image_md5('squares-s*.png'), 'a77a2fd43f04d791722b706aa7c9f1c1'
417
+ end
418
+
419
+ it "should allow the position of a sprite to be specified in absolute pixels" do
420
+ css = render <<-SCSS
421
+ $squares-ten-by-ten-position: 10px;
422
+ $squares-twenty-by-twenty-position: 10px;
423
+ @import "squares/*.png";
424
+ @include all-squares-sprites;
425
+ SCSS
426
+ assert_correct <<-CSS, css
427
+ .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
428
+ background-image: url('/images-tmp/squares-sb9d9a8ca6a.png');
429
+ background-repeat: no-repeat;
430
+ }
431
+
432
+ .squares-ten-by-ten {
433
+ background-position: -10px 0;
434
+ }
435
+
436
+ .squares-twenty-by-twenty {
437
+ background-position: -10px -10px;
438
+ }
439
+ CSS
440
+ assert_equal image_size('squares-s*.png'), [30, 30]
441
+ assert_equal image_md5('squares-s*.png'), '9856ced9e8211b6b28ff782019a0d905'
442
+ end
443
+
444
+ it "should provide a nice errors for lemonade's old users" do
445
+ assert_raise(Sass::SyntaxError) do
446
+ render <<-SCSS
447
+ .squares {
448
+ background-image: sprite-url("squares/*.png");
449
+ background-repeat: no-repeat;
450
+ }
451
+ SCSS
452
+ end
453
+
454
+ assert_raise(Sass::SyntaxError) do
455
+ css = render <<-SCSS
456
+ @import "squares/*.png";
457
+
458
+ .squares {
459
+ background-image: sprite-position("squares/twenty-by-twenty.png");
460
+ background-repeat: no-repeat;
461
+ }
462
+ SCSS
463
+ end
464
+ end
465
+
466
+ it "should work even if @import is missing" do
467
+ css = render <<-SCSS
468
+ .squares {
469
+ background-image: sprite(sprite-map("squares/*.png"), twenty-by-twenty);
470
+ background-repeat: no-repeat;
471
+ }
472
+ SCSS
473
+ assert_correct <<-CSS, css
474
+ .squares {
475
+ background-image: url('/images-tmp/squares-sd817b59156.png') 0 -10px;
476
+ background-repeat: no-repeat;
477
+ }
478
+ CSS
479
+ end
480
+
481
+ it "should import sprites with numeric filenames via #738" do
482
+ css = render <<-SCSS
483
+ @import "numeric/*.png";
484
+ @include all-numeric-sprites;
485
+ SCSS
486
+ assert_correct <<-CSS, css
487
+ .numeric-sprite, .numeric-200 {
488
+ background-image: url('/images-tmp/numeric-saa92d65a89.png');
489
+ background-repeat: no-repeat;
490
+ }
491
+
492
+ .numeric-200 {
493
+ background-position: 0 0;
494
+ }
495
+ CSS
496
+ end
497
+
498
+ it "should use percentage positions when use_percentages is true" do
499
+ css = render <<-SCSS
500
+ @import "squares/*.png";
501
+ $squares-use-percentages: true;
502
+ .foo {
503
+ @include squares-sprite-position("twenty-by-twenty");
504
+ }
505
+ .bar {
506
+ @include squares-sprite-position("ten-by-ten");
507
+ @include squares-sprite-dimensions("ten-by-ten");
508
+ }
509
+ SCSS
510
+ assert_correct <<-CSS, css
511
+ .squares-sprite {
512
+ background-image: url('/images-tmp/squares-sbbc18e2129.png');
513
+ background-repeat: no-repeat;
514
+ }
515
+
516
+ .foo {
517
+ background-position: 0 100%;
518
+ }
519
+
520
+ .bar {
521
+ background-position: 0 0;
522
+ height: 10px;
523
+ width: 10px;
524
+ }
525
+ CSS
526
+ end
527
+
528
+ it "should use correct percentages when use_percentages is with horizontal layout" do
529
+ css = render <<-SCSS
530
+ $squares-layout: horizontal;
531
+ @import "squares/*.png";
532
+ $squares-use-percentages: true;
533
+ .foo {
534
+ @include squares-sprite-position("twenty-by-twenty");
535
+ }
536
+ .bar {
537
+ @include squares-sprite-position("ten-by-ten");
538
+ }
539
+ SCSS
540
+ assert_correct <<-CSS, css
541
+ .squares-sprite {
542
+ background-image: url('/images-tmp/squares-s4bd95c5c56.png');
543
+ background-repeat: no-repeat;
544
+ }
545
+
546
+ .foo {
547
+ background-position: 100% 0;
548
+ }
549
+
550
+ .bar {
551
+ background-position: 0 0;
552
+ }
553
+ CSS
554
+ end
555
+
556
+ it "should use correct percentages when use_percentages is true with smart layout" do
557
+ css = render <<-SCSS
558
+ $image_row-layout: smart;
559
+ @import "image_row/*.png";
560
+ $image_row-use-percentages: true;
561
+ .foo {
562
+ @include image_row-sprite-position("medium");
563
+ }
564
+ .bar {
565
+ @include image_row-sprite-position("large_square");
566
+ }
567
+ SCSS
568
+ assert_correct <<-CSS, css
569
+ .image_row-sprite {
570
+ background-image: url('/images-tmp/image_row-sc5082a6b9f.png');
571
+ background-repeat: no-repeat;
572
+ }
573
+
574
+ .foo {
575
+ background-position: 0 50%;
576
+ }
577
+
578
+ .bar {
579
+ background-position: 33.3333333333% 100%;
580
+ }
581
+ CSS
582
+ end
583
+
584
+ it "should use correct percentages when use_percentages is true" do
585
+ css = render <<-SCSS
586
+ $image_row-use-percentages: true;
587
+ $image_row-sort-by : '!width';
588
+ @import "image_row/*.png";
589
+ @include all-image_row-sprites;
590
+ SCSS
591
+ assert_correct <<-CSS, css
592
+ .image_row-sprite, .image_row-large, .image_row-large_square, .image_row-medium, .image_row-small, .image_row-tall {
593
+ background-image: url('/images-tmp/image_row-sdf383d45a3.png');
594
+ background-repeat: no-repeat;
595
+ }
596
+
597
+ .image_row-large {
598
+ background-position: 0 0;
599
+ }
600
+
601
+ .image_row-large_square {
602
+ background-position: 0 40%;
603
+ }
604
+
605
+ .image_row-medium {
606
+ background-position: 0 16.6666666667%;
607
+ }
608
+
609
+ .image_row-small {
610
+ background-position: 0 100%;
611
+ }
612
+
613
+ .image_row-tall {
614
+ background-position: 0 80%;
615
+ }
616
+ CSS
617
+ end
618
+
619
+ it "should calculate corret sprite demsions when givin spacing via issue#253" do
620
+ css = render <<-SCSS
621
+ $squares-spacing: 10px;
622
+ @import "squares/*.png";
623
+ .foo {
624
+ @include sprite-background-position($squares-sprites, "twenty-by-twenty");
625
+ }
626
+ .bar {
627
+ @include sprite-background-position($squares-sprites, "ten-by-ten");
628
+ }
629
+ SCSS
630
+ assert_equal image_size('squares-s*.png'), [20, 40]
631
+ assert_correct <<-CSS, css
632
+ .squares-sprite {
633
+ background-image: url('/images-tmp/squares-s555875d730.png');
634
+ background-repeat: no-repeat;
635
+ }
636
+
637
+ .foo {
638
+ background-position: 0 -20px;
639
+ }
640
+
641
+ .bar {
642
+ background-position: 0 0;
643
+ }
644
+ CSS
645
+ end
646
+
647
+ it "should render correct sprite with css selectors via issue#248" do
648
+ css = render <<-SCSS
649
+ @import "selectors/*.png";
650
+ @include all-selectors-sprites;
651
+ SCSS
652
+ assert_correct <<-CSS, css
653
+ .selectors-sprite, .selectors-ten-by-ten {
654
+ background-image: url('/images-tmp/selectors-s7e84acb3d2.png');
655
+ background-repeat: no-repeat;
656
+ }
657
+
658
+ .selectors-ten-by-ten {
659
+ background-position: 0 0;
660
+ }
661
+ .selectors-ten-by-ten:hover, .selectors-ten-by-ten.ten-by-ten-hover {
662
+ background-position: 0 -20px;
663
+ }
664
+ .selectors-ten-by-ten:target, .selectors-ten-by-ten.ten-by-ten-target {
665
+ background-position: 0 -30px;
666
+ }
667
+ .selectors-ten-by-ten:active, .selectors-ten-by-ten.ten-by-ten-active {
668
+ background-position: 0 -10px;
669
+ }
670
+ CSS
671
+ end
672
+
673
+ it "should honor offsets when rendering selectors via issue#449" do
674
+ css = render <<-SCSS
675
+ @import "selectors/*.png";
676
+ @include all-selectors-sprites($offset-x: 20px, $offset-y: 20px);
677
+ SCSS
678
+ assert_correct <<-CSS, css
679
+ .selectors-sprite, .selectors-ten-by-ten {
680
+ background-image: url('/images-tmp/selectors-s7e84acb3d2.png');
681
+ background-repeat: no-repeat;
682
+ }
683
+
684
+ .selectors-ten-by-ten {
685
+ background-position: 20px 20px;
686
+ }
687
+ .selectors-ten-by-ten:hover, .selectors-ten-by-ten.ten-by-ten-hover {
688
+ background-position: 20px 0;
689
+ }
690
+ .selectors-ten-by-ten:target, .selectors-ten-by-ten.ten-by-ten-target {
691
+ background-position: 20px -10px;
692
+ }
693
+ .selectors-ten-by-ten:active, .selectors-ten-by-ten.ten-by-ten-active {
694
+ background-position: 20px 10px;
695
+ }
696
+ CSS
697
+ end
698
+
699
+ it "should render correct sprite with css selectors via magic mixin" do
700
+ css = render <<-SCSS
701
+ @import "selectors/*.png";
702
+ a {
703
+ @include selectors-sprite(ten-by-ten)
704
+ }
705
+ SCSS
706
+ assert_correct <<-CSS, css
707
+ .selectors-sprite, a {
708
+ background-image: url('/images-tmp/selectors-s7e84acb3d2.png');
709
+ background-repeat: no-repeat;
710
+ }
711
+
712
+ a {
713
+ background-position: 0 0;
714
+ }
715
+ a:hover, a.ten-by-ten-hover {
716
+ background-position: 0 -20px;
717
+ }
718
+ a:target, a.ten-by-ten-target {
719
+ background-position: 0 -30px;
720
+ }
721
+ a:active, a.ten-by-ten-active {
722
+ background-position: 0 -10px;
723
+ }
724
+ CSS
725
+ end
726
+
727
+
728
+ it "should not render corret sprite with css selectors via magic mixin" do
729
+ css = render <<-SCSS
730
+ @import "selectors/*.png";
731
+ a {
732
+ $disable-magic-sprite-selectors:true !global;
733
+ @include selectors-sprite(ten-by-ten)
734
+ }
735
+ SCSS
736
+ assert_correct <<-CSS, css
737
+ .selectors-sprite, a {
738
+ background-image: url('/images-tmp/selectors-s7e84acb3d2.png');
739
+ background-repeat: no-repeat;
740
+ }
741
+
742
+ a {
743
+ background-position: 0 0;
744
+ }
745
+ CSS
746
+ end
747
+
748
+ it "should render corret sprite with css selectors via magic mixin with the correct offsets" do
749
+ css = render <<-SCSS
750
+ @import "selectors/*.png";
751
+ a {
752
+ @include selectors-sprite(ten-by-ten, false, 5, -5)
753
+ }
754
+ SCSS
755
+ assert_correct <<-CSS, css
756
+ .selectors-sprite, a {
757
+ background-image: url('/images-tmp/selectors-s7e84acb3d2.png');
758
+ background-repeat: no-repeat;
759
+ }
760
+
761
+ a {
762
+ background-position: 5px -5px;
763
+ }
764
+ a:hover, a.ten-by-ten-hover {
765
+ background-position: 5px -25px;
766
+ }
767
+ a:target, a.ten-by-ten-target {
768
+ background-position: 5px -35px;
769
+ }
770
+ a:active, a.ten-by-ten-active {
771
+ background-position: 5px -15px;
772
+ }
773
+ CSS
774
+ end
775
+
776
+ it "should not raise error on filenames that are invalid classnames if the selector generation is not used" do
777
+ css = render <<-SCSS
778
+ $prefix-sort-by : 'width';
779
+ @import "prefix/*.png";
780
+ a {
781
+ @include prefix-sprite("20-by-20");
782
+ }
783
+ SCSS
784
+ assert_correct <<-CSS, css
785
+ .prefix-sprite, a {
786
+ background-image: url('/images-tmp/prefix-s949dea513d.png');
787
+ background-repeat: no-repeat;
788
+ }
789
+
790
+ a {
791
+ background-position: 0 -10px;
792
+ }
793
+ CSS
794
+ end
795
+
796
+ it "should generate sprite with bad repeat-x dimensions" do
797
+ css = render <<-SCSS
798
+ $ko-starbg26x27-repeat: repeat-x;
799
+ @import "ko/*.png";
800
+ @include all-ko-sprites;
801
+ SCSS
802
+ assert_correct <<-CSS, css
803
+ .ko-sprite, .ko-default_background, .ko-starbg26x27 {
804
+ background-image: url('/images-tmp/ko-sd46dfbab4f.png');
805
+ background-repeat: no-repeat;
806
+ }
807
+
808
+ .ko-default_background {
809
+ background-position: 0 0;
810
+ }
811
+
812
+ .ko-starbg26x27 {
813
+ background-position: 0 -128px;
814
+ }
815
+ CSS
816
+ end
817
+
818
+ it "should generate a sprite and remove the old file" do
819
+ FileUtils.touch File.join(@images_tmp_path, "selectors-scc8834Fdd.png")
820
+ assert_equal 1, map_files('selectors-s*.png').size
821
+ css = render <<-SCSS
822
+ @import "selectors/*.png";
823
+ a {
824
+ $disable-magic-sprite-selectors:true !global;
825
+ @include selectors-sprite(ten-by-ten)
826
+ }
827
+ SCSS
828
+ assert_equal 1, map_files('selectors-s*.png').size, "File was not removed"
829
+ end
830
+
831
+ it "should generate a sprite and NOT remove the old file" do
832
+ FileUtils.touch File.join(@images_tmp_path, "selectors-scc8834Ftest.png")
833
+ assert_equal 1, map_files('selectors-s*.png').size
834
+ css = render <<-SCSS
835
+ $selectors-clean-up: false;
836
+ @import "selectors/*.png";
837
+ a {
838
+ $disable-magic-sprite-selectors:true !global;
839
+ @include selectors-sprite(ten-by-ten)
840
+ }
841
+ SCSS
842
+ assert_equal 2, map_files('selectors-s*.png').size, "File was removed"
843
+ end
844
+
845
+ it "should generate a sprite if the sprite is a bool" do
846
+ css = render <<-SCSS
847
+ @import "bool/*.png";
848
+ a {
849
+ @include bool-sprite(false);
850
+ }
851
+ a {
852
+ @include bool-sprite(true);
853
+ }
854
+ SCSS
855
+ assert !css.empty?
856
+ end
857
+
858
+
859
+ it "should generate a sprite if the sprite is a colorname" do
860
+ css = render <<-SCSS
861
+ @import "colors/*.png";
862
+ a {
863
+ @include colors-sprite(blue);
864
+ }
865
+ SCSS
866
+ assert !css.empty?
867
+ end
868
+
869
+ it "should generate a sprite from nested folders" do
870
+ css = render <<-SCSS
871
+ @import "nested/**/*.png";
872
+ @include all-nested-sprites;
873
+ SCSS
874
+ assert_correct <<-CSS, css
875
+ .nested-sprite, .nested-ten-by-ten {
876
+ background-image: url('/images-tmp/nested-s7b93e0b6bf.png');
877
+ background-repeat: no-repeat;
878
+ }
879
+
880
+ .nested-ten-by-ten {
881
+ background-position: 0 0;
882
+ }
883
+ CSS
884
+ end
885
+
886
+ it "should create horizontal sprite" do
887
+ css = render <<-SCSS
888
+ $squares-layout:horizontal;
889
+ @import "squares/*.png";
890
+ .foo {
891
+ @include sprite-background-position($squares-sprites, "twenty-by-twenty");
892
+ }
893
+ .bar {
894
+ @include sprite-background-position($squares-sprites, "ten-by-ten");
895
+ }
896
+ SCSS
897
+ assert_equal [30, 20], image_size('squares-s*.png')
898
+ other_css = <<-CSS
899
+ .squares-sprite {
900
+ background-image: url('/images-tmp/squares-s4bd95c5c56.png');
901
+ background-repeat: no-repeat;
902
+ }
903
+
904
+ .foo {
905
+ background-position: -10px 0;
906
+ }
907
+
908
+ .bar {
909
+ background-position: 0 0;
910
+ }
911
+ CSS
912
+ assert_correct clean(other_css), clean(css)
913
+ end
914
+
915
+ it "should allow use of demension functions" do
916
+ css = render <<-SCSS
917
+ @import "squares/*.png";
918
+ $h: squares-sprite-height(twenty-by-twenty);
919
+ $w: squares-sprite-width(twenty-by-twenty);
920
+ .div {
921
+ height:$h + 1px;
922
+ width:$w + 2px;
923
+ }
924
+ SCSS
925
+ other_css = <<-CSS
926
+ .squares-sprite {
927
+ background-image: url('/images-tmp/squares-sbbc18e2129.png');
928
+ background-repeat: no-repeat;
929
+ }
930
+ .div {
931
+ height:21px;
932
+ width:22px;
933
+ }
934
+ CSS
935
+ assert_correct clean(other_css), clean(css)
936
+ end
937
+
938
+ it "should replace text with images and dimensions using sprites" do
939
+ css = render <<-SCSS
940
+ @import "compass/utilities/sprites/sprite-img";
941
+ @import "colors/*.png";
942
+ .blue {
943
+ @include sprite-replace-text($colors-sprites, blue);
944
+ }
945
+ .yellow {
946
+ @include sprite-replace-text-with-dimensions($colors-sprites, yellow);
947
+ }
948
+ SCSS
949
+ other_css = <<-CSS
950
+ .colors-sprite {
951
+ background-image:url('/images-tmp/colors-s58671cb5bb.png');
952
+ background-repeat: no-repeat;
953
+ }
954
+ .blue {
955
+ text-indent:-119988px;
956
+ overflow:hidden;
957
+ text-align:left;
958
+ text-transform: capitalize;
959
+ background-position:0 0;
960
+ background-image:url('/images-tmp/colors-s58671cb5bb.png');
961
+ background-repeat:no-repeat;
962
+ }
963
+
964
+ .yellow {
965
+ text-indent:-119988px;
966
+ overflow:hidden;
967
+ text-align:left;
968
+ text-transform: capitalize;
969
+ background-position:0 -10px;
970
+ height:10px;
971
+ width:10px;
972
+ background-image:url('/images-tmp/colors-s58671cb5bb.png');
973
+ background-repeat:no-repeat;
974
+ }
975
+ CSS
976
+ assert_correct clean(other_css), clean(css)
977
+ end
978
+
979
+ it "should inline the sprite file" do
980
+ Compass.reset_configuration!
981
+ file = StringIO.new(<<-CONFIG)
982
+ images_path = #{@images_tmp_path.inspect}
983
+ generated_images_path = #{@generated_images_tmp_path.inspect}
984
+ CONFIG
985
+ Compass.add_configuration(file, "sprite_config")
986
+ Compass.configure_sass_plugin!
987
+ css = render <<-SCSS
988
+ $colors-inline:true;
989
+ @import "colors/*.png";
990
+ @include all-colors-sprites;
991
+ SCSS
992
+ other_css = <<-CSS
993
+ .colors-sprite, .colors-blue, .colors-yellow {
994
+ background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAAAAACRhfOKAAAAHElEQVR42mM5wQADLP8JMRlIUIvE/IdgctLTNgCHDhEQVD4ceAAAAABJRU5ErkJggg==');
995
+ }
996
+ .colors-blue {
997
+ background-position:0 0;
998
+ }
999
+ .colors-yellow {
1000
+ background-position:0 -10px;
1001
+ }
1002
+ CSS
1003
+ assert_correct clean(other_css), clean(css)
1004
+ end
1005
+
1006
+ it "should have a sprite_name function that returns the names of the sprites in a sass list" do
1007
+ css = render <<-SCSS
1008
+ @import "colors/*.png";
1009
+ @each $color in sprite_names($colors-sprites) {
1010
+ .\#{$color} {
1011
+ width:0px;
1012
+ }
1013
+ }
1014
+ SCSS
1015
+ other_css = <<-CSS
1016
+ .colors-sprite {
1017
+ background-image: url('/images-tmp/colors-s58671cb5bb.png');
1018
+ background-repeat: no-repeat;
1019
+ }
1020
+ .blue {
1021
+ width:0px;
1022
+ }
1023
+ .yellow {
1024
+ width:0px;
1025
+ }
1026
+ CSS
1027
+ assert_correct clean(other_css), clean(css)
1028
+
1029
+ end
1030
+
1031
+ it "should respect global spacing" do
1032
+ css = render <<-SCSS
1033
+ $colors-spacing:5px;
1034
+ @import "colors/*.png";
1035
+ @include all-colors-sprites;
1036
+ SCSS
1037
+ other_css = <<-CSS
1038
+ .colors-sprite, .colors-blue, .colors-yellow {
1039
+ background-image: url('/images-tmp/colors-s747dec274e.png');
1040
+ background-repeat: no-repeat;
1041
+ }
1042
+ .colors-blue {
1043
+ background-position:0 0;
1044
+ }
1045
+ .colors-yellow {
1046
+ background-position:0 -15px;
1047
+ }
1048
+ CSS
1049
+ assert_correct clean(other_css), clean(css)
1050
+ end
1051
+
1052
+ it "should return width and height of the map" do
1053
+ css = render <<-SCSS
1054
+ @import "colors/*.png";
1055
+ .height { height : sprite_height($colors-sprites); }
1056
+ .width { width : sprite_width($colors-sprites); }
1057
+ SCSS
1058
+ other_css = <<-CSS
1059
+ .colors-sprite {
1060
+ background-image: url('/images-tmp/colors-s58671cb5bb.png');
1061
+ background-repeat: no-repeat;
1062
+ }
1063
+ .height {
1064
+ height : 20px;
1065
+ }
1066
+ .width {
1067
+ width : 10px;
1068
+ }
1069
+ CSS
1070
+ assert_correct clean(other_css), clean(css)
1071
+ end
1072
+
1073
+ it "should return width and height of a sprite" do
1074
+ css = render <<-SCSS
1075
+ @import "colors/*.png";
1076
+ .height { height : sprite_height($colors-sprites, blue); }
1077
+ .width { width : sprite_width($colors-sprites, blue); }
1078
+ SCSS
1079
+ other_css = <<-CSS
1080
+ .colors-sprite {
1081
+ background-image: url('/images-tmp/colors-s58671cb5bb.png');
1082
+ background-repeat: no-repeat;
1083
+ }
1084
+ .height {
1085
+ height : 10px;
1086
+ }
1087
+ .width {
1088
+ width : 10px;
1089
+ }
1090
+ CSS
1091
+ assert_correct clean(other_css), clean(css)
1092
+ end
1093
+
1094
+ it "should render correct sprite with focus selector" do
1095
+ css = render <<-SCSS
1096
+ @import "focus/*.png";
1097
+ @include all-focus-sprites;
1098
+ SCSS
1099
+ assert_correct <<-CSS, css
1100
+ .focus-sprite, .focus-ten-by-ten {
1101
+ background-image: url('/images-tmp/focus-sb5d1467be1.png');
1102
+ background-repeat: no-repeat;
1103
+ }
1104
+
1105
+ .focus-ten-by-ten {
1106
+ background-position: 0 0;
1107
+ }
1108
+ .focus-ten-by-ten:hover, .focus-ten-by-ten.ten-by-ten-hover {
1109
+ background-position: 0 -30px;
1110
+ }
1111
+ .focus-ten-by-ten:target, .focus-ten-by-ten.ten-by-ten-target {
1112
+ background-position: 0 -40px;
1113
+ }
1114
+ .focus-ten-by-ten:active, .focus-ten-by-ten.ten-by-ten-active {
1115
+ background-position: 0 -10px;
1116
+ }
1117
+ .focus-ten-by-ten:focus, .focus-ten-by-ten.ten-by-ten-focus {
1118
+ background-position: 0 -20px;
1119
+ }
1120
+ CSS
1121
+ end
1122
+
1123
+ end