haml_ejs 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (358) hide show
  1. data/.yardopts +11 -0
  2. data/CONTRIBUTING +3 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.md +68 -0
  5. data/Rakefile +419 -0
  6. data/VERSION +1 -0
  7. data/VERSION_NAME +1 -0
  8. data/bin/haml +9 -0
  9. data/bin/html2haml +7 -0
  10. data/extra/update_watch.rb +13 -0
  11. data/init.rb +18 -0
  12. data/lib/haml.rb +49 -0
  13. data/lib/haml/buffer.rb +297 -0
  14. data/lib/haml/compiler.rb +486 -0
  15. data/lib/haml/engine.rb +312 -0
  16. data/lib/haml/error.rb +22 -0
  17. data/lib/haml/exec.rb +362 -0
  18. data/lib/haml/filters.rb +388 -0
  19. data/lib/haml/haml_ejs.rb +57 -0
  20. data/lib/haml/helpers.rb +608 -0
  21. data/lib/haml/helpers/action_view_extensions.rb +57 -0
  22. data/lib/haml/helpers/action_view_mods.rb +257 -0
  23. data/lib/haml/helpers/xss_mods.rb +165 -0
  24. data/lib/haml/html.rb +412 -0
  25. data/lib/haml/html/erb.rb +141 -0
  26. data/lib/haml/parser.rb +760 -0
  27. data/lib/haml/railtie.rb +19 -0
  28. data/lib/haml/root.rb +7 -0
  29. data/lib/haml/shared.rb +78 -0
  30. data/lib/haml/template.rb +99 -0
  31. data/lib/haml/template/options.rb +16 -0
  32. data/lib/haml/template/patch.rb +58 -0
  33. data/lib/haml/template/plugin.rb +123 -0
  34. data/lib/haml/util.rb +842 -0
  35. data/lib/haml/version.rb +109 -0
  36. data/lib/sass.rb +8 -0
  37. data/lib/sass/plugin.rb +10 -0
  38. data/lib/sass/rails2_shim.rb +9 -0
  39. data/lib/sass/rails3_shim.rb +16 -0
  40. data/rails/init.rb +1 -0
  41. data/test/benchmark.rb +91 -0
  42. data/test/gemfiles/Gemfile.rails-2.0.x +8 -0
  43. data/test/gemfiles/Gemfile.rails-2.0.x.lock +38 -0
  44. data/test/gemfiles/Gemfile.rails-2.1.x +8 -0
  45. data/test/gemfiles/Gemfile.rails-2.1.x.lock +38 -0
  46. data/test/gemfiles/Gemfile.rails-2.2.x +8 -0
  47. data/test/gemfiles/Gemfile.rails-2.2.x.lock +38 -0
  48. data/test/gemfiles/Gemfile.rails-2.3.x +8 -0
  49. data/test/gemfiles/Gemfile.rails-2.3.x.lock +40 -0
  50. data/test/gemfiles/Gemfile.rails-3.0.x +8 -0
  51. data/test/gemfiles/Gemfile.rails-3.0.x.lock +85 -0
  52. data/test/gemfiles/Gemfile.rails-3.1.x +8 -0
  53. data/test/gemfiles/Gemfile.rails-3.1.x.lock +98 -0
  54. data/test/gemfiles/Gemfile.rails-xss-2.3.x +9 -0
  55. data/test/gemfiles/Gemfile.rails-xss-2.3.x.lock +42 -0
  56. data/test/haml-ejs/haml-ejs_test.rb +22 -0
  57. data/test/haml-ejs/templates/conditional.input +3 -0
  58. data/test/haml-ejs/templates/conditional.output +3 -0
  59. data/test/haml-ejs/templates/conditional_and_interpolation.input +2 -0
  60. data/test/haml-ejs/templates/conditional_and_interpolation.output +3 -0
  61. data/test/haml-ejs/templates/conditional_else.input +5 -0
  62. data/test/haml-ejs/templates/conditional_else.output +5 -0
  63. data/test/haml-ejs/templates/conditional_else_elsif.input +7 -0
  64. data/test/haml-ejs/templates/conditional_else_elsif.output +7 -0
  65. data/test/haml-ejs/templates/conditional_elsif.input +5 -0
  66. data/test/haml-ejs/templates/conditional_elsif.output +5 -0
  67. data/test/haml-ejs/templates/conditional_unless.input +3 -0
  68. data/test/haml-ejs/templates/conditional_unless.output +3 -0
  69. data/test/haml-ejs/templates/conditional_unless_else.input +5 -0
  70. data/test/haml-ejs/templates/conditional_unless_else.output +5 -0
  71. data/test/haml-ejs/templates/conditional_unless_elsif_else.input +5 -0
  72. data/test/haml-ejs/templates/conditional_unless_elsif_else.output +5 -0
  73. data/test/haml-ejs/templates/interpolation.input +2 -0
  74. data/test/haml-ejs/templates/interpolation.output +1 -0
  75. data/test/haml-ejs/templates/iteration.input +2 -0
  76. data/test/haml-ejs/templates/iteration.output +3 -0
  77. data/test/haml-ejs/templates/suite.input +26 -0
  78. data/test/haml-ejs/templates/suite.output +27 -0
  79. data/test/haml/engine_test.rb +1925 -0
  80. data/test/haml/erb/_av_partial_1.erb +12 -0
  81. data/test/haml/erb/_av_partial_2.erb +8 -0
  82. data/test/haml/erb/action_view.erb +62 -0
  83. data/test/haml/erb/standard.erb +55 -0
  84. data/test/haml/helper_test.rb +454 -0
  85. data/test/haml/html2haml/erb_tests.rb +440 -0
  86. data/test/haml/html2haml_test.rb +336 -0
  87. data/test/haml/markaby/standard.mab +52 -0
  88. data/test/haml/mocks/article.rb +6 -0
  89. data/test/haml/results/content_for_layout.xhtml +12 -0
  90. data/test/haml/results/eval_suppressed.xhtml +9 -0
  91. data/test/haml/results/filters.xhtml +62 -0
  92. data/test/haml/results/helpers.xhtml +70 -0
  93. data/test/haml/results/helpful.xhtml +10 -0
  94. data/test/haml/results/just_stuff.xhtml +70 -0
  95. data/test/haml/results/list.xhtml +12 -0
  96. data/test/haml/results/nuke_inner_whitespace.xhtml +40 -0
  97. data/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
  98. data/test/haml/results/original_engine.xhtml +20 -0
  99. data/test/haml/results/partial_layout.xhtml +5 -0
  100. data/test/haml/results/partials.xhtml +21 -0
  101. data/test/haml/results/render_layout.xhtml +3 -0
  102. data/test/haml/results/silent_script.xhtml +74 -0
  103. data/test/haml/results/standard.xhtml +162 -0
  104. data/test/haml/results/tag_parsing.xhtml +23 -0
  105. data/test/haml/results/very_basic.xhtml +5 -0
  106. data/test/haml/results/whitespace_handling.xhtml +89 -0
  107. data/test/haml/spec/README.md +97 -0
  108. data/test/haml/spec/lua_haml_spec.lua +30 -0
  109. data/test/haml/spec/ruby_haml_test.rb +19 -0
  110. data/test/haml/spec/tests.json +534 -0
  111. data/test/haml/spec_test.rb +44 -0
  112. data/test/haml/template_test.rb +419 -0
  113. data/test/haml/templates/_av_partial_1.haml +9 -0
  114. data/test/haml/templates/_av_partial_1_ugly.haml +9 -0
  115. data/test/haml/templates/_av_partial_2.haml +5 -0
  116. data/test/haml/templates/_av_partial_2_ugly.haml +5 -0
  117. data/test/haml/templates/_layout.erb +3 -0
  118. data/test/haml/templates/_layout_for_partial.haml +3 -0
  119. data/test/haml/templates/_partial.haml +8 -0
  120. data/test/haml/templates/_text_area.haml +3 -0
  121. data/test/haml/templates/action_view.haml +47 -0
  122. data/test/haml/templates/action_view_ugly.haml +47 -0
  123. data/test/haml/templates/breakage.haml +8 -0
  124. data/test/haml/templates/content_for_layout.haml +8 -0
  125. data/test/haml/templates/eval_suppressed.haml +11 -0
  126. data/test/haml/templates/filters.haml +66 -0
  127. data/test/haml/templates/helpers.haml +55 -0
  128. data/test/haml/templates/helpful.haml +11 -0
  129. data/test/haml/templates/just_stuff.haml +85 -0
  130. data/test/haml/templates/list.haml +12 -0
  131. data/test/haml/templates/nuke_inner_whitespace.haml +32 -0
  132. data/test/haml/templates/nuke_outer_whitespace.haml +144 -0
  133. data/test/haml/templates/original_engine.haml +17 -0
  134. data/test/haml/templates/partial_layout.haml +10 -0
  135. data/test/haml/templates/partialize.haml +1 -0
  136. data/test/haml/templates/partials.haml +12 -0
  137. data/test/haml/templates/render_layout.haml +2 -0
  138. data/test/haml/templates/silent_script.haml +40 -0
  139. data/test/haml/templates/standard.haml +43 -0
  140. data/test/haml/templates/standard_ugly.haml +43 -0
  141. data/test/haml/templates/tag_parsing.haml +21 -0
  142. data/test/haml/templates/very_basic.haml +4 -0
  143. data/test/haml/templates/whitespace_handling.haml +87 -0
  144. data/test/haml/util_test.rb +300 -0
  145. data/test/linked_rails.rb +42 -0
  146. data/test/test_helper.rb +75 -0
  147. data/vendor/sass/CONTRIBUTING +3 -0
  148. data/vendor/sass/MIT-LICENSE +20 -0
  149. data/vendor/sass/README.md +201 -0
  150. data/vendor/sass/Rakefile +339 -0
  151. data/vendor/sass/TODO +39 -0
  152. data/vendor/sass/VERSION +1 -0
  153. data/vendor/sass/VERSION_NAME +1 -0
  154. data/vendor/sass/bin/sass +8 -0
  155. data/vendor/sass/bin/sass-convert +7 -0
  156. data/vendor/sass/bin/scss +8 -0
  157. data/vendor/sass/doc-src/FAQ.md +35 -0
  158. data/vendor/sass/doc-src/INDENTED_SYNTAX.md +210 -0
  159. data/vendor/sass/doc-src/SASS_CHANGELOG.md +2214 -0
  160. data/vendor/sass/doc-src/SASS_REFERENCE.md +1957 -0
  161. data/vendor/sass/doc-src/SCSS_FOR_SASS_USERS.md +155 -0
  162. data/vendor/sass/ext/extconf.rb +10 -0
  163. data/vendor/sass/extra/update_watch.rb +13 -0
  164. data/vendor/sass/init.rb +18 -0
  165. data/vendor/sass/lib/sass.rb +72 -0
  166. data/vendor/sass/lib/sass/cache_stores.rb +15 -0
  167. data/vendor/sass/lib/sass/cache_stores/base.rb +84 -0
  168. data/vendor/sass/lib/sass/cache_stores/chain.rb +33 -0
  169. data/vendor/sass/lib/sass/cache_stores/filesystem.rb +58 -0
  170. data/vendor/sass/lib/sass/cache_stores/memory.rb +47 -0
  171. data/vendor/sass/lib/sass/cache_stores/null.rb +25 -0
  172. data/vendor/sass/lib/sass/callbacks.rb +66 -0
  173. data/vendor/sass/lib/sass/css.rb +294 -0
  174. data/vendor/sass/lib/sass/engine.rb +862 -0
  175. data/vendor/sass/lib/sass/environment.rb +155 -0
  176. data/vendor/sass/lib/sass/error.rb +201 -0
  177. data/vendor/sass/lib/sass/exec.rb +659 -0
  178. data/vendor/sass/lib/sass/importers.rb +22 -0
  179. data/vendor/sass/lib/sass/importers/base.rb +138 -0
  180. data/vendor/sass/lib/sass/importers/filesystem.rb +144 -0
  181. data/vendor/sass/lib/sass/less.rb +382 -0
  182. data/vendor/sass/lib/sass/plugin.rb +136 -0
  183. data/vendor/sass/lib/sass/plugin/compiler.rb +358 -0
  184. data/vendor/sass/lib/sass/plugin/configuration.rb +125 -0
  185. data/vendor/sass/lib/sass/plugin/generic.rb +15 -0
  186. data/vendor/sass/lib/sass/plugin/merb.rb +48 -0
  187. data/vendor/sass/lib/sass/plugin/rack.rb +60 -0
  188. data/vendor/sass/lib/sass/plugin/rails.rb +47 -0
  189. data/vendor/sass/lib/sass/plugin/staleness_checker.rb +173 -0
  190. data/vendor/sass/lib/sass/railtie.rb +9 -0
  191. data/vendor/sass/lib/sass/repl.rb +58 -0
  192. data/vendor/sass/lib/sass/root.rb +7 -0
  193. data/vendor/sass/lib/sass/script.rb +40 -0
  194. data/vendor/sass/lib/sass/script/bool.rb +18 -0
  195. data/vendor/sass/lib/sass/script/color.rb +480 -0
  196. data/vendor/sass/lib/sass/script/css_lexer.rb +29 -0
  197. data/vendor/sass/lib/sass/script/css_parser.rb +31 -0
  198. data/vendor/sass/lib/sass/script/funcall.rb +162 -0
  199. data/vendor/sass/lib/sass/script/functions.rb +1343 -0
  200. data/vendor/sass/lib/sass/script/interpolation.rb +70 -0
  201. data/vendor/sass/lib/sass/script/lexer.rb +334 -0
  202. data/vendor/sass/lib/sass/script/list.rb +76 -0
  203. data/vendor/sass/lib/sass/script/literal.rb +245 -0
  204. data/vendor/sass/lib/sass/script/node.rb +91 -0
  205. data/vendor/sass/lib/sass/script/number.rb +429 -0
  206. data/vendor/sass/lib/sass/script/operation.rb +91 -0
  207. data/vendor/sass/lib/sass/script/parser.rb +467 -0
  208. data/vendor/sass/lib/sass/script/string.rb +51 -0
  209. data/vendor/sass/lib/sass/script/string_interpolation.rb +94 -0
  210. data/vendor/sass/lib/sass/script/unary_operation.rb +57 -0
  211. data/vendor/sass/lib/sass/script/variable.rb +54 -0
  212. data/vendor/sass/lib/sass/scss.rb +17 -0
  213. data/vendor/sass/lib/sass/scss/css_parser.rb +46 -0
  214. data/vendor/sass/lib/sass/scss/parser.rb +920 -0
  215. data/vendor/sass/lib/sass/scss/rx.rb +127 -0
  216. data/vendor/sass/lib/sass/scss/sass_parser.rb +11 -0
  217. data/vendor/sass/lib/sass/scss/script_lexer.rb +15 -0
  218. data/vendor/sass/lib/sass/scss/script_parser.rb +25 -0
  219. data/vendor/sass/lib/sass/scss/static_parser.rb +40 -0
  220. data/vendor/sass/lib/sass/selector.rb +361 -0
  221. data/vendor/sass/lib/sass/selector/abstract_sequence.rb +62 -0
  222. data/vendor/sass/lib/sass/selector/comma_sequence.rb +81 -0
  223. data/vendor/sass/lib/sass/selector/sequence.rb +233 -0
  224. data/vendor/sass/lib/sass/selector/simple.rb +113 -0
  225. data/vendor/sass/lib/sass/selector/simple_sequence.rb +134 -0
  226. data/vendor/sass/lib/sass/shared.rb +78 -0
  227. data/vendor/sass/lib/sass/tree/charset_node.rb +22 -0
  228. data/vendor/sass/lib/sass/tree/comment_node.rb +77 -0
  229. data/vendor/sass/lib/sass/tree/debug_node.rb +18 -0
  230. data/vendor/sass/lib/sass/tree/directive_node.rb +23 -0
  231. data/vendor/sass/lib/sass/tree/each_node.rb +24 -0
  232. data/vendor/sass/lib/sass/tree/extend_node.rb +29 -0
  233. data/vendor/sass/lib/sass/tree/for_node.rb +36 -0
  234. data/vendor/sass/lib/sass/tree/function_node.rb +27 -0
  235. data/vendor/sass/lib/sass/tree/if_node.rb +65 -0
  236. data/vendor/sass/lib/sass/tree/import_node.rb +68 -0
  237. data/vendor/sass/lib/sass/tree/media_node.rb +32 -0
  238. data/vendor/sass/lib/sass/tree/mixin_def_node.rb +27 -0
  239. data/vendor/sass/lib/sass/tree/mixin_node.rb +32 -0
  240. data/vendor/sass/lib/sass/tree/node.rb +204 -0
  241. data/vendor/sass/lib/sass/tree/prop_node.rb +155 -0
  242. data/vendor/sass/lib/sass/tree/return_node.rb +18 -0
  243. data/vendor/sass/lib/sass/tree/root_node.rb +28 -0
  244. data/vendor/sass/lib/sass/tree/rule_node.rb +129 -0
  245. data/vendor/sass/lib/sass/tree/variable_node.rb +30 -0
  246. data/vendor/sass/lib/sass/tree/visitors/base.rb +75 -0
  247. data/vendor/sass/lib/sass/tree/visitors/check_nesting.rb +134 -0
  248. data/vendor/sass/lib/sass/tree/visitors/convert.rb +255 -0
  249. data/vendor/sass/lib/sass/tree/visitors/cssize.rb +175 -0
  250. data/vendor/sass/lib/sass/tree/visitors/perform.rb +301 -0
  251. data/vendor/sass/lib/sass/tree/visitors/to_css.rb +216 -0
  252. data/vendor/sass/lib/sass/tree/warn_node.rb +18 -0
  253. data/vendor/sass/lib/sass/tree/while_node.rb +18 -0
  254. data/vendor/sass/lib/sass/util.rb +669 -0
  255. data/vendor/sass/lib/sass/util/subset_map.rb +101 -0
  256. data/vendor/sass/lib/sass/version.rb +112 -0
  257. data/vendor/sass/rails/init.rb +1 -0
  258. data/vendor/sass/sass.gemspec +32 -0
  259. data/vendor/sass/test/sass/cache_test.rb +74 -0
  260. data/vendor/sass/test/sass/callbacks_test.rb +61 -0
  261. data/vendor/sass/test/sass/conversion_test.rb +1203 -0
  262. data/vendor/sass/test/sass/css2sass_test.rb +364 -0
  263. data/vendor/sass/test/sass/data/hsl-rgb.txt +319 -0
  264. data/vendor/sass/test/sass/engine_test.rb +2469 -0
  265. data/vendor/sass/test/sass/extend_test.rb +1348 -0
  266. data/vendor/sass/test/sass/functions_test.rb +1025 -0
  267. data/vendor/sass/test/sass/importer_test.rb +82 -0
  268. data/vendor/sass/test/sass/less_conversion_test.rb +653 -0
  269. data/vendor/sass/test/sass/mock_importer.rb +49 -0
  270. data/vendor/sass/test/sass/more_results/more1.css +9 -0
  271. data/vendor/sass/test/sass/more_results/more1_with_line_comments.css +26 -0
  272. data/vendor/sass/test/sass/more_results/more_import.css +29 -0
  273. data/vendor/sass/test/sass/more_templates/_more_partial.sass +2 -0
  274. data/vendor/sass/test/sass/more_templates/more1.sass +23 -0
  275. data/vendor/sass/test/sass/more_templates/more_import.sass +11 -0
  276. data/vendor/sass/test/sass/plugin_test.rb +469 -0
  277. data/vendor/sass/test/sass/results/alt.css +4 -0
  278. data/vendor/sass/test/sass/results/basic.css +9 -0
  279. data/vendor/sass/test/sass/results/compact.css +5 -0
  280. data/vendor/sass/test/sass/results/complex.css +86 -0
  281. data/vendor/sass/test/sass/results/compressed.css +1 -0
  282. data/vendor/sass/test/sass/results/expanded.css +19 -0
  283. data/vendor/sass/test/sass/results/if.css +3 -0
  284. data/vendor/sass/test/sass/results/import.css +31 -0
  285. data/vendor/sass/test/sass/results/import_charset.css +4 -0
  286. data/vendor/sass/test/sass/results/import_charset_1_8.css +4 -0
  287. data/vendor/sass/test/sass/results/import_charset_ibm866.css +4 -0
  288. data/vendor/sass/test/sass/results/line_numbers.css +49 -0
  289. data/vendor/sass/test/sass/results/mixins.css +95 -0
  290. data/vendor/sass/test/sass/results/multiline.css +24 -0
  291. data/vendor/sass/test/sass/results/nested.css +22 -0
  292. data/vendor/sass/test/sass/results/options.css +1 -0
  293. data/vendor/sass/test/sass/results/parent_ref.css +13 -0
  294. data/vendor/sass/test/sass/results/script.css +16 -0
  295. data/vendor/sass/test/sass/results/scss_import.css +31 -0
  296. data/vendor/sass/test/sass/results/scss_importee.css +2 -0
  297. data/vendor/sass/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
  298. data/vendor/sass/test/sass/results/subdir/subdir.css +3 -0
  299. data/vendor/sass/test/sass/results/units.css +11 -0
  300. data/vendor/sass/test/sass/results/warn.css +0 -0
  301. data/vendor/sass/test/sass/results/warn_imported.css +0 -0
  302. data/vendor/sass/test/sass/script_conversion_test.rb +283 -0
  303. data/vendor/sass/test/sass/script_test.rb +496 -0
  304. data/vendor/sass/test/sass/scss/css_test.rb +916 -0
  305. data/vendor/sass/test/sass/scss/rx_test.rb +156 -0
  306. data/vendor/sass/test/sass/scss/scss_test.rb +1249 -0
  307. data/vendor/sass/test/sass/scss/test_helper.rb +37 -0
  308. data/vendor/sass/test/sass/templates/_imported_charset_ibm866.sass +4 -0
  309. data/vendor/sass/test/sass/templates/_imported_charset_utf8.sass +4 -0
  310. data/vendor/sass/test/sass/templates/_partial.sass +2 -0
  311. data/vendor/sass/test/sass/templates/alt.sass +16 -0
  312. data/vendor/sass/test/sass/templates/basic.sass +23 -0
  313. data/vendor/sass/test/sass/templates/bork1.sass +2 -0
  314. data/vendor/sass/test/sass/templates/bork2.sass +2 -0
  315. data/vendor/sass/test/sass/templates/bork3.sass +2 -0
  316. data/vendor/sass/test/sass/templates/bork4.sass +2 -0
  317. data/vendor/sass/test/sass/templates/compact.sass +17 -0
  318. data/vendor/sass/test/sass/templates/complex.sass +305 -0
  319. data/vendor/sass/test/sass/templates/compressed.sass +15 -0
  320. data/vendor/sass/test/sass/templates/expanded.sass +17 -0
  321. data/vendor/sass/test/sass/templates/if.sass +11 -0
  322. data/vendor/sass/test/sass/templates/import.sass +12 -0
  323. data/vendor/sass/test/sass/templates/import_charset.sass +7 -0
  324. data/vendor/sass/test/sass/templates/import_charset_1_8.sass +4 -0
  325. data/vendor/sass/test/sass/templates/import_charset_ibm866.sass +9 -0
  326. data/vendor/sass/test/sass/templates/importee.less +2 -0
  327. data/vendor/sass/test/sass/templates/importee.sass +19 -0
  328. data/vendor/sass/test/sass/templates/line_numbers.sass +13 -0
  329. data/vendor/sass/test/sass/templates/mixin_bork.sass +5 -0
  330. data/vendor/sass/test/sass/templates/mixins.sass +76 -0
  331. data/vendor/sass/test/sass/templates/multiline.sass +20 -0
  332. data/vendor/sass/test/sass/templates/nested.sass +25 -0
  333. data/vendor/sass/test/sass/templates/nested_bork1.sass +2 -0
  334. data/vendor/sass/test/sass/templates/nested_bork2.sass +2 -0
  335. data/vendor/sass/test/sass/templates/nested_bork3.sass +2 -0
  336. data/vendor/sass/test/sass/templates/nested_bork4.sass +2 -0
  337. data/vendor/sass/test/sass/templates/nested_import.sass +2 -0
  338. data/vendor/sass/test/sass/templates/nested_mixin_bork.sass +6 -0
  339. data/vendor/sass/test/sass/templates/options.sass +2 -0
  340. data/vendor/sass/test/sass/templates/parent_ref.sass +25 -0
  341. data/vendor/sass/test/sass/templates/script.sass +101 -0
  342. data/vendor/sass/test/sass/templates/scss_import.scss +11 -0
  343. data/vendor/sass/test/sass/templates/scss_importee.scss +1 -0
  344. data/vendor/sass/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
  345. data/vendor/sass/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
  346. data/vendor/sass/test/sass/templates/subdir/subdir.sass +6 -0
  347. data/vendor/sass/test/sass/templates/units.sass +11 -0
  348. data/vendor/sass/test/sass/templates/warn.sass +3 -0
  349. data/vendor/sass/test/sass/templates/warn_imported.sass +4 -0
  350. data/vendor/sass/test/sass/test_helper.rb +8 -0
  351. data/vendor/sass/test/sass/util/subset_map_test.rb +91 -0
  352. data/vendor/sass/test/sass/util_test.rb +254 -0
  353. data/vendor/sass/test/test_helper.rb +69 -0
  354. data/vendor/sass/yard/callbacks.rb +29 -0
  355. data/vendor/sass/yard/default/fulldoc/html/css/common.sass +26 -0
  356. data/vendor/sass/yard/default/layout/html/footer.erb +12 -0
  357. data/vendor/sass/yard/inherited_hash.rb +41 -0
  358. metadata +458 -0
@@ -0,0 +1,1348 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
+
4
+ class ExtendTest < Test::Unit::TestCase
5
+ def test_basic
6
+ assert_equal <<CSS, render(<<SCSS)
7
+ .foo, .bar {
8
+ a: b; }
9
+ CSS
10
+ .foo {a: b}
11
+ .bar {@extend .foo}
12
+ SCSS
13
+
14
+ assert_equal <<CSS, render(<<SCSS)
15
+ .foo, .bar {
16
+ a: b; }
17
+ CSS
18
+ .bar {@extend .foo}
19
+ .foo {a: b}
20
+ SCSS
21
+
22
+ assert_equal <<CSS, render(<<SCSS)
23
+ .foo, .bar {
24
+ a: b; }
25
+
26
+ .bar {
27
+ c: d; }
28
+ CSS
29
+ .foo {a: b}
30
+ .bar {c: d; @extend .foo}
31
+ SCSS
32
+
33
+ assert_equal <<CSS, render(<<SCSS)
34
+ .foo, .bar {
35
+ a: b; }
36
+
37
+ .bar {
38
+ c: d; }
39
+ CSS
40
+ .foo {a: b}
41
+ .bar {@extend .foo; c: d}
42
+ SCSS
43
+ end
44
+
45
+ def test_indented_syntax
46
+ assert_equal <<CSS, render(<<SASS, :syntax => :sass)
47
+ .foo, .bar {
48
+ a: b; }
49
+ CSS
50
+ .foo
51
+ a: b
52
+ .bar
53
+ @extend .foo
54
+ SASS
55
+
56
+ assert_equal <<CSS, render(<<SASS, :syntax => :sass)
57
+ .foo, .bar {
58
+ a: b; }
59
+ CSS
60
+ .foo
61
+ a: b
62
+ .bar
63
+ @extend \#{".foo"}
64
+ SASS
65
+ end
66
+
67
+ def test_multiple_targets
68
+ assert_equal <<CSS, render(<<SCSS)
69
+ .foo, .bar {
70
+ a: b; }
71
+
72
+ .blip .foo, .blip .bar {
73
+ c: d; }
74
+ CSS
75
+ .foo {a: b}
76
+ .bar {@extend .foo}
77
+ .blip .foo {c: d}
78
+ SCSS
79
+ end
80
+
81
+ def test_multiple_extendees
82
+ assert_equal <<CSS, render(<<SCSS)
83
+ .foo, .baz {
84
+ a: b; }
85
+
86
+ .bar, .baz {
87
+ c: d; }
88
+ CSS
89
+ .foo {a: b}
90
+ .bar {c: d}
91
+ .baz {@extend .foo; @extend .bar}
92
+ SCSS
93
+ end
94
+
95
+ def test_multiple_extends_with_single_extender_and_single_target
96
+ assert_equal <<CSS, render(<<SCSS)
97
+ .foo .bar, .baz .bar, .foo .baz, .baz .baz {
98
+ a: b; }
99
+ CSS
100
+ .foo .bar {a: b}
101
+ .baz {@extend .foo; @extend .bar}
102
+ SCSS
103
+
104
+ assert_equal <<CSS, render(<<SCSS)
105
+ .foo.bar, .baz {
106
+ a: b; }
107
+ CSS
108
+ .foo.bar {a: b}
109
+ .baz {@extend .foo; @extend .bar}
110
+ SCSS
111
+ end
112
+
113
+ def test_multiple_extends_with_multiple_extenders_and_single_target
114
+ assert_equal <<CSS, render(<<SCSS)
115
+ .foo .bar, .baz .bar, .foo .bang, .baz .bang {
116
+ a: b; }
117
+ CSS
118
+ .foo .bar {a: b}
119
+ .baz {@extend .foo}
120
+ .bang {@extend .bar}
121
+ SCSS
122
+
123
+ assert_equal <<CSS, render(<<SCSS)
124
+ .foo.bar, .bar.baz, .baz.bang, .foo.bang {
125
+ a: b; }
126
+ CSS
127
+ .foo.bar {a: b}
128
+ .baz {@extend .foo}
129
+ .bang {@extend .bar}
130
+ SCSS
131
+ end
132
+
133
+ def test_chained_extends
134
+ assert_equal <<CSS, render(<<SCSS)
135
+ .foo, .bar, .baz, .bip {
136
+ a: b; }
137
+ CSS
138
+ .foo {a: b}
139
+ .bar {@extend .foo}
140
+ .baz {@extend .bar}
141
+ .bip {@extend .bar}
142
+ SCSS
143
+ end
144
+
145
+ def test_dynamic_extendee
146
+ assert_equal <<CSS, render(<<SCSS)
147
+ .foo, .bar {
148
+ a: b; }
149
+ CSS
150
+ .foo {a: b}
151
+ .bar {@extend \#{".foo"}}
152
+ SCSS
153
+
154
+ assert_equal <<CSS, render(<<SCSS)
155
+ [baz^="blip12px"], .bar {
156
+ a: b; }
157
+ CSS
158
+ [baz^="blip12px"] {a: b}
159
+ .bar {@extend [baz^="blip\#{12px}"]}
160
+ SCSS
161
+ end
162
+
163
+ def test_nested_target
164
+ assert_equal <<CSS, render(<<SCSS)
165
+ .foo .bar, .foo .baz {
166
+ a: b; }
167
+ CSS
168
+ .foo .bar {a: b}
169
+ .baz {@extend .bar}
170
+ SCSS
171
+ end
172
+
173
+ def test_target_with_child
174
+ assert_equal <<CSS, render(<<SCSS)
175
+ .foo .bar, .baz .bar {
176
+ a: b; }
177
+ CSS
178
+ .foo .bar {a: b}
179
+ .baz {@extend .foo}
180
+ SCSS
181
+ end
182
+
183
+ def test_class_unification
184
+ assert_equal <<CSS, render(<<SCSS)
185
+ .foo.bar, .bar.baz {
186
+ a: b; }
187
+ CSS
188
+ .foo.bar {a: b}
189
+ .baz {@extend .foo}
190
+ SCSS
191
+
192
+ assert_equal <<CSS, render(<<SCSS)
193
+ .baz {
194
+ a: b; }
195
+ CSS
196
+ .foo.baz {a: b}
197
+ .baz {@extend .foo}
198
+ SCSS
199
+ end
200
+
201
+ def test_id_unification
202
+ assert_equal <<CSS, render(<<SCSS)
203
+ .foo.bar, .bar#baz {
204
+ a: b; }
205
+ CSS
206
+ .foo.bar {a: b}
207
+ #baz {@extend .foo}
208
+ SCSS
209
+
210
+ assert_equal <<CSS, render(<<SCSS)
211
+ #baz {
212
+ a: b; }
213
+ CSS
214
+ .foo#baz {a: b}
215
+ #baz {@extend .foo}
216
+ SCSS
217
+
218
+ assert_equal <<CSS, render(<<SCSS)
219
+ .foo#baz {
220
+ a: b; }
221
+ CSS
222
+ .foo#baz {a: b}
223
+ #bar {@extend .foo}
224
+ SCSS
225
+ end
226
+
227
+ def test_universal_unification_with_simple_target
228
+ assert_equal <<CSS, render(<<SCSS)
229
+ .foo, * {
230
+ a: b; }
231
+ CSS
232
+ .foo {a: b}
233
+ * {@extend .foo}
234
+ SCSS
235
+
236
+ assert_equal <<CSS, render(<<SCSS)
237
+ .foo, *|* {
238
+ a: b; }
239
+ CSS
240
+ .foo {a: b}
241
+ *|* {@extend .foo}
242
+ SCSS
243
+
244
+ assert_equal <<CSS, render(<<SCSS)
245
+ .bar {
246
+ a: b; }
247
+ CSS
248
+ .foo.bar {a: b}
249
+ * {@extend .foo}
250
+ SCSS
251
+
252
+ assert_equal <<CSS, render(<<SCSS)
253
+ .bar {
254
+ a: b; }
255
+ CSS
256
+ .foo.bar {a: b}
257
+ *|* {@extend .foo}
258
+ SCSS
259
+
260
+ assert_equal <<CSS, render(<<SCSS)
261
+ .foo.bar, ns|*.bar {
262
+ a: b; }
263
+ CSS
264
+ .foo.bar {a: b}
265
+ ns|* {@extend .foo}
266
+ SCSS
267
+ end
268
+
269
+ def test_universal_unification_with_namespaceless_universal_target
270
+ assert_equal <<CSS, render(<<SCSS)
271
+ * {
272
+ a: b; }
273
+ CSS
274
+ *.foo {a: b}
275
+ * {@extend .foo}
276
+ SCSS
277
+
278
+ assert_equal <<CSS, render(<<SCSS)
279
+ * {
280
+ a: b; }
281
+ CSS
282
+ *.foo {a: b}
283
+ *|* {@extend .foo}
284
+ SCSS
285
+
286
+ assert_equal <<CSS, render(<<SCSS)
287
+ *|*.foo, * {
288
+ a: b; }
289
+ CSS
290
+ *|*.foo {a: b}
291
+ * {@extend .foo}
292
+ SCSS
293
+
294
+ assert_equal <<CSS, render(<<SCSS)
295
+ *|* {
296
+ a: b; }
297
+ CSS
298
+ *|*.foo {a: b}
299
+ *|* {@extend .foo}
300
+ SCSS
301
+
302
+ assert_equal <<CSS, render(<<SCSS)
303
+ *.foo, ns|* {
304
+ a: b; }
305
+ CSS
306
+ *.foo {a: b}
307
+ ns|* {@extend .foo}
308
+ SCSS
309
+
310
+ assert_equal <<CSS, render(<<SCSS)
311
+ *|*.foo, ns|* {
312
+ a: b; }
313
+ CSS
314
+ *|*.foo {a: b}
315
+ ns|* {@extend .foo}
316
+ SCSS
317
+ end
318
+
319
+ def test_universal_unification_with_namespaced_universal_target
320
+ assert_equal <<CSS, render(<<SCSS)
321
+ ns|* {
322
+ a: b; }
323
+ CSS
324
+ ns|*.foo {a: b}
325
+ * {@extend .foo}
326
+ SCSS
327
+
328
+ assert_equal <<CSS, render(<<SCSS)
329
+ ns|* {
330
+ a: b; }
331
+ CSS
332
+ ns|*.foo {a: b}
333
+ *|* {@extend .foo}
334
+ SCSS
335
+
336
+ assert_equal <<CSS, render(<<SCSS)
337
+ ns1|*.foo {
338
+ a: b; }
339
+ CSS
340
+ ns1|*.foo {a: b}
341
+ ns2|* {@extend .foo}
342
+ SCSS
343
+
344
+ assert_equal <<CSS, render(<<SCSS)
345
+ ns|* {
346
+ a: b; }
347
+ CSS
348
+ ns|*.foo {a: b}
349
+ ns|* {@extend .foo}
350
+ SCSS
351
+ end
352
+
353
+ def test_universal_unification_with_namespaceless_element_target
354
+ assert_equal <<CSS, render(<<SCSS)
355
+ a {
356
+ a: b; }
357
+ CSS
358
+ a.foo {a: b}
359
+ * {@extend .foo}
360
+ SCSS
361
+
362
+ assert_equal <<CSS, render(<<SCSS)
363
+ a {
364
+ a: b; }
365
+ CSS
366
+ a.foo {a: b}
367
+ *|* {@extend .foo}
368
+ SCSS
369
+
370
+ assert_equal <<CSS, render(<<SCSS)
371
+ *|a.foo, a {
372
+ a: b; }
373
+ CSS
374
+ *|a.foo {a: b}
375
+ * {@extend .foo}
376
+ SCSS
377
+
378
+ assert_equal <<CSS, render(<<SCSS)
379
+ *|a {
380
+ a: b; }
381
+ CSS
382
+ *|a.foo {a: b}
383
+ *|* {@extend .foo}
384
+ SCSS
385
+
386
+ assert_equal <<CSS, render(<<SCSS)
387
+ a.foo, ns|a {
388
+ a: b; }
389
+ CSS
390
+ a.foo {a: b}
391
+ ns|* {@extend .foo}
392
+ SCSS
393
+
394
+ assert_equal <<CSS, render(<<SCSS)
395
+ *|a.foo, ns|a {
396
+ a: b; }
397
+ CSS
398
+ *|a.foo {a: b}
399
+ ns|* {@extend .foo}
400
+ SCSS
401
+ end
402
+
403
+ def test_universal_unification_with_namespaced_element_target
404
+ assert_equal <<CSS, render(<<SCSS)
405
+ ns|a {
406
+ a: b; }
407
+ CSS
408
+ ns|a.foo {a: b}
409
+ * {@extend .foo}
410
+ SCSS
411
+
412
+ assert_equal <<CSS, render(<<SCSS)
413
+ ns|a {
414
+ a: b; }
415
+ CSS
416
+ ns|a.foo {a: b}
417
+ *|* {@extend .foo}
418
+ SCSS
419
+
420
+ assert_equal <<CSS, render(<<SCSS)
421
+ ns1|a.foo {
422
+ a: b; }
423
+ CSS
424
+ ns1|a.foo {a: b}
425
+ ns2|* {@extend .foo}
426
+ SCSS
427
+
428
+ assert_equal <<CSS, render(<<SCSS)
429
+ ns|a {
430
+ a: b; }
431
+ CSS
432
+ ns|a.foo {a: b}
433
+ ns|* {@extend .foo}
434
+ SCSS
435
+ end
436
+
437
+ def test_element_unification_with_simple_target
438
+ assert_equal <<CSS, render(<<SCSS)
439
+ .foo, a {
440
+ a: b; }
441
+ CSS
442
+ .foo {a: b}
443
+ a {@extend .foo}
444
+ SCSS
445
+
446
+ assert_equal <<CSS, render(<<SCSS)
447
+ .foo.bar, a.bar {
448
+ a: b; }
449
+ CSS
450
+ .foo.bar {a: b}
451
+ a {@extend .foo}
452
+ SCSS
453
+
454
+ assert_equal <<CSS, render(<<SCSS)
455
+ .foo.bar, *|a.bar {
456
+ a: b; }
457
+ CSS
458
+ .foo.bar {a: b}
459
+ *|a {@extend .foo}
460
+ SCSS
461
+
462
+ assert_equal <<CSS, render(<<SCSS)
463
+ .foo.bar, ns|a.bar {
464
+ a: b; }
465
+ CSS
466
+ .foo.bar {a: b}
467
+ ns|a {@extend .foo}
468
+ SCSS
469
+ end
470
+
471
+ def test_element_unification_with_namespaceless_universal_target
472
+ assert_equal <<CSS, render(<<SCSS)
473
+ *.foo, a {
474
+ a: b; }
475
+ CSS
476
+ *.foo {a: b}
477
+ a {@extend .foo}
478
+ SCSS
479
+
480
+ assert_equal <<CSS, render(<<SCSS)
481
+ *.foo, a {
482
+ a: b; }
483
+ CSS
484
+ *.foo {a: b}
485
+ *|a {@extend .foo}
486
+ SCSS
487
+
488
+ assert_equal <<CSS, render(<<SCSS)
489
+ *|*.foo, a {
490
+ a: b; }
491
+ CSS
492
+ *|*.foo {a: b}
493
+ a {@extend .foo}
494
+ SCSS
495
+
496
+ assert_equal <<CSS, render(<<SCSS)
497
+ *|*.foo, *|a {
498
+ a: b; }
499
+ CSS
500
+ *|*.foo {a: b}
501
+ *|a {@extend .foo}
502
+ SCSS
503
+
504
+ assert_equal <<CSS, render(<<SCSS)
505
+ *.foo, ns|a {
506
+ a: b; }
507
+ CSS
508
+ *.foo {a: b}
509
+ ns|a {@extend .foo}
510
+ SCSS
511
+
512
+ assert_equal <<CSS, render(<<SCSS)
513
+ *|*.foo, ns|a {
514
+ a: b; }
515
+ CSS
516
+ *|*.foo {a: b}
517
+ ns|a {@extend .foo}
518
+ SCSS
519
+ end
520
+
521
+ def test_element_unification_with_namespaced_universal_target
522
+ assert_equal <<CSS, render(<<SCSS)
523
+ ns|*.foo, ns|a {
524
+ a: b; }
525
+ CSS
526
+ ns|*.foo {a: b}
527
+ a {@extend .foo}
528
+ SCSS
529
+
530
+ assert_equal <<CSS, render(<<SCSS)
531
+ ns|*.foo, ns|a {
532
+ a: b; }
533
+ CSS
534
+ ns|*.foo {a: b}
535
+ *|a {@extend .foo}
536
+ SCSS
537
+
538
+ assert_equal <<CSS, render(<<SCSS)
539
+ ns1|*.foo {
540
+ a: b; }
541
+ CSS
542
+ ns1|*.foo {a: b}
543
+ ns2|a {@extend .foo}
544
+ SCSS
545
+
546
+ assert_equal <<CSS, render(<<SCSS)
547
+ ns|*.foo, ns|a {
548
+ a: b; }
549
+ CSS
550
+ ns|*.foo {a: b}
551
+ ns|a {@extend .foo}
552
+ SCSS
553
+ end
554
+
555
+ def test_element_unification_with_namespaceless_element_target
556
+ assert_equal <<CSS, render(<<SCSS)
557
+ a {
558
+ a: b; }
559
+ CSS
560
+ a.foo {a: b}
561
+ a {@extend .foo}
562
+ SCSS
563
+
564
+ assert_equal <<CSS, render(<<SCSS)
565
+ a {
566
+ a: b; }
567
+ CSS
568
+ a.foo {a: b}
569
+ *|a {@extend .foo}
570
+ SCSS
571
+
572
+ assert_equal <<CSS, render(<<SCSS)
573
+ *|a.foo, a {
574
+ a: b; }
575
+ CSS
576
+ *|a.foo {a: b}
577
+ a {@extend .foo}
578
+ SCSS
579
+
580
+ assert_equal <<CSS, render(<<SCSS)
581
+ *|a {
582
+ a: b; }
583
+ CSS
584
+ *|a.foo {a: b}
585
+ *|a {@extend .foo}
586
+ SCSS
587
+
588
+ assert_equal <<CSS, render(<<SCSS)
589
+ a.foo, ns|a {
590
+ a: b; }
591
+ CSS
592
+ a.foo {a: b}
593
+ ns|a {@extend .foo}
594
+ SCSS
595
+
596
+ assert_equal <<CSS, render(<<SCSS)
597
+ *|a.foo, ns|a {
598
+ a: b; }
599
+ CSS
600
+ *|a.foo {a: b}
601
+ ns|a {@extend .foo}
602
+ SCSS
603
+
604
+ assert_equal <<CSS, render(<<SCSS)
605
+ a.foo {
606
+ a: b; }
607
+ CSS
608
+ a.foo {a: b}
609
+ h1 {@extend .foo}
610
+ SCSS
611
+ end
612
+
613
+ def test_element_unification_with_namespaced_element_target
614
+ assert_equal <<CSS, render(<<SCSS)
615
+ ns|a {
616
+ a: b; }
617
+ CSS
618
+ ns|a.foo {a: b}
619
+ a {@extend .foo}
620
+ SCSS
621
+
622
+ assert_equal <<CSS, render(<<SCSS)
623
+ ns|a {
624
+ a: b; }
625
+ CSS
626
+ ns|a.foo {a: b}
627
+ *|a {@extend .foo}
628
+ SCSS
629
+
630
+ assert_equal <<CSS, render(<<SCSS)
631
+ ns1|a.foo {
632
+ a: b; }
633
+ CSS
634
+ ns1|a.foo {a: b}
635
+ ns2|a {@extend .foo}
636
+ SCSS
637
+
638
+ assert_equal <<CSS, render(<<SCSS)
639
+ ns|a {
640
+ a: b; }
641
+ CSS
642
+ ns|a.foo {a: b}
643
+ ns|a {@extend .foo}
644
+ SCSS
645
+ end
646
+
647
+ def test_attribute_unification
648
+ assert_equal <<CSS, render(<<SCSS)
649
+ [foo=bar].baz, [foo=bar][foo=baz] {
650
+ a: b; }
651
+ CSS
652
+ [foo=bar].baz {a: b}
653
+ [foo=baz] {@extend .baz}
654
+ SCSS
655
+
656
+ assert_equal <<CSS, render(<<SCSS)
657
+ [foo=bar].baz, [foo=bar][foo^=bar] {
658
+ a: b; }
659
+ CSS
660
+ [foo=bar].baz {a: b}
661
+ [foo^=bar] {@extend .baz}
662
+ SCSS
663
+
664
+ assert_equal <<CSS, render(<<SCSS)
665
+ [foo=bar].baz, [foo=bar][foot=bar] {
666
+ a: b; }
667
+ CSS
668
+ [foo=bar].baz {a: b}
669
+ [foot=bar] {@extend .baz}
670
+ SCSS
671
+
672
+ assert_equal <<CSS, render(<<SCSS)
673
+ [foo=bar].baz, [foo=bar][ns|foo=bar] {
674
+ a: b; }
675
+ CSS
676
+ [foo=bar].baz {a: b}
677
+ [ns|foo=bar] {@extend .baz}
678
+ SCSS
679
+
680
+ assert_equal <<CSS, render(<<SCSS)
681
+ [foo=bar] {
682
+ a: b; }
683
+ CSS
684
+ [foo=bar].baz {a: b}
685
+ [foo=bar] {@extend .baz}
686
+ SCSS
687
+ end
688
+
689
+ def test_pseudo_unification
690
+ assert_equal <<CSS, render(<<SCSS)
691
+ :foo.baz, :foo:foo(2n+1) {
692
+ a: b; }
693
+ CSS
694
+ :foo.baz {a: b}
695
+ :foo(2n+1) {@extend .baz}
696
+ SCSS
697
+
698
+ assert_equal <<CSS, render(<<SCSS)
699
+ :foo.baz, :foo::foo {
700
+ a: b; }
701
+ CSS
702
+ :foo.baz {a: b}
703
+ ::foo {@extend .baz}
704
+ SCSS
705
+
706
+ assert_equal <<CSS, render(<<SCSS)
707
+ ::foo.baz {
708
+ a: b; }
709
+ CSS
710
+ ::foo.baz {a: b}
711
+ ::bar {@extend .baz}
712
+ SCSS
713
+
714
+ assert_equal <<CSS, render(<<SCSS)
715
+ ::foo.baz {
716
+ a: b; }
717
+ CSS
718
+ ::foo.baz {a: b}
719
+ ::foo(2n+1) {@extend .baz}
720
+ SCSS
721
+
722
+ assert_equal <<CSS, render(<<SCSS)
723
+ ::foo {
724
+ a: b; }
725
+ CSS
726
+ ::foo.baz {a: b}
727
+ ::foo {@extend .baz}
728
+ SCSS
729
+
730
+ assert_equal <<CSS, render(<<SCSS)
731
+ ::foo(2n+1) {
732
+ a: b; }
733
+ CSS
734
+ ::foo(2n+1).baz {a: b}
735
+ ::foo(2n+1) {@extend .baz}
736
+ SCSS
737
+
738
+ assert_equal <<CSS, render(<<SCSS)
739
+ :foo.baz, :foo:bar {
740
+ a: b; }
741
+ CSS
742
+ :foo.baz {a: b}
743
+ :bar {@extend .baz}
744
+ SCSS
745
+
746
+ assert_equal <<CSS, render(<<SCSS)
747
+ :foo {
748
+ a: b; }
749
+ CSS
750
+ :foo.baz {a: b}
751
+ :foo {@extend .baz}
752
+ SCSS
753
+ end
754
+
755
+ def test_pseudoelement_remains_at_end_of_selector
756
+ assert_equal <<CSS, render(<<SCSS)
757
+ .foo::bar, .baz::bar {
758
+ a: b; }
759
+ CSS
760
+ .foo::bar {a: b}
761
+ .baz {@extend .foo}
762
+ SCSS
763
+
764
+ assert_equal <<CSS, render(<<SCSS)
765
+ a.foo::bar, a.baz::bar {
766
+ a: b; }
767
+ CSS
768
+ a.foo::bar {a: b}
769
+ .baz {@extend .foo}
770
+ SCSS
771
+ end
772
+
773
+ def test_pseudoclass_remains_at_end_of_selector
774
+ assert_equal <<CSS, render(<<SCSS)
775
+ .foo:bar, .baz:bar {
776
+ a: b; }
777
+ CSS
778
+ .foo:bar {a: b}
779
+ .baz {@extend .foo}
780
+ SCSS
781
+
782
+ assert_equal <<CSS, render(<<SCSS)
783
+ a.foo:bar, a.baz:bar {
784
+ a: b; }
785
+ CSS
786
+ a.foo:bar {a: b}
787
+ .baz {@extend .foo}
788
+ SCSS
789
+ end
790
+
791
+ def test_not_remains_at_end_of_selector
792
+ assert_equal <<CSS, render(<<SCSS)
793
+ .foo:not(.bar), .baz:not(.bar) {
794
+ a: b; }
795
+ CSS
796
+ .foo:not(.bar) {a: b}
797
+ .baz {@extend .foo}
798
+ SCSS
799
+ end
800
+
801
+ def test_pseudoelement_goes_lefter_than_pseudoclass
802
+ assert_equal <<CSS, render(<<SCSS)
803
+ .foo::bar, .baz:bang::bar {
804
+ a: b; }
805
+ CSS
806
+ .foo::bar {a: b}
807
+ .baz:bang {@extend .foo}
808
+ SCSS
809
+
810
+ assert_equal <<CSS, render(<<SCSS)
811
+ .foo:bar, .baz:bar::bang {
812
+ a: b; }
813
+ CSS
814
+ .foo:bar {a: b}
815
+ .baz::bang {@extend .foo}
816
+ SCSS
817
+ end
818
+
819
+ def test_pseudoelement_goes_lefter_than_not
820
+ assert_equal <<CSS, render(<<SCSS)
821
+ .foo::bar, .baz:not(.bang)::bar {
822
+ a: b; }
823
+ CSS
824
+ .foo::bar {a: b}
825
+ .baz:not(.bang) {@extend .foo}
826
+ SCSS
827
+
828
+ assert_equal <<CSS, render(<<SCSS)
829
+ .foo:not(.bang), .baz:not(.bang)::bar {
830
+ a: b; }
831
+ CSS
832
+ .foo:not(.bang) {a: b}
833
+ .baz::bar {@extend .foo}
834
+ SCSS
835
+ end
836
+
837
+ def test_negation_unification
838
+ assert_equal <<CSS, render(<<SCSS)
839
+ :not(.foo).baz, :not(.foo):not(.bar) {
840
+ a: b; }
841
+ CSS
842
+ :not(.foo).baz {a: b}
843
+ :not(.bar) {@extend .baz}
844
+ SCSS
845
+
846
+ assert_equal <<CSS, render(<<SCSS)
847
+ :not(.foo) {
848
+ a: b; }
849
+ CSS
850
+ :not(.foo).baz {a: b}
851
+ :not(.foo) {@extend .baz}
852
+ SCSS
853
+
854
+ assert_equal <<CSS, render(<<SCSS)
855
+ :not([a=b]) {
856
+ a: b; }
857
+ CSS
858
+ :not([a=b]).baz {a: b}
859
+ :not([a = b]) {@extend .baz}
860
+ SCSS
861
+ end
862
+
863
+ ## Long Extendees
864
+
865
+ def test_long_extendee
866
+ assert_equal <<CSS, render(<<SCSS)
867
+ .foo.bar, .baz {
868
+ a: b; }
869
+ CSS
870
+ .foo.bar {a: b}
871
+ .baz {@extend .foo.bar}
872
+ SCSS
873
+ end
874
+
875
+ def test_long_extendee_requires_all_selectors
876
+ assert_equal <<CSS, render(<<SCSS)
877
+ .foo {
878
+ a: b; }
879
+ CSS
880
+ .foo {a: b}
881
+ .baz {@extend .foo.bar}
882
+ SCSS
883
+ end
884
+
885
+ def test_long_extendee_matches_supersets
886
+ assert_equal <<CSS, render(<<SCSS)
887
+ .foo.bar.bap, .bap.baz {
888
+ a: b; }
889
+ CSS
890
+ .foo.bar.bap {a: b}
891
+ .baz {@extend .foo.bar}
892
+ SCSS
893
+ end
894
+
895
+ def test_long_extendee_runs_unification
896
+ assert_equal <<CSS, render(<<SCSS)
897
+ ns|*.foo.bar, ns|a.baz {
898
+ a: b; }
899
+ CSS
900
+ ns|*.foo.bar {a: b}
901
+ a.baz {@extend .foo.bar}
902
+ SCSS
903
+ end
904
+
905
+ ## Long Extenders
906
+
907
+ def test_long_extender
908
+ assert_equal <<CSS, render(<<SCSS)
909
+ .foo.bar, .bar.baz.bang {
910
+ a: b; }
911
+ CSS
912
+ .foo.bar {a: b}
913
+ .baz.bang {@extend .foo}
914
+ SCSS
915
+ end
916
+
917
+ def test_long_extender_runs_unification
918
+ assert_equal <<CSS, render(<<SCSS)
919
+ ns|*.foo.bar, ns|a.bar.baz {
920
+ a: b; }
921
+ CSS
922
+ ns|*.foo.bar {a: b}
923
+ a.baz {@extend .foo}
924
+ SCSS
925
+ end
926
+
927
+ def test_long_extender_aborts_unification
928
+ assert_equal <<CSS, render(<<SCSS)
929
+ a.foo#bar {
930
+ a: b; }
931
+ CSS
932
+ a.foo#bar {a: b}
933
+ h1.baz {@extend .foo}
934
+ SCSS
935
+
936
+ assert_equal <<CSS, render(<<SCSS)
937
+ a.foo#bar {
938
+ a: b; }
939
+ CSS
940
+ a.foo#bar {a: b}
941
+ .bang#baz {@extend .foo}
942
+ SCSS
943
+ end
944
+
945
+ ## Nested Extenders
946
+
947
+ def test_nested_extender
948
+ assert_equal <<CSS, render(<<SCSS)
949
+ .foo, foo bar {
950
+ a: b; }
951
+ CSS
952
+ .foo {a: b}
953
+ foo bar {@extend .foo}
954
+ SCSS
955
+ end
956
+
957
+ def test_nested_extender_runs_unification
958
+ assert_equal <<CSS, render(<<SCSS)
959
+ .foo.bar, foo bar.bar {
960
+ a: b; }
961
+ CSS
962
+ .foo.bar {a: b}
963
+ foo bar {@extend .foo}
964
+ SCSS
965
+ end
966
+
967
+ def test_nested_extender_aborts_unification
968
+ assert_equal <<CSS, render(<<SCSS)
969
+ baz.foo {
970
+ a: b; }
971
+ CSS
972
+ baz.foo {a: b}
973
+ foo bar {@extend .foo}
974
+ SCSS
975
+ end
976
+
977
+ def test_nested_extender_alternates_parents
978
+ assert_equal <<CSS, render(<<SCSS)
979
+ .baz .bip .foo, .baz .bip foo .grank bar, foo .grank .baz .bip bar {
980
+ a: b; }
981
+ CSS
982
+ .baz .bip .foo {a: b}
983
+ foo .grank bar {@extend .foo}
984
+ SCSS
985
+ end
986
+
987
+ def test_nested_extender_unifies_identical_parents
988
+ assert_equal <<CSS, render(<<SCSS)
989
+ .baz .bip .foo, .baz .bip bar {
990
+ a: b; }
991
+ CSS
992
+ .baz .bip .foo {a: b}
993
+ .baz .bip bar {@extend .foo}
994
+ SCSS
995
+ end
996
+
997
+ def test_nested_extender_unifies_common_substring
998
+ assert_equal <<CSS, render(<<SCSS)
999
+ .baz .bip .bap .bink .foo, .baz .brat .bip .bap .bink bar, .brat .baz .bip .bap .bink bar {
1000
+ a: b; }
1001
+ CSS
1002
+ .baz .bip .bap .bink .foo {a: b}
1003
+ .brat .bip .bap bar {@extend .foo}
1004
+ SCSS
1005
+ end
1006
+
1007
+ def test_nested_extender_unifies_common_subseq
1008
+ assert_equal <<CSS, render(<<SCSS)
1009
+ .a .x .b .y .foo, .a .x .n .b .y .m bar, .a .n .x .b .y .m bar, .a .x .n .b .m .y bar, .a .n .x .b .m .y bar {
1010
+ a: b; }
1011
+ CSS
1012
+ .a .x .b .y .foo {a: b}
1013
+ .a .n .b .m bar {@extend .foo}
1014
+ SCSS
1015
+ end
1016
+
1017
+ def test_nested_extender_chooses_first_subseq
1018
+ assert_equal <<CSS, render(<<SCSS)
1019
+ .a .b .c .d .foo, .a .b .c .d .a .b .bar {
1020
+ a: b; }
1021
+ CSS
1022
+ .a .b .c .d .foo {a: b}
1023
+ .c .d .a .b .bar {@extend .foo}
1024
+ SCSS
1025
+ end
1026
+
1027
+ def test_nested_extender_counts_extended_subselectors
1028
+ assert_equal <<CSS, render(<<SCSS)
1029
+ .a .bip.bop .foo, .a .b .bip.bop .bar, .b .a .bip.bop .bar {
1030
+ a: b; }
1031
+ CSS
1032
+ .a .bip.bop .foo {a: b}
1033
+ .b .bip .bar {@extend .foo}
1034
+ SCSS
1035
+ end
1036
+
1037
+ def test_nested_extender_counts_extended_superselectors
1038
+ assert_equal <<CSS, render(<<SCSS)
1039
+ .a .bip .foo, .a .b .bip.bop .bar, .b .a .bip.bop .bar {
1040
+ a: b; }
1041
+ CSS
1042
+ .a .bip .foo {a: b}
1043
+ .b .bip.bop .bar {@extend .foo}
1044
+ SCSS
1045
+ end
1046
+
1047
+ def test_nested_extender_with_child_selector
1048
+ assert_equal <<CSS, render(<<SCSS)
1049
+ .baz .foo, .baz foo > bar {
1050
+ a: b; }
1051
+ CSS
1052
+ .baz .foo {a: b}
1053
+ foo > bar {@extend .foo}
1054
+ SCSS
1055
+ end
1056
+
1057
+ def test_nested_extender_finds_common_selectors_around_child_selector
1058
+ assert_equal <<CSS, render(<<SCSS)
1059
+ a > b c .c1, a > b c .c2 {
1060
+ a: b; }
1061
+ CSS
1062
+ a > b c .c1 {a: b}
1063
+ a c .c2 {@extend .c1}
1064
+ SCSS
1065
+
1066
+ assert_equal <<CSS, render(<<SCSS)
1067
+ a > b c .c1, a > b c .c2 {
1068
+ a: b; }
1069
+ CSS
1070
+ a > b c .c1 {a: b}
1071
+ b c .c2 {@extend .c1}
1072
+ SCSS
1073
+ end
1074
+
1075
+ def test_nested_extender_doesnt_find_common_selectors_around_adjacent_sibling_selector
1076
+ assert_equal <<CSS, render(<<SCSS)
1077
+ a + b c .c1, a + b a c .c2, a a + b c .c2 {
1078
+ a: b; }
1079
+ CSS
1080
+ a + b c .c1 {a: b}
1081
+ a c .c2 {@extend .c1}
1082
+ SCSS
1083
+
1084
+ assert_equal <<CSS, render(<<SCSS)
1085
+ a + b c .c1, a a + b c .c2 {
1086
+ a: b; }
1087
+ CSS
1088
+ a + b c .c1 {a: b}
1089
+ a b .c2 {@extend .c1}
1090
+ SCSS
1091
+
1092
+ assert_equal <<CSS, render(<<SCSS)
1093
+ a + b c .c1, a + b c .c2 {
1094
+ a: b; }
1095
+ CSS
1096
+ a + b c .c1 {a: b}
1097
+ b c .c2 {@extend .c1}
1098
+ SCSS
1099
+ end
1100
+
1101
+ def test_nested_extender_doesnt_find_common_selectors_around_sibling_selector
1102
+ assert_equal <<CSS, render(<<SCSS)
1103
+ a ~ b c .c1, a ~ b a c .c2, a a ~ b c .c2 {
1104
+ a: b; }
1105
+ CSS
1106
+ a ~ b c .c1 {a: b}
1107
+ a c .c2 {@extend .c1}
1108
+ SCSS
1109
+
1110
+ assert_equal <<CSS, render(<<SCSS)
1111
+ a ~ b c .c1, a a ~ b c .c2 {
1112
+ a: b; }
1113
+ CSS
1114
+ a ~ b c .c1 {a: b}
1115
+ a b .c2 {@extend .c1}
1116
+ SCSS
1117
+
1118
+ assert_equal <<CSS, render(<<SCSS)
1119
+ a ~ b c .c1, a ~ b c .c2 {
1120
+ a: b; }
1121
+ CSS
1122
+ a ~ b c .c1 {a: b}
1123
+ b c .c2 {@extend .c1}
1124
+ SCSS
1125
+ end
1126
+
1127
+ def test_nested_extender_with_early_child_selectors_doesnt_subseq_them
1128
+ assert_equal <<CSS, render(<<SCSS)
1129
+ .bip > .bap .foo, .bip > .bap .grip > .bap .bar, .grip > .bap .bip > .bap .bar {
1130
+ a: b; }
1131
+ CSS
1132
+ .bip > .bap .foo {a: b}
1133
+ .grip > .bap .bar {@extend .foo}
1134
+ SCSS
1135
+
1136
+ assert_equal <<CSS, render(<<SCSS)
1137
+ .bap > .bip .foo, .bap > .bip .bap > .grip .bar, .bap > .grip .bap > .bip .bar {
1138
+ a: b; }
1139
+ CSS
1140
+ .bap > .bip .foo {a: b}
1141
+ .bap > .grip .bar {@extend .foo}
1142
+ SCSS
1143
+ end
1144
+
1145
+ def test_nested_extender_with_child_selector_unifies
1146
+ assert_equal <<CSS, render(<<SCSS)
1147
+ .baz.foo, foo > bar.baz {
1148
+ a: b; }
1149
+ CSS
1150
+ .baz.foo {a: b}
1151
+ foo > bar {@extend .foo}
1152
+ SCSS
1153
+ end
1154
+
1155
+ def test_nested_extender_with_trailing_child_selector
1156
+ assert_raise(Sass::SyntaxError, "bar > can't extend: invalid selector") do
1157
+ render("bar > {@extend .baz}")
1158
+ end
1159
+ end
1160
+
1161
+ def test_nested_extender_with_sibling_selector
1162
+ assert_equal <<CSS, render(<<SCSS)
1163
+ .baz .foo, .baz foo + bar {
1164
+ a: b; }
1165
+ CSS
1166
+ .baz .foo {a: b}
1167
+ foo + bar {@extend .foo}
1168
+ SCSS
1169
+ end
1170
+
1171
+ def test_nested_extender_with_hacky_selector
1172
+ assert_equal <<CSS, render(<<SCSS)
1173
+ .baz .foo, .baz foo + > > + bar {
1174
+ a: b; }
1175
+ CSS
1176
+ .baz .foo {a: b}
1177
+ foo + > > + bar {@extend .foo}
1178
+ SCSS
1179
+
1180
+ assert_equal <<CSS, render(<<SCSS)
1181
+ .baz .foo, .baz > > bar {
1182
+ a: b; }
1183
+ CSS
1184
+ .baz .foo {a: b}
1185
+ > > bar {@extend .foo}
1186
+ SCSS
1187
+ end
1188
+
1189
+ def test_nested_extender_merges_with_same_selector
1190
+ assert_equal <<CSS, render(<<SCSS)
1191
+ .foo .bar, .foo .baz {
1192
+ a: b; }
1193
+ CSS
1194
+ .foo {
1195
+ .bar {a: b}
1196
+ .baz {@extend .bar} }
1197
+ SCSS
1198
+ end
1199
+
1200
+ def test_nested_extender_with_child_selector_merges_with_same_selector
1201
+ assert_equal <<CSS, render(<<SCSS)
1202
+ .foo > .bar .baz, .foo > .bar .bang {
1203
+ a: b; }
1204
+ CSS
1205
+ .foo > .bar .baz {a: b}
1206
+ .foo > .bar .bang {@extend .baz}
1207
+ SCSS
1208
+ end
1209
+
1210
+ # Loops
1211
+
1212
+ def test_extend_self_loop
1213
+ assert_equal <<CSS, render(<<SCSS)
1214
+ .foo {
1215
+ a: b; }
1216
+ CSS
1217
+ .foo {a: b; @extend .foo}
1218
+ SCSS
1219
+ end
1220
+
1221
+ def test_basic_extend_loop
1222
+ assert_equal <<CSS, render(<<SCSS)
1223
+ .bar, .foo {
1224
+ a: b; }
1225
+
1226
+ .foo, .bar {
1227
+ c: d; }
1228
+ CSS
1229
+ .foo {a: b; @extend .bar}
1230
+ .bar {c: d; @extend .foo}
1231
+ SCSS
1232
+ end
1233
+
1234
+ def test_three_level_extend_loop
1235
+ assert_equal <<CSS, render(<<SCSS)
1236
+ .baz, .bar, .foo {
1237
+ a: b; }
1238
+
1239
+ .foo, .baz, .bar {
1240
+ c: d; }
1241
+
1242
+ .bar, .foo, .baz {
1243
+ e: f; }
1244
+ CSS
1245
+ .foo {a: b; @extend .bar}
1246
+ .bar {c: d; @extend .baz}
1247
+ .baz {e: f; @extend .foo}
1248
+ SCSS
1249
+ end
1250
+
1251
+ def test_nested_extend_loop
1252
+ assert_equal <<CSS, render(<<SCSS)
1253
+ .bar, .bar .foo {
1254
+ a: b; }
1255
+ .bar .foo, .bar .foo .foo {
1256
+ c: d; }
1257
+ CSS
1258
+ .bar {
1259
+ a: b;
1260
+ .foo {c: d; @extend .bar}
1261
+ }
1262
+ SCSS
1263
+ end
1264
+
1265
+ def test_multiple_extender_merges_with_superset_selector
1266
+ assert_equal <<CSS, render(<<SCSS)
1267
+ a.bar.baz, a.foo {
1268
+ a: b; }
1269
+ CSS
1270
+ .foo {@extend .bar; @extend .baz}
1271
+ a.bar.baz {a: b}
1272
+ SCSS
1273
+ end
1274
+
1275
+ def test_control_flow_if
1276
+ assert_equal <<CSS, render(<<SCSS)
1277
+ .true, .also-true {
1278
+ color: green; }
1279
+
1280
+ .false, .also-false {
1281
+ color: red; }
1282
+ CSS
1283
+ .true { color: green; }
1284
+ .false { color: red; }
1285
+ .also-true {
1286
+ @if true { @extend .true; }
1287
+ @else { @extend .false; }
1288
+ }
1289
+ .also-false {
1290
+ @if false { @extend .true; }
1291
+ @else { @extend .false; }
1292
+ }
1293
+ SCSS
1294
+ end
1295
+
1296
+ def test_control_flow_for
1297
+ assert_equal <<CSS, render(<<SCSS)
1298
+ .base-0, .added {
1299
+ color: green; }
1300
+
1301
+ .base-1, .added {
1302
+ display: block; }
1303
+
1304
+ .base-2, .added {
1305
+ border: 1px solid blue; }
1306
+ CSS
1307
+ .base-0 { color: green; }
1308
+ .base-1 { display: block; }
1309
+ .base-2 { border: 1px solid blue; }
1310
+ .added {
1311
+ @for $i from 0 to 3 {
1312
+ @extend .base-\#{$i};
1313
+ }
1314
+ }
1315
+ SCSS
1316
+ end
1317
+
1318
+ def test_control_flow_while
1319
+ assert_equal <<CSS, render(<<SCSS)
1320
+ .base-0, .added {
1321
+ color: green; }
1322
+
1323
+ .base-1, .added {
1324
+ display: block; }
1325
+
1326
+ .base-2, .added {
1327
+ border: 1px solid blue; }
1328
+ CSS
1329
+ .base-0 { color: green; }
1330
+ .base-1 { display: block; }
1331
+ .base-2 { border: 1px solid blue; }
1332
+ .added {
1333
+ $i : 0;
1334
+ @while $i < 3 {
1335
+ @extend .base-\#{$i};
1336
+ $i : $i + 1;
1337
+ }
1338
+ }
1339
+ SCSS
1340
+ end
1341
+
1342
+ private
1343
+
1344
+ def render(sass, options = {})
1345
+ munge_filename options
1346
+ Sass::Engine.new(sass, {:syntax => :scss}.merge(options)).render
1347
+ end
1348
+ end