haml 3.2.0.alpha.10 → 3.2.0.alpha.13
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of haml might be problematic. Click here for more details.
- data/.yardopts +19 -7
- data/CHANGELOG.md +1224 -0
- data/FAQ.md +157 -0
- data/README.md +99 -62
- data/REFERENCE.md +1404 -0
- data/Rakefile +52 -341
- data/init.rb +1 -18
- data/lib/haml.rb +6 -30
- data/lib/haml/buffer.rb +37 -16
- data/lib/haml/compiler.rb +52 -13
- data/lib/haml/engine.rb +61 -44
- data/lib/haml/exec.rb +21 -4
- data/lib/haml/filters.rb +136 -166
- data/lib/haml/helpers.rb +37 -10
- data/lib/haml/helpers/action_view_extensions.rb +2 -1
- data/lib/haml/helpers/action_view_mods.rb +67 -181
- data/lib/haml/helpers/rails_323_textarea_fix.rb +39 -0
- data/lib/haml/helpers/xss_mods.rb +9 -11
- data/lib/haml/html.rb +22 -9
- data/lib/haml/html/erb.rb +1 -1
- data/lib/haml/parser.rb +22 -15
- data/lib/haml/railtie.rb +2 -13
- data/lib/haml/template.rb +18 -85
- data/lib/haml/template/options.rb +1 -1
- data/lib/haml/template/plugin.rb +15 -101
- data/lib/haml/util.rb +120 -603
- data/lib/haml/version.rb +1 -107
- data/test/{haml/engine_test.rb → engine_test.rb} +137 -143
- data/test/{haml/erb → erb}/_av_partial_1.erb +1 -1
- data/test/{haml/erb → erb}/_av_partial_2.erb +1 -1
- data/test/{haml/erb → erb}/action_view.erb +1 -1
- data/test/{haml/erb → erb}/standard.erb +0 -0
- data/test/filters_test.rb +141 -0
- data/test/gemfiles/Gemfile.rails-3.0.x +4 -6
- data/test/gemfiles/Gemfile.rails-3.1.x +5 -6
- data/test/gemfiles/Gemfile.rails-3.2.x +6 -0
- data/test/haml-spec/LICENSE +14 -0
- data/test/{haml/spec → haml-spec}/README.md +26 -17
- data/test/haml-spec/lua_haml_spec.lua +38 -0
- data/test/haml-spec/perl_haml_test.pl +81 -0
- data/test/haml-spec/ruby_haml_test.rb +23 -0
- data/test/{haml/spec → haml-spec}/tests.json +132 -54
- data/test/{haml/helper_test.rb → helper_test.rb} +50 -36
- data/test/{haml/html2haml → html2haml}/erb_tests.rb +0 -0
- data/test/{haml/html2haml_test.rb → html2haml_test.rb} +11 -5
- data/test/{haml/markaby → markaby}/standard.mab +0 -0
- data/test/{haml/mocks → mocks}/article.rb +0 -0
- data/test/{haml/results → results}/content_for_layout.xhtml +0 -0
- data/test/{haml/results → results}/eval_suppressed.xhtml +0 -0
- data/test/{haml/results → results}/helpers.xhtml +0 -0
- data/test/{haml/results → results}/helpful.xhtml +0 -0
- data/test/{haml/results → results}/just_stuff.xhtml +0 -0
- data/test/{haml/results → results}/list.xhtml +0 -0
- data/test/{haml/results → results}/nuke_inner_whitespace.xhtml +0 -0
- data/test/{haml/results → results}/nuke_outer_whitespace.xhtml +0 -0
- data/test/{haml/results → results}/original_engine.xhtml +0 -0
- data/test/{haml/results → results}/partial_layout.xhtml +0 -0
- data/test/{haml/results → results}/partials.xhtml +0 -0
- data/test/{haml/results → results}/render_layout.xhtml +0 -0
- data/test/{haml/results → results}/silent_script.xhtml +1 -1
- data/test/{haml/results → results}/standard.xhtml +0 -0
- data/test/{haml/results → results}/tag_parsing.xhtml +0 -0
- data/test/{haml/results → results}/very_basic.xhtml +0 -0
- data/test/{haml/results → results}/whitespace_handling.xhtml +46 -50
- data/test/{haml/template_test.rb → template_test.rb} +20 -81
- data/test/{haml/templates → templates}/_av_partial_1.haml +1 -1
- data/test/{haml/templates → templates}/_av_partial_1_ugly.haml +1 -1
- data/test/{haml/templates → templates}/_av_partial_2.haml +1 -1
- data/test/{haml/templates → templates}/_av_partial_2_ugly.haml +1 -1
- data/test/{haml/templates → templates}/_layout.erb +0 -0
- data/test/{haml/templates → templates}/_layout_for_partial.haml +0 -0
- data/test/{haml/templates → templates}/_partial.haml +0 -0
- data/test/{haml/templates → templates}/_text_area.haml +0 -0
- data/test/{haml/templates → templates}/action_view.haml +1 -1
- data/test/{haml/templates → templates}/action_view_ugly.haml +1 -1
- data/test/{haml/templates → templates}/breakage.haml +0 -0
- data/test/{haml/templates → templates}/content_for_layout.haml +0 -0
- data/test/{haml/templates → templates}/eval_suppressed.haml +0 -0
- data/test/{haml/templates → templates}/helpers.haml +0 -0
- data/test/{haml/templates → templates}/helpful.haml +0 -0
- data/test/{haml/templates → templates}/just_stuff.haml +0 -0
- data/test/{haml/templates → templates}/list.haml +0 -0
- data/test/{haml/templates → templates}/nuke_inner_whitespace.haml +0 -0
- data/test/{haml/templates → templates}/nuke_outer_whitespace.haml +0 -0
- data/test/{haml/templates → templates}/original_engine.haml +0 -0
- data/test/templates/partial_layout.haml +3 -0
- data/test/{haml/templates → templates}/partialize.haml +0 -0
- data/test/{haml/templates → templates}/partials.haml +0 -0
- data/test/{haml/templates → templates}/render_layout.haml +0 -0
- data/test/{haml/templates → templates}/silent_script.haml +2 -2
- data/test/{haml/templates → templates}/standard.haml +0 -0
- data/test/{haml/templates → templates}/standard_ugly.haml +0 -0
- data/test/{haml/templates → templates}/tag_parsing.haml +0 -0
- data/test/{haml/templates → templates}/very_basic.haml +0 -0
- data/test/{haml/templates → templates}/whitespace_handling.haml +0 -0
- data/test/test_helper.rb +42 -34
- data/test/util_test.rb +80 -0
- metadata +259 -427
- data/CONTRIBUTING +0 -3
- data/REVISION +0 -1
- data/VERSION +0 -1
- data/VERSION_NAME +0 -1
- data/extra/update_watch.rb +0 -13
- data/lib/haml/root.rb +0 -7
- data/lib/haml/shared.rb +0 -78
- data/lib/haml/template/patch.rb +0 -58
- data/lib/sass.rb +0 -8
- data/lib/sass/plugin.rb +0 -10
- data/lib/sass/rails2_shim.rb +0 -9
- data/lib/sass/rails3_shim.rb +0 -16
- data/test/benchmark.rb +0 -91
- data/test/gemfiles/Gemfile.rails-2.0.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.0.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.1.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.1.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.2.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.2.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.3.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.3.x.lock +0 -40
- data/test/gemfiles/Gemfile.rails-3.0.x.lock +0 -85
- data/test/gemfiles/Gemfile.rails-3.1.x.lock +0 -98
- data/test/gemfiles/Gemfile.rails-xss-2.3.x +0 -9
- data/test/gemfiles/Gemfile.rails-xss-2.3.x.lock +0 -42
- data/test/haml/results/filters.xhtml +0 -62
- data/test/haml/spec/lua_haml_spec.lua +0 -30
- data/test/haml/spec/ruby_haml_test.rb +0 -19
- data/test/haml/spec_test.rb +0 -44
- data/test/haml/templates/filters.haml +0 -66
- data/test/haml/templates/partial_layout.haml +0 -10
- data/test/haml/util_test.rb +0 -300
- data/test/linked_rails.rb +0 -42
- data/vendor/sass/CONTRIBUTING +0 -3
- data/vendor/sass/MIT-LICENSE +0 -20
- data/vendor/sass/README.md +0 -201
- data/vendor/sass/Rakefile +0 -339
- data/vendor/sass/TODO +0 -39
- data/vendor/sass/VERSION +0 -1
- data/vendor/sass/VERSION_NAME +0 -1
- data/vendor/sass/bin/sass +0 -8
- data/vendor/sass/bin/sass-convert +0 -7
- data/vendor/sass/bin/scss +0 -8
- data/vendor/sass/doc-src/FAQ.md +0 -35
- data/vendor/sass/doc-src/INDENTED_SYNTAX.md +0 -210
- data/vendor/sass/doc-src/SASS_CHANGELOG.md +0 -2327
- data/vendor/sass/doc-src/SASS_REFERENCE.md +0 -1965
- data/vendor/sass/doc-src/SCSS_FOR_SASS_USERS.md +0 -155
- data/vendor/sass/ext/extconf.rb +0 -10
- data/vendor/sass/extra/update_watch.rb +0 -13
- data/vendor/sass/init.rb +0 -18
- data/vendor/sass/lib/sass.rb +0 -73
- data/vendor/sass/lib/sass/cache_stores.rb +0 -15
- data/vendor/sass/lib/sass/cache_stores/base.rb +0 -86
- data/vendor/sass/lib/sass/cache_stores/chain.rb +0 -33
- data/vendor/sass/lib/sass/cache_stores/filesystem.rb +0 -60
- data/vendor/sass/lib/sass/cache_stores/memory.rb +0 -47
- data/vendor/sass/lib/sass/cache_stores/null.rb +0 -25
- data/vendor/sass/lib/sass/callbacks.rb +0 -66
- data/vendor/sass/lib/sass/css.rb +0 -295
- data/vendor/sass/lib/sass/engine.rb +0 -878
- data/vendor/sass/lib/sass/environment.rb +0 -166
- data/vendor/sass/lib/sass/error.rb +0 -201
- data/vendor/sass/lib/sass/exec.rb +0 -672
- data/vendor/sass/lib/sass/importers.rb +0 -22
- data/vendor/sass/lib/sass/importers/base.rb +0 -139
- data/vendor/sass/lib/sass/importers/filesystem.rb +0 -149
- data/vendor/sass/lib/sass/less.rb +0 -382
- data/vendor/sass/lib/sass/logger.rb +0 -15
- data/vendor/sass/lib/sass/logger/base.rb +0 -32
- data/vendor/sass/lib/sass/logger/log_level.rb +0 -49
- data/vendor/sass/lib/sass/plugin.rb +0 -132
- data/vendor/sass/lib/sass/plugin/compiler.rb +0 -383
- data/vendor/sass/lib/sass/plugin/configuration.rb +0 -123
- data/vendor/sass/lib/sass/plugin/generic.rb +0 -15
- data/vendor/sass/lib/sass/plugin/merb.rb +0 -48
- data/vendor/sass/lib/sass/plugin/rack.rb +0 -60
- data/vendor/sass/lib/sass/plugin/rails.rb +0 -47
- data/vendor/sass/lib/sass/plugin/staleness_checker.rb +0 -173
- data/vendor/sass/lib/sass/railtie.rb +0 -9
- data/vendor/sass/lib/sass/repl.rb +0 -58
- data/vendor/sass/lib/sass/root.rb +0 -7
- data/vendor/sass/lib/sass/script.rb +0 -40
- data/vendor/sass/lib/sass/script/bool.rb +0 -18
- data/vendor/sass/lib/sass/script/color.rb +0 -480
- data/vendor/sass/lib/sass/script/css_lexer.rb +0 -29
- data/vendor/sass/lib/sass/script/css_parser.rb +0 -31
- data/vendor/sass/lib/sass/script/funcall.rb +0 -175
- data/vendor/sass/lib/sass/script/functions.rb +0 -1386
- data/vendor/sass/lib/sass/script/interpolation.rb +0 -79
- data/vendor/sass/lib/sass/script/lexer.rb +0 -339
- data/vendor/sass/lib/sass/script/list.rb +0 -83
- data/vendor/sass/lib/sass/script/literal.rb +0 -250
- data/vendor/sass/lib/sass/script/node.rb +0 -99
- data/vendor/sass/lib/sass/script/number.rb +0 -452
- data/vendor/sass/lib/sass/script/operation.rb +0 -99
- data/vendor/sass/lib/sass/script/parser.rb +0 -474
- data/vendor/sass/lib/sass/script/string.rb +0 -51
- data/vendor/sass/lib/sass/script/string_interpolation.rb +0 -103
- data/vendor/sass/lib/sass/script/unary_operation.rb +0 -64
- data/vendor/sass/lib/sass/script/variable.rb +0 -59
- data/vendor/sass/lib/sass/scss.rb +0 -17
- data/vendor/sass/lib/sass/scss/css_parser.rb +0 -46
- data/vendor/sass/lib/sass/scss/parser.rb +0 -960
- data/vendor/sass/lib/sass/scss/rx.rb +0 -128
- data/vendor/sass/lib/sass/scss/sass_parser.rb +0 -11
- data/vendor/sass/lib/sass/scss/script_lexer.rb +0 -15
- data/vendor/sass/lib/sass/scss/script_parser.rb +0 -25
- data/vendor/sass/lib/sass/scss/static_parser.rb +0 -40
- data/vendor/sass/lib/sass/selector.rb +0 -361
- data/vendor/sass/lib/sass/selector/abstract_sequence.rb +0 -62
- data/vendor/sass/lib/sass/selector/comma_sequence.rb +0 -81
- data/vendor/sass/lib/sass/selector/sequence.rb +0 -233
- data/vendor/sass/lib/sass/selector/simple.rb +0 -113
- data/vendor/sass/lib/sass/selector/simple_sequence.rb +0 -134
- data/vendor/sass/lib/sass/shared.rb +0 -78
- data/vendor/sass/lib/sass/tree/charset_node.rb +0 -22
- data/vendor/sass/lib/sass/tree/comment_node.rb +0 -90
- data/vendor/sass/lib/sass/tree/debug_node.rb +0 -18
- data/vendor/sass/lib/sass/tree/directive_node.rb +0 -23
- data/vendor/sass/lib/sass/tree/each_node.rb +0 -24
- data/vendor/sass/lib/sass/tree/extend_node.rb +0 -29
- data/vendor/sass/lib/sass/tree/for_node.rb +0 -36
- data/vendor/sass/lib/sass/tree/function_node.rb +0 -27
- data/vendor/sass/lib/sass/tree/if_node.rb +0 -52
- data/vendor/sass/lib/sass/tree/import_node.rb +0 -68
- data/vendor/sass/lib/sass/tree/media_node.rb +0 -32
- data/vendor/sass/lib/sass/tree/mixin_def_node.rb +0 -27
- data/vendor/sass/lib/sass/tree/mixin_node.rb +0 -32
- data/vendor/sass/lib/sass/tree/node.rb +0 -201
- data/vendor/sass/lib/sass/tree/prop_node.rb +0 -148
- data/vendor/sass/lib/sass/tree/return_node.rb +0 -18
- data/vendor/sass/lib/sass/tree/root_node.rb +0 -28
- data/vendor/sass/lib/sass/tree/rule_node.rb +0 -136
- data/vendor/sass/lib/sass/tree/variable_node.rb +0 -30
- data/vendor/sass/lib/sass/tree/visitors/base.rb +0 -75
- data/vendor/sass/lib/sass/tree/visitors/check_nesting.rb +0 -133
- data/vendor/sass/lib/sass/tree/visitors/convert.rb +0 -260
- data/vendor/sass/lib/sass/tree/visitors/cssize.rb +0 -175
- data/vendor/sass/lib/sass/tree/visitors/deep_copy.rb +0 -87
- data/vendor/sass/lib/sass/tree/visitors/perform.rb +0 -332
- data/vendor/sass/lib/sass/tree/visitors/set_options.rb +0 -97
- data/vendor/sass/lib/sass/tree/visitors/to_css.rb +0 -210
- data/vendor/sass/lib/sass/tree/warn_node.rb +0 -18
- data/vendor/sass/lib/sass/tree/while_node.rb +0 -18
- data/vendor/sass/lib/sass/util.rb +0 -721
- data/vendor/sass/lib/sass/util/subset_map.rb +0 -101
- data/vendor/sass/lib/sass/version.rb +0 -112
- data/vendor/sass/rails/init.rb +0 -1
- data/vendor/sass/sass.gemspec +0 -33
- data/vendor/sass/test/Gemfile +0 -4
- data/vendor/sass/test/Gemfile.lock +0 -19
- data/vendor/sass/test/sass/cache_test.rb +0 -89
- data/vendor/sass/test/sass/callbacks_test.rb +0 -61
- data/vendor/sass/test/sass/conversion_test.rb +0 -1199
- data/vendor/sass/test/sass/css2sass_test.rb +0 -373
- data/vendor/sass/test/sass/data/hsl-rgb.txt +0 -319
- data/vendor/sass/test/sass/engine_test.rb +0 -2567
- data/vendor/sass/test/sass/extend_test.rb +0 -1348
- data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.css +0 -1
- data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.scss +0 -1
- data/vendor/sass/test/sass/functions_test.rb +0 -1038
- data/vendor/sass/test/sass/importer_test.rb +0 -192
- data/vendor/sass/test/sass/less_conversion_test.rb +0 -653
- data/vendor/sass/test/sass/logger_test.rb +0 -58
- data/vendor/sass/test/sass/mock_importer.rb +0 -49
- data/vendor/sass/test/sass/more_results/more1.css +0 -9
- data/vendor/sass/test/sass/more_results/more1_with_line_comments.css +0 -26
- data/vendor/sass/test/sass/more_results/more_import.css +0 -29
- data/vendor/sass/test/sass/more_templates/_more_partial.sass +0 -2
- data/vendor/sass/test/sass/more_templates/more1.sass +0 -23
- data/vendor/sass/test/sass/more_templates/more_import.sass +0 -11
- data/vendor/sass/test/sass/plugin_test.rb +0 -472
- data/vendor/sass/test/sass/results/alt.css +0 -4
- data/vendor/sass/test/sass/results/basic.css +0 -9
- data/vendor/sass/test/sass/results/compact.css +0 -5
- data/vendor/sass/test/sass/results/complex.css +0 -86
- data/vendor/sass/test/sass/results/compressed.css +0 -1
- data/vendor/sass/test/sass/results/expanded.css +0 -19
- data/vendor/sass/test/sass/results/if.css +0 -3
- data/vendor/sass/test/sass/results/import.css +0 -31
- data/vendor/sass/test/sass/results/import_charset.css +0 -4
- data/vendor/sass/test/sass/results/import_charset_1_8.css +0 -4
- data/vendor/sass/test/sass/results/import_charset_ibm866.css +0 -4
- data/vendor/sass/test/sass/results/line_numbers.css +0 -49
- data/vendor/sass/test/sass/results/mixins.css +0 -95
- data/vendor/sass/test/sass/results/multiline.css +0 -24
- data/vendor/sass/test/sass/results/nested.css +0 -22
- data/vendor/sass/test/sass/results/options.css +0 -1
- data/vendor/sass/test/sass/results/parent_ref.css +0 -13
- data/vendor/sass/test/sass/results/script.css +0 -16
- data/vendor/sass/test/sass/results/scss_import.css +0 -31
- data/vendor/sass/test/sass/results/scss_importee.css +0 -2
- data/vendor/sass/test/sass/results/subdir/nested_subdir/nested_subdir.css +0 -1
- data/vendor/sass/test/sass/results/subdir/subdir.css +0 -3
- data/vendor/sass/test/sass/results/units.css +0 -11
- data/vendor/sass/test/sass/results/warn.css +0 -0
- data/vendor/sass/test/sass/results/warn_imported.css +0 -0
- data/vendor/sass/test/sass/script_conversion_test.rb +0 -285
- data/vendor/sass/test/sass/script_test.rb +0 -514
- data/vendor/sass/test/sass/scss/css_test.rb +0 -922
- data/vendor/sass/test/sass/scss/rx_test.rb +0 -156
- data/vendor/sass/test/sass/scss/scss_test.rb +0 -1273
- data/vendor/sass/test/sass/scss/test_helper.rb +0 -37
- data/vendor/sass/test/sass/templates/_imported_charset_ibm866.sass +0 -4
- data/vendor/sass/test/sass/templates/_imported_charset_utf8.sass +0 -4
- data/vendor/sass/test/sass/templates/_partial.sass +0 -2
- data/vendor/sass/test/sass/templates/alt.sass +0 -16
- data/vendor/sass/test/sass/templates/basic.sass +0 -23
- data/vendor/sass/test/sass/templates/bork1.sass +0 -2
- data/vendor/sass/test/sass/templates/bork2.sass +0 -2
- data/vendor/sass/test/sass/templates/bork3.sass +0 -2
- data/vendor/sass/test/sass/templates/bork4.sass +0 -2
- data/vendor/sass/test/sass/templates/bork5.sass +0 -3
- data/vendor/sass/test/sass/templates/compact.sass +0 -17
- data/vendor/sass/test/sass/templates/complex.sass +0 -305
- data/vendor/sass/test/sass/templates/compressed.sass +0 -15
- data/vendor/sass/test/sass/templates/expanded.sass +0 -17
- data/vendor/sass/test/sass/templates/if.sass +0 -11
- data/vendor/sass/test/sass/templates/import.sass +0 -12
- data/vendor/sass/test/sass/templates/import_charset.sass +0 -7
- data/vendor/sass/test/sass/templates/import_charset_1_8.sass +0 -4
- data/vendor/sass/test/sass/templates/import_charset_ibm866.sass +0 -9
- data/vendor/sass/test/sass/templates/importee.less +0 -2
- data/vendor/sass/test/sass/templates/importee.sass +0 -19
- data/vendor/sass/test/sass/templates/line_numbers.sass +0 -13
- data/vendor/sass/test/sass/templates/mixin_bork.sass +0 -5
- data/vendor/sass/test/sass/templates/mixins.sass +0 -76
- data/vendor/sass/test/sass/templates/multiline.sass +0 -20
- data/vendor/sass/test/sass/templates/nested.sass +0 -25
- data/vendor/sass/test/sass/templates/nested_bork1.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork2.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork3.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork4.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork5.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_import.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_mixin_bork.sass +0 -6
- data/vendor/sass/test/sass/templates/options.sass +0 -2
- data/vendor/sass/test/sass/templates/parent_ref.sass +0 -25
- data/vendor/sass/test/sass/templates/script.sass +0 -101
- data/vendor/sass/test/sass/templates/scss_import.scss +0 -11
- data/vendor/sass/test/sass/templates/scss_importee.scss +0 -1
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +0 -2
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +0 -3
- data/vendor/sass/test/sass/templates/subdir/subdir.sass +0 -6
- data/vendor/sass/test/sass/templates/units.sass +0 -11
- data/vendor/sass/test/sass/templates/warn.sass +0 -3
- data/vendor/sass/test/sass/templates/warn_imported.sass +0 -4
- data/vendor/sass/test/sass/test_helper.rb +0 -8
- data/vendor/sass/test/sass/util/subset_map_test.rb +0 -91
- data/vendor/sass/test/sass/util_test.rb +0 -266
- data/vendor/sass/test/test_helper.rb +0 -69
- data/vendor/sass/vendor/fssm/Gemfile +0 -3
- data/vendor/sass/vendor/fssm/LICENSE +0 -20
- data/vendor/sass/vendor/fssm/README.markdown +0 -83
- data/vendor/sass/vendor/fssm/Rakefile +0 -11
- data/vendor/sass/vendor/fssm/example.rb +0 -12
- data/vendor/sass/vendor/fssm/fssm.gemspec +0 -24
- data/vendor/sass/vendor/fssm/lib/fssm.rb +0 -37
- data/vendor/sass/vendor/fssm/lib/fssm/backends/fsevents.rb +0 -36
- data/vendor/sass/vendor/fssm/lib/fssm/backends/inotify.rb +0 -26
- data/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb +0 -25
- data/vendor/sass/vendor/fssm/lib/fssm/backends/rbfsevent.rb +0 -42
- data/vendor/sass/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +0 -131
- data/vendor/sass/vendor/fssm/lib/fssm/monitor.rb +0 -36
- data/vendor/sass/vendor/fssm/lib/fssm/path.rb +0 -94
- data/vendor/sass/vendor/fssm/lib/fssm/pathname.rb +0 -36
- data/vendor/sass/vendor/fssm/lib/fssm/state/directory.rb +0 -75
- data/vendor/sass/vendor/fssm/lib/fssm/state/file.rb +0 -24
- data/vendor/sass/vendor/fssm/lib/fssm/support.rb +0 -92
- data/vendor/sass/vendor/fssm/lib/fssm/tree.rb +0 -176
- data/vendor/sass/vendor/fssm/lib/fssm/version.rb +0 -3
- data/vendor/sass/vendor/fssm/profile/prof-cache.rb +0 -40
- data/vendor/sass/vendor/fssm/profile/prof-fssm-pathname.html +0 -1231
- data/vendor/sass/vendor/fssm/profile/prof-pathname-rubinius.rb +0 -35
- data/vendor/sass/vendor/fssm/profile/prof-pathname.rb +0 -68
- data/vendor/sass/vendor/fssm/profile/prof-plain-pathname.html +0 -988
- data/vendor/sass/vendor/fssm/profile/prof.html +0 -2379
- data/vendor/sass/vendor/fssm/spec/count_down_latch.rb +0 -151
- data/vendor/sass/vendor/fssm/spec/monitor_spec.rb +0 -202
- data/vendor/sass/vendor/fssm/spec/path_spec.rb +0 -96
- data/vendor/sass/vendor/fssm/spec/root/duck/quack.txt +0 -0
- data/vendor/sass/vendor/fssm/spec/root/file.css +0 -0
- data/vendor/sass/vendor/fssm/spec/root/file.rb +0 -0
- data/vendor/sass/vendor/fssm/spec/root/file.yml +0 -0
- data/vendor/sass/vendor/fssm/spec/root/moo/cow.txt +0 -0
- data/vendor/sass/vendor/fssm/spec/spec_helper.rb +0 -14
- data/vendor/sass/yard/callbacks.rb +0 -29
- data/vendor/sass/yard/default/fulldoc/html/css/common.sass +0 -26
- data/vendor/sass/yard/default/layout/html/footer.erb +0 -12
- data/vendor/sass/yard/inherited_hash.rb +0 -41
@@ -1,2567 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
require 'test_helper'
|
4
|
-
require 'sass/test_helper'
|
5
|
-
require 'sass/engine'
|
6
|
-
require 'stringio'
|
7
|
-
require 'mock_importer'
|
8
|
-
require 'pathname'
|
9
|
-
|
10
|
-
module Sass::Script::Functions::UserFunctions
|
11
|
-
def option(name)
|
12
|
-
Sass::Script::String.new(@options[name.value.to_sym].to_s)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
class SassEngineTest < Test::Unit::TestCase
|
17
|
-
FAKE_FILE_NAME = __FILE__.gsub(/rb$/,"sass")
|
18
|
-
# A map of erroneous Sass documents to the error messages they should produce.
|
19
|
-
# The error messages may be arrays;
|
20
|
-
# if so, the second element should be the line number that should be reported for the error.
|
21
|
-
# If this isn't provided, the tests will assume the line number should be the last line of the document.
|
22
|
-
EXCEPTION_MAP = {
|
23
|
-
"$a: 1 + " => 'Invalid CSS after "1 +": expected expression (e.g. 1px, bold), was ""',
|
24
|
-
"$a: 1 + 2 +" => 'Invalid CSS after "1 + 2 +": expected expression (e.g. 1px, bold), was ""',
|
25
|
-
"$a: 1 + 2 + %" => 'Invalid CSS after "1 + 2 + ": expected expression (e.g. 1px, bold), was "%"',
|
26
|
-
"$a: foo(\"bar\"" => 'Invalid CSS after "foo("bar"": expected ")", was ""',
|
27
|
-
"$a: 1 }" => 'Invalid CSS after "1 ": expected expression (e.g. 1px, bold), was "}"',
|
28
|
-
"$a: 1 }foo\"" => 'Invalid CSS after "1 ": expected expression (e.g. 1px, bold), was "}foo""',
|
29
|
-
":" => 'Invalid property: ":".',
|
30
|
-
": a" => 'Invalid property: ": a".',
|
31
|
-
"a\n :b" => <<MSG,
|
32
|
-
Invalid property: ":b" (no value).
|
33
|
-
If ":b" should be a selector, use "\\:b" instead.
|
34
|
-
MSG
|
35
|
-
"a\n b:" => 'Invalid property: "b:" (no value).',
|
36
|
-
"a\n :b: c" => 'Invalid property: ":b: c".',
|
37
|
-
"a\n :b:c d" => 'Invalid property: ":b:c d".',
|
38
|
-
"a\n :b c;" => 'Invalid CSS after "c": expected expression (e.g. 1px, bold), was ";"',
|
39
|
-
"a\n b: c;" => 'Invalid CSS after "c": expected expression (e.g. 1px, bold), was ";"',
|
40
|
-
".foo ^bar\n a: b" => ['Invalid CSS after ".foo ": expected selector, was "^bar"', 1],
|
41
|
-
"a\n @extend .foo ^bar" => 'Invalid CSS after ".foo ": expected selector, was "^bar"',
|
42
|
-
"a: b" => 'Properties are only allowed within rules, directives, or other properties.',
|
43
|
-
":a b" => 'Properties are only allowed within rules, directives, or other properties.',
|
44
|
-
"$" => 'Invalid variable: "$".',
|
45
|
-
"$a" => 'Invalid variable: "$a".',
|
46
|
-
"$ a" => 'Invalid variable: "$ a".',
|
47
|
-
"$a b" => 'Invalid variable: "$a b".',
|
48
|
-
"$a: 1b + 2c" => "Incompatible units: 'c' and 'b'.",
|
49
|
-
"$a: 1b < 2c" => "Incompatible units: 'c' and 'b'.",
|
50
|
-
"$a: 1b > 2c" => "Incompatible units: 'c' and 'b'.",
|
51
|
-
"$a: 1b <= 2c" => "Incompatible units: 'c' and 'b'.",
|
52
|
-
"$a: 1b >= 2c" => "Incompatible units: 'c' and 'b'.",
|
53
|
-
"a\n b: 1b * 2c" => "2b*c isn't a valid CSS value.",
|
54
|
-
"a\n b: 1b % 2c" => "Cannot modulo by a number with units: 2c.",
|
55
|
-
"$a: 2px + #ccc" => "Cannot add a number with units (2px) to a color (#cccccc).",
|
56
|
-
"$a: #ccc + 2px" => "Cannot add a number with units (2px) to a color (#cccccc).",
|
57
|
-
"& a\n :b c" => ["Base-level rules cannot contain the parent-selector-referencing character '&'.", 1],
|
58
|
-
"a\n :b\n c" => "Illegal nesting: Only properties may be nested beneath properties.",
|
59
|
-
"$a: b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath variable declarations.",
|
60
|
-
"$a: b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath variable declarations.",
|
61
|
-
"@import templates/basic\n foo" => "Illegal nesting: Nothing may be nested beneath import directives.",
|
62
|
-
"foo\n @import foo.css" => "CSS import directives may only be used at the root of a document.",
|
63
|
-
"@if true\n @import foo" => "Import directives may not be used within control directives or mixins.",
|
64
|
-
"@mixin foo\n @import foo" => "Import directives may not be used within control directives or mixins.",
|
65
|
-
"@import foo;" => "Invalid @import: expected end of line, was \";\".",
|
66
|
-
'$foo: "bar" "baz" !' => %Q{Invalid CSS after ""bar" "baz" ": expected expression (e.g. 1px, bold), was "!"},
|
67
|
-
'$foo: "bar" "baz" $' => %Q{Invalid CSS after ""bar" "baz" ": expected expression (e.g. 1px, bold), was "$"},
|
68
|
-
"=foo\n :color red\n.bar\n +bang" => "Undefined mixin 'bang'.",
|
69
|
-
"=foo\n :color red\n.bar\n +bang_bop" => "Undefined mixin 'bang_bop'.",
|
70
|
-
"=foo\n :color red\n.bar\n +bang-bop" => "Undefined mixin 'bang-bop'.",
|
71
|
-
".bar\n =foo\n :color red\n" => ["Mixins may only be defined at the root of a document.", 2],
|
72
|
-
"=foo\n :color red\n.bar\n +foo\n :color red" => "Illegal nesting: Nothing may be nested beneath mixin directives.",
|
73
|
-
" a\n b: c" => ["Indenting at the beginning of the document is illegal.", 1],
|
74
|
-
" \n \n\t\n a\n b: c" => ["Indenting at the beginning of the document is illegal.", 4],
|
75
|
-
"a\n b: c\n b: c" => ["Inconsistent indentation: 1 space was used for indentation, but the rest of the document was indented using 2 spaces.", 3],
|
76
|
-
"a\n b: c\na\n b: c" => ["Inconsistent indentation: 1 space was used for indentation, but the rest of the document was indented using 2 spaces.", 4],
|
77
|
-
"a\n\t\tb: c\n\tb: c" => ["Inconsistent indentation: 1 tab was used for indentation, but the rest of the document was indented using 2 tabs.", 3],
|
78
|
-
"a\n b: c\n b: c" => ["Inconsistent indentation: 3 spaces were used for indentation, but the rest of the document was indented using 2 spaces.", 3],
|
79
|
-
"a\n b: c\n a\n d: e" => ["Inconsistent indentation: 3 spaces were used for indentation, but the rest of the document was indented using 2 spaces.", 4],
|
80
|
-
"a\n b: c\na\n d: e" => ["The line was indented 2 levels deeper than the previous line.", 4],
|
81
|
-
"a\n b: c\n a\n d: e" => ["The line was indented 3 levels deeper than the previous line.", 4],
|
82
|
-
"a\n \tb: c" => ["Indentation can't use both tabs and spaces.", 2],
|
83
|
-
"=a(" => 'Invalid CSS after "(": expected variable (e.g. $foo), was ""',
|
84
|
-
"=a(b)" => 'Invalid CSS after "(": expected variable (e.g. $foo), was "b)"',
|
85
|
-
"=a(,)" => 'Invalid CSS after "(": expected variable (e.g. $foo), was ",)"',
|
86
|
-
"=a($)" => 'Invalid CSS after "(": expected variable (e.g. $foo), was "$)"',
|
87
|
-
"=a($foo bar)" => 'Invalid CSS after "($foo ": expected ")", was "bar)"',
|
88
|
-
"=foo\n bar: baz\n+foo" => ["Properties are only allowed within rules, directives, or other properties.", 2],
|
89
|
-
"a-\#{$b\n c: d" => ['Invalid CSS after "a-#{$b": expected "}", was ""', 1],
|
90
|
-
"=a($b: 1, $c)" => "Required argument $c must come before any optional arguments.",
|
91
|
-
"=a($b: 1)\n a: $b\ndiv\n +a(1,2)" => "Mixin a takes 1 argument but 2 were passed.",
|
92
|
-
"=a($b: 1)\n a: $b\ndiv\n +a(1,$c: 3)" => "Mixin a doesn't have an argument named $c",
|
93
|
-
"=a($b)\n a: $b\ndiv\n +a" => "Mixin a is missing parameter $b.",
|
94
|
-
"@function foo()\n 1 + 2" => "Functions can only contain variable declarations and control directives.",
|
95
|
-
"@function foo()\n foo: bar" => "Functions can only contain variable declarations and control directives.",
|
96
|
-
"@function foo()\n foo: bar\n @return 3" => ["Functions can only contain variable declarations and control directives.", 2],
|
97
|
-
"@function foo\n @return 1" => ['Invalid CSS after "": expected "(", was ""', 1],
|
98
|
-
"@function foo(\n @return 1" => ['Invalid CSS after "(": expected variable (e.g. $foo), was ""', 1],
|
99
|
-
"@function foo(b)\n @return 1" => ['Invalid CSS after "(": expected variable (e.g. $foo), was "b)"', 1],
|
100
|
-
"@function foo(,)\n @return 1" => ['Invalid CSS after "(": expected variable (e.g. $foo), was ",)"', 1],
|
101
|
-
"@function foo($)\n @return 1" => ['Invalid CSS after "(": expected variable (e.g. $foo), was "$)"', 1],
|
102
|
-
"@function foo()\n @return" => 'Invalid @return: expected expression.',
|
103
|
-
"@function foo()\n @return 1\n $var: val" => 'Illegal nesting: Nothing may be nested beneath return directives.',
|
104
|
-
"foo\n @function bar()\n @return 1" => ['Functions may only be defined at the root of a document.', 2],
|
105
|
-
"@function foo($a)\n @return 1\na\n b: foo()" => 'Function foo is missing parameter $a.',
|
106
|
-
"@function foo()\n @return 1\na\n b: foo(2)" => 'Wrong number of arguments (1 for 0) for `foo\'',
|
107
|
-
"@return 1" => '@return may only be used within a function.',
|
108
|
-
"@if true\n @return 1" => '@return may only be used within a function.',
|
109
|
-
"@mixin foo\n @return 1\n@include foo" => ['@return may only be used within a function.', 2],
|
110
|
-
"@else\n a\n b: c" => ["@else must come after @if.", 1],
|
111
|
-
"@if false\n@else foo" => "Invalid else directive '@else foo': expected 'if <expr>'.",
|
112
|
-
"@if false\n@else if " => "Invalid else directive '@else if': expected 'if <expr>'.",
|
113
|
-
"a\n $b: 12\nc\n d: $b" => 'Undefined variable: "$b".',
|
114
|
-
"=foo\n $b: 12\nc\n +foo\n d: $b" => 'Undefined variable: "$b".',
|
115
|
-
"c\n d: $b-foo" => 'Undefined variable: "$b-foo".',
|
116
|
-
"c\n d: $b_foo" => 'Undefined variable: "$b_foo".',
|
117
|
-
'@for $a from "foo" to 1' => '"foo" is not an integer.',
|
118
|
-
'@for $a from 1 to "2"' => '"2" is not an integer.',
|
119
|
-
'@for $a from 1 to "foo"' => '"foo" is not an integer.',
|
120
|
-
'@for $a from 1 to 1.232323' => '1.232 is not an integer.',
|
121
|
-
'@for $a from 1px to 3em' => "Incompatible units: 'em' and 'px'.",
|
122
|
-
'@if' => "Invalid if directive '@if': expected expression.",
|
123
|
-
'@while' => "Invalid while directive '@while': expected expression.",
|
124
|
-
'@debug' => "Invalid debug directive '@debug': expected expression.",
|
125
|
-
%Q{@debug "a message"\n "nested message"} => "Illegal nesting: Nothing may be nested beneath debug directives.",
|
126
|
-
'@warn' => "Invalid warn directive '@warn': expected expression.",
|
127
|
-
%Q{@warn "a message"\n "nested message"} => "Illegal nesting: Nothing may be nested beneath warn directives.",
|
128
|
-
"/* foo\n bar\n baz" => "Inconsistent indentation: previous line was indented by 4 spaces, but this line was indented by 2 spaces.",
|
129
|
-
'+foo(1 + 1: 2)' => 'Invalid CSS after "(1 + 1": expected comma, was ": 2)"',
|
130
|
-
'+foo($var: )' => 'Invalid CSS after "($var: ": expected mixin argument, was ")"',
|
131
|
-
'+foo($var: a, $var: b)' => 'Keyword argument "$var" passed more than once',
|
132
|
-
'+foo($var-var: a, $var_var: b)' => 'Keyword argument "$var-var" passed more than once',
|
133
|
-
'+foo($var_var: a, $var-var: b)' => 'Keyword argument "$var_var" passed more than once',
|
134
|
-
"a\n b: foo(1 + 1: 2)" => 'Invalid CSS after "foo(1 + 1": expected comma, was ": 2)"',
|
135
|
-
"a\n b: foo($var: )" => 'Invalid CSS after "foo($var: ": expected function argument, was ")"',
|
136
|
-
"a\n b: foo($var: a, $var: b)" => 'Keyword argument "$var" passed more than once',
|
137
|
-
"a\n b: foo($var-var: a, $var_var: b)" => 'Keyword argument "$var-var" passed more than once',
|
138
|
-
"a\n b: foo($var_var: a, $var-var: b)" => 'Keyword argument "$var_var" passed more than once',
|
139
|
-
"@if foo\n @extend .bar" => ["Extend directives may only be used within rules.", 2],
|
140
|
-
"$var: true\n@while $var\n @extend .bar\n $var: false" => ["Extend directives may only be used within rules.", 3],
|
141
|
-
"@for $i from 0 to 1\n @extend .bar" => ["Extend directives may only be used within rules.", 2],
|
142
|
-
"@mixin foo\n @extend .bar\n@include foo" => ["Extend directives may only be used within rules.", 2],
|
143
|
-
|
144
|
-
# Regression tests
|
145
|
-
"a\n b:\n c\n d" => ["Illegal nesting: Only properties may be nested beneath properties.", 3],
|
146
|
-
"& foo\n bar: baz\n blat: bang" => ["Base-level rules cannot contain the parent-selector-referencing character '&'.", 1],
|
147
|
-
"a\n b: c\n& foo\n bar: baz\n blat: bang" => ["Base-level rules cannot contain the parent-selector-referencing character '&'.", 3],
|
148
|
-
}
|
149
|
-
|
150
|
-
def teardown
|
151
|
-
clean_up_sassc
|
152
|
-
end
|
153
|
-
|
154
|
-
def test_basic_render
|
155
|
-
renders_correctly "basic", { :style => :compact }
|
156
|
-
end
|
157
|
-
|
158
|
-
def test_empty_render
|
159
|
-
assert_equal "", render("")
|
160
|
-
end
|
161
|
-
|
162
|
-
def test_multiple_calls_to_render
|
163
|
-
sass = Sass::Engine.new("a\n b: c")
|
164
|
-
assert_equal sass.render, sass.render
|
165
|
-
end
|
166
|
-
|
167
|
-
def test_alternate_styles
|
168
|
-
renders_correctly "expanded", { :style => :expanded }
|
169
|
-
renders_correctly "compact", { :style => :compact }
|
170
|
-
renders_correctly "nested", { :style => :nested }
|
171
|
-
renders_correctly "compressed", { :style => :compressed }
|
172
|
-
end
|
173
|
-
|
174
|
-
def test_compile
|
175
|
-
assert_equal "div { hello: world; }\n", Sass.compile("$who: world\ndiv\n hello: $who", :syntax => :sass, :style => :compact)
|
176
|
-
assert_equal "div { hello: world; }\n", Sass.compile("$who: world; div { hello: $who }", :style => :compact)
|
177
|
-
end
|
178
|
-
|
179
|
-
def test_compile_file
|
180
|
-
FileUtils.mkdir_p(absolutize("tmp"))
|
181
|
-
open(absolutize("tmp/test_compile_file.sass"), "w") {|f| f.write("$who: world\ndiv\n hello: $who")}
|
182
|
-
open(absolutize("tmp/test_compile_file.scss"), "w") {|f| f.write("$who: world; div { hello: $who }")}
|
183
|
-
assert_equal "div { hello: world; }\n", Sass.compile_file(absolutize("tmp/test_compile_file.sass"), :style => :compact)
|
184
|
-
assert_equal "div { hello: world; }\n", Sass.compile_file(absolutize("tmp/test_compile_file.scss"), :style => :compact)
|
185
|
-
ensure
|
186
|
-
FileUtils.rm_rf(absolutize("tmp"))
|
187
|
-
end
|
188
|
-
|
189
|
-
def test_compile_file_to_css_file
|
190
|
-
FileUtils.mkdir_p(absolutize("tmp"))
|
191
|
-
open(absolutize("tmp/test_compile_file.sass"), "w") {|f| f.write("$who: world\ndiv\n hello: $who")}
|
192
|
-
open(absolutize("tmp/test_compile_file.scss"), "w") {|f| f.write("$who: world; div { hello: $who }")}
|
193
|
-
Sass.compile_file(absolutize("tmp/test_compile_file.sass"), absolutize("tmp/test_compile_file_sass.css"), :style => :compact)
|
194
|
-
Sass.compile_file(absolutize("tmp/test_compile_file.scss"), absolutize("tmp/test_compile_file_scss.css"), :style => :compact)
|
195
|
-
assert_equal "div { hello: world; }\n", File.read(absolutize("tmp/test_compile_file_sass.css"))
|
196
|
-
assert_equal "div { hello: world; }\n", File.read(absolutize("tmp/test_compile_file_scss.css"))
|
197
|
-
ensure
|
198
|
-
FileUtils.rm_rf(absolutize("tmp"))
|
199
|
-
end
|
200
|
-
|
201
|
-
def test_flexible_tabulation
|
202
|
-
assert_equal("p {\n a: b; }\n p q {\n c: d; }\n",
|
203
|
-
render("p\n a: b\n q\n c: d\n"))
|
204
|
-
assert_equal("p {\n a: b; }\n p q {\n c: d; }\n",
|
205
|
-
render("p\n\ta: b\n\tq\n\t\tc: d\n"))
|
206
|
-
end
|
207
|
-
|
208
|
-
EXCEPTION_MAP.each do |key, value|
|
209
|
-
define_method("test_exception (#{key.inspect})") do
|
210
|
-
line = 10
|
211
|
-
begin
|
212
|
-
silence_warnings {Sass::Engine.new(key, :filename => FAKE_FILE_NAME, :line => line).render}
|
213
|
-
rescue Sass::SyntaxError => err
|
214
|
-
value = [value] unless value.is_a?(Array)
|
215
|
-
|
216
|
-
assert_equal(value.first.rstrip, err.message, "Line: #{key}")
|
217
|
-
assert_equal(FAKE_FILE_NAME, err.sass_filename)
|
218
|
-
assert_equal((value[1] || key.split("\n").length) + line - 1, err.sass_line, "Line: #{key}")
|
219
|
-
assert_match(/#{Regexp.escape(FAKE_FILE_NAME)}:[0-9]+/, err.backtrace[0], "Line: #{key}")
|
220
|
-
else
|
221
|
-
assert(false, "Exception not raised for\n#{key}")
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
def test_exception_line
|
227
|
-
to_render = <<SASS
|
228
|
-
rule
|
229
|
-
:prop val
|
230
|
-
// comment!
|
231
|
-
|
232
|
-
:broken
|
233
|
-
SASS
|
234
|
-
begin
|
235
|
-
Sass::Engine.new(to_render).render
|
236
|
-
rescue Sass::SyntaxError => err
|
237
|
-
assert_equal(5, err.sass_line)
|
238
|
-
else
|
239
|
-
assert(false, "Exception not raised for '#{to_render}'!")
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
def test_exception_location
|
244
|
-
to_render = <<SASS
|
245
|
-
rule
|
246
|
-
:prop val
|
247
|
-
// comment!
|
248
|
-
|
249
|
-
:broken
|
250
|
-
SASS
|
251
|
-
begin
|
252
|
-
Sass::Engine.new(to_render, :filename => FAKE_FILE_NAME, :line => (__LINE__-7)).render
|
253
|
-
rescue Sass::SyntaxError => err
|
254
|
-
assert_equal(FAKE_FILE_NAME, err.sass_filename)
|
255
|
-
assert_equal((__LINE__-6), err.sass_line)
|
256
|
-
else
|
257
|
-
assert(false, "Exception not raised for '#{to_render}'!")
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
|
-
def test_imported_exception
|
262
|
-
[1, 2, 3, 4, 5].each do |i|
|
263
|
-
begin
|
264
|
-
Sass::Engine.new("@import bork#{i}", :load_paths => [File.dirname(__FILE__) + '/templates/']).render
|
265
|
-
rescue Sass::SyntaxError => err
|
266
|
-
assert_equal(2, err.sass_line)
|
267
|
-
assert_match(/(\/|^)bork#{i}\.sass$/, err.sass_filename)
|
268
|
-
|
269
|
-
assert_hash_has(err.sass_backtrace.first,
|
270
|
-
:filename => err.sass_filename, :line => err.sass_line)
|
271
|
-
|
272
|
-
assert_nil(err.sass_backtrace[1][:filename])
|
273
|
-
assert_equal(1, err.sass_backtrace[1][:line])
|
274
|
-
|
275
|
-
assert_match(/(\/|^)bork#{i}\.sass:2$/, err.backtrace.first)
|
276
|
-
assert_equal("(sass):1", err.backtrace[1])
|
277
|
-
else
|
278
|
-
assert(false, "Exception not raised for imported template: bork#{i}")
|
279
|
-
end
|
280
|
-
end
|
281
|
-
end
|
282
|
-
|
283
|
-
def test_double_imported_exception
|
284
|
-
[1, 2, 3, 4, 5].each do |i|
|
285
|
-
begin
|
286
|
-
Sass::Engine.new("@import nested_bork#{i}", :load_paths => [File.dirname(__FILE__) + '/templates/']).render
|
287
|
-
rescue Sass::SyntaxError => err
|
288
|
-
assert_equal(2, err.sass_line)
|
289
|
-
assert_match(/(\/|^)bork#{i}\.sass$/, err.sass_filename)
|
290
|
-
|
291
|
-
assert_hash_has(err.sass_backtrace.first,
|
292
|
-
:filename => err.sass_filename, :line => err.sass_line)
|
293
|
-
|
294
|
-
assert_match(/(\/|^)nested_bork#{i}\.sass$/, err.sass_backtrace[1][:filename])
|
295
|
-
assert_equal(2, err.sass_backtrace[1][:line])
|
296
|
-
|
297
|
-
assert_nil(err.sass_backtrace[2][:filename])
|
298
|
-
assert_equal(1, err.sass_backtrace[2][:line])
|
299
|
-
|
300
|
-
assert_match(/(\/|^)bork#{i}\.sass:2$/, err.backtrace.first)
|
301
|
-
assert_match(/(\/|^)nested_bork#{i}\.sass:2$/, err.backtrace[1])
|
302
|
-
assert_equal("(sass):1", err.backtrace[2])
|
303
|
-
else
|
304
|
-
assert(false, "Exception not raised for imported template: bork#{i}")
|
305
|
-
end
|
306
|
-
end
|
307
|
-
end
|
308
|
-
|
309
|
-
def test_selector_tracing
|
310
|
-
actual_css = render(<<-SCSS, :syntax => :scss, :trace_selectors => true)
|
311
|
-
@mixin mixed {
|
312
|
-
.mixed { color: red; }
|
313
|
-
}
|
314
|
-
.context {
|
315
|
-
@include mixed;
|
316
|
-
}
|
317
|
-
SCSS
|
318
|
-
assert_equal(<<CSS,actual_css)
|
319
|
-
/* on line 2 of test_selector_tracing_inline.scss, in `mixed'
|
320
|
-
from line 5 of test_selector_tracing_inline.scss */
|
321
|
-
.context .mixed {
|
322
|
-
color: red; }
|
323
|
-
CSS
|
324
|
-
end
|
325
|
-
|
326
|
-
def test_mixin_exception
|
327
|
-
render(<<SASS)
|
328
|
-
=error-mixin($a)
|
329
|
-
color: $a * 1em * 1px
|
330
|
-
|
331
|
-
=outer-mixin($a)
|
332
|
-
+error-mixin($a)
|
333
|
-
|
334
|
-
.error
|
335
|
-
+outer-mixin(12)
|
336
|
-
SASS
|
337
|
-
assert(false, "Exception not raised")
|
338
|
-
rescue Sass::SyntaxError => err
|
339
|
-
assert_equal(2, err.sass_line)
|
340
|
-
assert_equal(filename_for_test, err.sass_filename)
|
341
|
-
assert_equal("error-mixin", err.sass_mixin)
|
342
|
-
|
343
|
-
assert_hash_has(err.sass_backtrace.first, :line => err.sass_line,
|
344
|
-
:filename => err.sass_filename, :mixin => err.sass_mixin)
|
345
|
-
assert_hash_has(err.sass_backtrace[1], :line => 5,
|
346
|
-
:filename => filename_for_test, :mixin => "outer-mixin")
|
347
|
-
assert_hash_has(err.sass_backtrace[2], :line => 8,
|
348
|
-
:filename => filename_for_test, :mixin => nil)
|
349
|
-
|
350
|
-
assert_equal("#{filename_for_test}:2:in `error-mixin'", err.backtrace.first)
|
351
|
-
assert_equal("#{filename_for_test}:5:in `outer-mixin'", err.backtrace[1])
|
352
|
-
assert_equal("#{filename_for_test}:8", err.backtrace[2])
|
353
|
-
end
|
354
|
-
|
355
|
-
def test_mixin_callsite_exception
|
356
|
-
render(<<SASS)
|
357
|
-
=one-arg-mixin($a)
|
358
|
-
color: $a
|
359
|
-
|
360
|
-
=outer-mixin($a)
|
361
|
-
+one-arg-mixin($a, 12)
|
362
|
-
|
363
|
-
.error
|
364
|
-
+outer-mixin(12)
|
365
|
-
SASS
|
366
|
-
assert(false, "Exception not raised")
|
367
|
-
rescue Sass::SyntaxError => err
|
368
|
-
assert_hash_has(err.sass_backtrace.first, :line => 5,
|
369
|
-
:filename => filename_for_test, :mixin => "one-arg-mixin")
|
370
|
-
assert_hash_has(err.sass_backtrace[1], :line => 5,
|
371
|
-
:filename => filename_for_test, :mixin => "outer-mixin")
|
372
|
-
assert_hash_has(err.sass_backtrace[2], :line => 8,
|
373
|
-
:filename => filename_for_test, :mixin => nil)
|
374
|
-
end
|
375
|
-
|
376
|
-
def test_mixin_exception_cssize
|
377
|
-
render(<<SASS)
|
378
|
-
=parent-ref-mixin
|
379
|
-
& foo
|
380
|
-
a: b
|
381
|
-
|
382
|
-
=outer-mixin
|
383
|
-
+parent-ref-mixin
|
384
|
-
|
385
|
-
+outer-mixin
|
386
|
-
SASS
|
387
|
-
assert(false, "Exception not raised")
|
388
|
-
rescue Sass::SyntaxError => err
|
389
|
-
assert_hash_has(err.sass_backtrace.first, :line => 2,
|
390
|
-
:filename => filename_for_test, :mixin => "parent-ref-mixin")
|
391
|
-
assert_hash_has(err.sass_backtrace[1], :line => 6,
|
392
|
-
:filename => filename_for_test, :mixin => "outer-mixin")
|
393
|
-
assert_hash_has(err.sass_backtrace[2], :line => 8,
|
394
|
-
:filename => filename_for_test, :mixin => nil)
|
395
|
-
end
|
396
|
-
|
397
|
-
def test_mixin_and_import_exception
|
398
|
-
Sass::Engine.new("@import nested_mixin_bork", :load_paths => [File.dirname(__FILE__) + '/templates/']).render
|
399
|
-
assert(false, "Exception not raised")
|
400
|
-
rescue Sass::SyntaxError => err
|
401
|
-
assert_match(/(\/|^)nested_mixin_bork\.sass$/, err.sass_backtrace.first[:filename])
|
402
|
-
assert_hash_has(err.sass_backtrace.first, :mixin => "error-mixin", :line => 4)
|
403
|
-
|
404
|
-
assert_match(/(\/|^)mixin_bork\.sass$/, err.sass_backtrace[1][:filename])
|
405
|
-
assert_hash_has(err.sass_backtrace[1], :mixin => "outer-mixin", :line => 2)
|
406
|
-
|
407
|
-
assert_match(/(\/|^)mixin_bork\.sass$/, err.sass_backtrace[2][:filename])
|
408
|
-
assert_hash_has(err.sass_backtrace[2], :mixin => nil, :line => 5)
|
409
|
-
|
410
|
-
assert_match(/(\/|^)nested_mixin_bork\.sass$/, err.sass_backtrace[3][:filename])
|
411
|
-
assert_hash_has(err.sass_backtrace[3], :mixin => nil, :line => 6)
|
412
|
-
|
413
|
-
assert_hash_has(err.sass_backtrace[4], :filename => nil, :mixin => nil, :line => 1)
|
414
|
-
end
|
415
|
-
|
416
|
-
def test_basic_mixin_loop_exception
|
417
|
-
render <<SASS
|
418
|
-
@mixin foo
|
419
|
-
@include foo
|
420
|
-
@include foo
|
421
|
-
SASS
|
422
|
-
assert(false, "Exception not raised")
|
423
|
-
rescue Sass::SyntaxError => err
|
424
|
-
assert_equal("An @include loop has been found: foo includes itself", err.message)
|
425
|
-
assert_hash_has(err.sass_backtrace[0], :mixin => "foo", :line => 2)
|
426
|
-
end
|
427
|
-
|
428
|
-
def test_double_mixin_loop_exception
|
429
|
-
render <<SASS
|
430
|
-
@mixin foo
|
431
|
-
@include bar
|
432
|
-
@mixin bar
|
433
|
-
@include foo
|
434
|
-
@include foo
|
435
|
-
SASS
|
436
|
-
assert(false, "Exception not raised")
|
437
|
-
rescue Sass::SyntaxError => err
|
438
|
-
assert_equal(<<MESSAGE.rstrip, err.message)
|
439
|
-
An @include loop has been found:
|
440
|
-
foo includes bar
|
441
|
-
bar includes foo
|
442
|
-
MESSAGE
|
443
|
-
assert_hash_has(err.sass_backtrace[0], :mixin => "bar", :line => 4)
|
444
|
-
assert_hash_has(err.sass_backtrace[1], :mixin => "foo", :line => 2)
|
445
|
-
end
|
446
|
-
|
447
|
-
def test_deep_mixin_loop_exception
|
448
|
-
render <<SASS
|
449
|
-
@mixin foo
|
450
|
-
@include bar
|
451
|
-
|
452
|
-
@mixin bar
|
453
|
-
@include baz
|
454
|
-
|
455
|
-
@mixin baz
|
456
|
-
@include foo
|
457
|
-
|
458
|
-
@include foo
|
459
|
-
SASS
|
460
|
-
assert(false, "Exception not raised")
|
461
|
-
rescue Sass::SyntaxError => err
|
462
|
-
assert_equal(<<MESSAGE.rstrip, err.message)
|
463
|
-
An @include loop has been found:
|
464
|
-
foo includes bar
|
465
|
-
bar includes baz
|
466
|
-
baz includes foo
|
467
|
-
MESSAGE
|
468
|
-
assert_hash_has(err.sass_backtrace[0], :mixin => "baz", :line => 8)
|
469
|
-
assert_hash_has(err.sass_backtrace[1], :mixin => "bar", :line => 5)
|
470
|
-
assert_hash_has(err.sass_backtrace[2], :mixin => "foo", :line => 2)
|
471
|
-
end
|
472
|
-
|
473
|
-
def test_exception_css_with_offset
|
474
|
-
opts = {:full_exception => true, :line => 362}
|
475
|
-
render(("a\n b: c\n" * 10) + "d\n e:\n" + ("f\n g: h\n" * 10), opts)
|
476
|
-
rescue Sass::SyntaxError => e
|
477
|
-
assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e, opts).split("\n")[0..15].join("\n"))
|
478
|
-
/*
|
479
|
-
Syntax error: Invalid property: "e:" (no value).
|
480
|
-
on line 383 of test_exception_css_with_offset_inline.sass
|
481
|
-
|
482
|
-
378: a
|
483
|
-
379: b: c
|
484
|
-
380: a
|
485
|
-
381: b: c
|
486
|
-
382: d
|
487
|
-
383: e:
|
488
|
-
384: f
|
489
|
-
385: g: h
|
490
|
-
386: f
|
491
|
-
387: g: h
|
492
|
-
388: f
|
493
|
-
CSS
|
494
|
-
else
|
495
|
-
assert(false, "Exception not raised for test_exception_css_with_offset")
|
496
|
-
end
|
497
|
-
|
498
|
-
def test_exception_css_with_mixins
|
499
|
-
opts = {:full_exception => true}
|
500
|
-
render(<<SASS, opts)
|
501
|
-
=error-mixin($a)
|
502
|
-
color: $a * 1em * 1px
|
503
|
-
|
504
|
-
=outer-mixin($a)
|
505
|
-
+error-mixin($a)
|
506
|
-
|
507
|
-
.error
|
508
|
-
+outer-mixin(12)
|
509
|
-
SASS
|
510
|
-
rescue Sass::SyntaxError => e
|
511
|
-
assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e, opts).split("\n")[0..13].join("\n"))
|
512
|
-
/*
|
513
|
-
Syntax error: 12em*px isn't a valid CSS value.
|
514
|
-
on line 2 of test_exception_css_with_mixins_inline.sass, in `error-mixin'
|
515
|
-
from line 5 of test_exception_css_with_mixins_inline.sass, in `outer-mixin'
|
516
|
-
from line 8 of test_exception_css_with_mixins_inline.sass
|
517
|
-
|
518
|
-
1: =error-mixin($a)
|
519
|
-
2: color: $a * 1em * 1px
|
520
|
-
3:
|
521
|
-
4: =outer-mixin($a)
|
522
|
-
5: +error-mixin($a)
|
523
|
-
6:
|
524
|
-
7: .error
|
525
|
-
CSS
|
526
|
-
else
|
527
|
-
assert(false, "Exception not raised")
|
528
|
-
end
|
529
|
-
|
530
|
-
def test_cssize_exception_css
|
531
|
-
opts = {:full_exception => true}
|
532
|
-
render(<<SASS, opts)
|
533
|
-
.filler
|
534
|
-
stuff: "stuff!"
|
535
|
-
|
536
|
-
a: b
|
537
|
-
|
538
|
-
.more.filler
|
539
|
-
a: b
|
540
|
-
SASS
|
541
|
-
rescue Sass::SyntaxError => e
|
542
|
-
assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e, opts).split("\n")[0..11].join("\n"))
|
543
|
-
/*
|
544
|
-
Syntax error: Properties are only allowed within rules, directives, or other properties.
|
545
|
-
on line 4 of test_cssize_exception_css_inline.sass
|
546
|
-
|
547
|
-
1: .filler
|
548
|
-
2: stuff: "stuff!"
|
549
|
-
3:
|
550
|
-
4: a: b
|
551
|
-
5:
|
552
|
-
6: .more.filler
|
553
|
-
7: a: b
|
554
|
-
CSS
|
555
|
-
else
|
556
|
-
assert(false, "Exception not raised")
|
557
|
-
end
|
558
|
-
|
559
|
-
def test_css_import
|
560
|
-
assert_equal("@import url(./fonts.css);\n", render("@import \"./fonts.css\""))
|
561
|
-
end
|
562
|
-
|
563
|
-
def test_http_import
|
564
|
-
assert_equal("@import url(http://fonts.googleapis.com/css?family=Droid+Sans);\n",
|
565
|
-
render("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\""))
|
566
|
-
end
|
567
|
-
|
568
|
-
def test_http_import_with_interpolation
|
569
|
-
assert_equal("@import url(http://fonts.googleapis.com/css?family=Droid+Sans);\n",
|
570
|
-
render("$family: unquote(\"Droid+Sans\")\n@import \"http://fonts.googleapis.com/css?family=\#{$family}\"\n"))
|
571
|
-
assert_equal("@import url(\"http://fonts.googleapis.com/css?family=Droid+Sans\");\n",
|
572
|
-
render("$family: unquote(\"Droid+Sans\")\n@import url(\"http://fonts.googleapis.com/css?family=\#{$family}\")\n"))
|
573
|
-
end
|
574
|
-
|
575
|
-
def test_url_import
|
576
|
-
assert_equal("@import url(fonts.sass);\n", render("@import url(fonts.sass)"))
|
577
|
-
end
|
578
|
-
|
579
|
-
def test_sass_import
|
580
|
-
sassc_file = sassc_path("importee")
|
581
|
-
assert !File.exists?(sassc_file)
|
582
|
-
renders_correctly "import", { :style => :compact, :load_paths => [File.dirname(__FILE__) + "/templates"] }
|
583
|
-
assert File.exists?(sassc_file)
|
584
|
-
end
|
585
|
-
|
586
|
-
def test_sass_pathname_import
|
587
|
-
sassc_file = sassc_path("importee")
|
588
|
-
assert !File.exists?(sassc_file)
|
589
|
-
renders_correctly("import",
|
590
|
-
:style => :compact,
|
591
|
-
:load_paths => [Pathname.new(File.dirname(__FILE__) + "/templates")])
|
592
|
-
assert File.exists?(sassc_file)
|
593
|
-
end
|
594
|
-
|
595
|
-
def test_nonexistent_import
|
596
|
-
assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) do
|
597
|
-
File to import not found or unreadable: nonexistent.sass.
|
598
|
-
Load path: #{Dir.pwd}
|
599
|
-
ERR
|
600
|
-
render("@import nonexistent.sass")
|
601
|
-
end
|
602
|
-
end
|
603
|
-
|
604
|
-
def test_nonexistent_extensionless_import
|
605
|
-
assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) do
|
606
|
-
File to import not found or unreadable: nonexistent.
|
607
|
-
Load path: #{Dir.pwd}
|
608
|
-
ERR
|
609
|
-
render("@import nonexistent")
|
610
|
-
end
|
611
|
-
end
|
612
|
-
|
613
|
-
def test_no_cache
|
614
|
-
assert !File.exists?(sassc_path("importee"))
|
615
|
-
renders_correctly("import", {
|
616
|
-
:style => :compact, :cache => false,
|
617
|
-
:load_paths => [File.dirname(__FILE__) + "/templates"],
|
618
|
-
})
|
619
|
-
assert !File.exists?(sassc_path("importee"))
|
620
|
-
end
|
621
|
-
|
622
|
-
def test_import_in_rule
|
623
|
-
assert_equal(<<CSS, render(<<SASS, :load_paths => [File.dirname(__FILE__) + '/templates/']))
|
624
|
-
.foo #foo {
|
625
|
-
background-color: #bbaaff; }
|
626
|
-
|
627
|
-
.bar {
|
628
|
-
a: b; }
|
629
|
-
.bar #foo {
|
630
|
-
background-color: #bbaaff; }
|
631
|
-
CSS
|
632
|
-
.foo
|
633
|
-
@import partial
|
634
|
-
|
635
|
-
.bar
|
636
|
-
a: b
|
637
|
-
@import partial
|
638
|
-
SASS
|
639
|
-
end
|
640
|
-
|
641
|
-
def test_nested_import_with_toplevel_constructs
|
642
|
-
Sass::Engine.new(".foo\n @import importee", :load_paths => [File.dirname(__FILE__) + '/templates/']).render
|
643
|
-
rescue Sass::SyntaxError => err
|
644
|
-
assert_equal(3, err.sass_line)
|
645
|
-
assert_match(/(\/|^)importee\.sass$/, err.sass_filename)
|
646
|
-
|
647
|
-
assert_hash_has(err.sass_backtrace.first,
|
648
|
-
:filename => err.sass_filename, :line => err.sass_line)
|
649
|
-
|
650
|
-
assert_nil(err.sass_backtrace[1][:filename])
|
651
|
-
assert_equal(2, err.sass_backtrace[1][:line])
|
652
|
-
|
653
|
-
assert_match(/(\/|^)importee\.sass:3$/, err.backtrace.first)
|
654
|
-
assert_equal("(sass):2", err.backtrace[1])
|
655
|
-
else
|
656
|
-
assert(false, "Exception not raised for importing mixins nested")
|
657
|
-
end
|
658
|
-
|
659
|
-
def test_units
|
660
|
-
renders_correctly "units"
|
661
|
-
end
|
662
|
-
|
663
|
-
def test_default_function
|
664
|
-
assert_equal(<<CSS, render(<<SASS))
|
665
|
-
foo {
|
666
|
-
bar: url("foo.png"); }
|
667
|
-
CSS
|
668
|
-
foo
|
669
|
-
bar: url("foo.png")
|
670
|
-
SASS
|
671
|
-
assert_equal("foo {\n bar: url(); }\n", render("foo\n bar: url()\n"));
|
672
|
-
end
|
673
|
-
|
674
|
-
def test_string_minus
|
675
|
-
assert_equal("foo {\n bar: baz-boom-bat; }\n", render(%Q{foo\n bar: baz-boom-bat}))
|
676
|
-
assert_equal("foo {\n bar: -baz-boom; }\n", render(%Q{foo\n bar: -baz-boom}))
|
677
|
-
end
|
678
|
-
|
679
|
-
def test_string_div
|
680
|
-
assert_equal("foo {\n bar: baz/boom/bat; }\n", render(%Q{foo\n bar: baz/boom/bat}))
|
681
|
-
assert_equal("foo {\n bar: /baz/boom; }\n", render(%Q{foo\n bar: /baz/boom}))
|
682
|
-
end
|
683
|
-
|
684
|
-
def test_basic_multiline_selector
|
685
|
-
assert_equal("#foo #bar,\n#baz #boom {\n foo: bar; }\n",
|
686
|
-
render("#foo #bar,\n#baz #boom\n :foo bar"))
|
687
|
-
assert_equal("#foo #bar,\n#foo #baz {\n foo: bar; }\n",
|
688
|
-
render("#foo\n #bar,\n #baz\n :foo bar"))
|
689
|
-
assert_equal("#foo,\n#bar {\n foo: bar; }\n #foo #baz,\n #bar #baz {\n foo: bar; }\n",
|
690
|
-
render("#foo,\n#bar\n :foo bar\n #baz\n :foo bar"))
|
691
|
-
assert_equal("#foo #bar, #baz #boom { foo: bar; }\n",
|
692
|
-
render("#foo #bar,\n#baz #boom\n :foo bar", :style => :compact))
|
693
|
-
|
694
|
-
assert_equal("#foo #bar,#baz #boom{foo:bar}\n",
|
695
|
-
render("#foo #bar,\n#baz #boom\n :foo bar", :style => :compressed))
|
696
|
-
|
697
|
-
assert_equal("#foo #bar,\n#baz #boom {\n foo: bar; }\n",
|
698
|
-
render("#foo #bar,,\n,#baz #boom,\n :foo bar"))
|
699
|
-
|
700
|
-
assert_equal("#bip #bop {\n foo: bar; }\n",
|
701
|
-
render("#bip #bop,, ,\n :foo bar"))
|
702
|
-
end
|
703
|
-
|
704
|
-
def test_complex_multiline_selector
|
705
|
-
renders_correctly "multiline"
|
706
|
-
end
|
707
|
-
|
708
|
-
def test_colon_only
|
709
|
-
begin
|
710
|
-
render("a\n b: c", :property_syntax => :old)
|
711
|
-
rescue Sass::SyntaxError => e
|
712
|
-
assert_equal("Illegal property syntax: can't use new syntax when :property_syntax => :old is set.",
|
713
|
-
e.message)
|
714
|
-
assert_equal(2, e.sass_line)
|
715
|
-
else
|
716
|
-
assert(false, "SyntaxError not raised for :property_syntax => :old")
|
717
|
-
end
|
718
|
-
|
719
|
-
begin
|
720
|
-
render("a\n :b c", :property_syntax => :new)
|
721
|
-
assert_equal(2, e.sass_line)
|
722
|
-
rescue Sass::SyntaxError => e
|
723
|
-
assert_equal("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.",
|
724
|
-
e.message)
|
725
|
-
else
|
726
|
-
assert(false, "SyntaxError not raised for :property_syntax => :new")
|
727
|
-
end
|
728
|
-
end
|
729
|
-
|
730
|
-
def test_pseudo_elements
|
731
|
-
assert_equal(<<CSS, render(<<SASS))
|
732
|
-
::first-line {
|
733
|
-
size: 10em; }
|
734
|
-
CSS
|
735
|
-
::first-line
|
736
|
-
size: 10em
|
737
|
-
SASS
|
738
|
-
end
|
739
|
-
|
740
|
-
def test_directive
|
741
|
-
assert_equal("@a b;\n", render("@a b"))
|
742
|
-
|
743
|
-
assert_equal("@a {\n b: c; }\n", render("@a\n :b c"))
|
744
|
-
assert_equal("@a { b: c; }\n", render("@a\n :b c", :style => :compact))
|
745
|
-
assert_equal("@a {\n b: c;\n}\n", render("@a\n :b c", :style => :expanded))
|
746
|
-
assert_equal("@a{b:c}\n", render("@a\n :b c", :style => :compressed))
|
747
|
-
|
748
|
-
assert_equal("@a {\n b: c;\n d: e; }\n",
|
749
|
-
render("@a\n :b c\n :d e"))
|
750
|
-
assert_equal("@a { b: c; d: e; }\n",
|
751
|
-
render("@a\n :b c\n :d e", :style => :compact))
|
752
|
-
assert_equal("@a {\n b: c;\n d: e;\n}\n",
|
753
|
-
render("@a\n :b c\n :d e", :style => :expanded))
|
754
|
-
assert_equal("@a{b:c;d:e}\n",
|
755
|
-
render("@a\n :b c\n :d e", :style => :compressed))
|
756
|
-
|
757
|
-
assert_equal("@a {\n #b {\n c: d; } }\n",
|
758
|
-
render("@a\n #b\n :c d"))
|
759
|
-
assert_equal("@a { #b { c: d; } }\n",
|
760
|
-
render("@a\n #b\n :c d", :style => :compact))
|
761
|
-
assert_equal("@a {\n #b {\n c: d;\n }\n}\n",
|
762
|
-
render("@a\n #b\n :c d", :style => :expanded))
|
763
|
-
assert_equal("@a{#b{c:d}}\n",
|
764
|
-
render("@a\n #b\n :c d", :style => :compressed))
|
765
|
-
|
766
|
-
assert_equal("@a {\n #b {\n a: b; }\n #b #c {\n d: e; } }\n",
|
767
|
-
render("@a\n #b\n :a b\n #c\n :d e"))
|
768
|
-
assert_equal("@a { #b { a: b; }\n #b #c { d: e; } }\n",
|
769
|
-
render("@a\n #b\n :a b\n #c\n :d e", :style => :compact))
|
770
|
-
assert_equal("@a {\n #b {\n a: b;\n }\n #b #c {\n d: e;\n }\n}\n",
|
771
|
-
render("@a\n #b\n :a b\n #c\n :d e", :style => :expanded))
|
772
|
-
assert_equal("@a{#b{a:b}#b #c{d:e}}\n",
|
773
|
-
render("@a\n #b\n :a b\n #c\n :d e", :style => :compressed))
|
774
|
-
|
775
|
-
assert_equal("@a {\n #foo,\n #bar {\n b: c; } }\n",
|
776
|
-
render("@a\n #foo, \n #bar\n :b c"))
|
777
|
-
assert_equal("@a { #foo, #bar { b: c; } }\n",
|
778
|
-
render("@a\n #foo, \n #bar\n :b c", :style => :compact))
|
779
|
-
assert_equal("@a {\n #foo,\n #bar {\n b: c;\n }\n}\n",
|
780
|
-
render("@a\n #foo, \n #bar\n :b c", :style => :expanded))
|
781
|
-
assert_equal("@a{#foo,#bar{b:c}}\n",
|
782
|
-
render("@a\n #foo, \n #bar\n :b c", :style => :compressed))
|
783
|
-
|
784
|
-
to_render = <<END
|
785
|
-
@a
|
786
|
-
:b c
|
787
|
-
#d
|
788
|
-
:e f
|
789
|
-
:g h
|
790
|
-
END
|
791
|
-
rendered = <<END
|
792
|
-
@a { b: c;
|
793
|
-
#d { e: f; }
|
794
|
-
g: h; }
|
795
|
-
END
|
796
|
-
assert_equal(rendered, render(to_render, :style => :compact))
|
797
|
-
|
798
|
-
assert_equal("@a{b:c;#d{e:f}g:h}\n", render(to_render, :style => :compressed))
|
799
|
-
end
|
800
|
-
|
801
|
-
def test_property_hacks
|
802
|
-
assert_equal(<<CSS, render(<<SASS))
|
803
|
-
foo {
|
804
|
-
_name: val;
|
805
|
-
*name: val;
|
806
|
-
#name: val;
|
807
|
-
.name: val;
|
808
|
-
name/**/: val;
|
809
|
-
name/*\\**/: val;
|
810
|
-
name: val; }
|
811
|
-
CSS
|
812
|
-
foo
|
813
|
-
_name: val
|
814
|
-
*name: val
|
815
|
-
#name: val
|
816
|
-
.name: val
|
817
|
-
name/**/: val
|
818
|
-
name/*\\**/: val
|
819
|
-
name: val
|
820
|
-
SASS
|
821
|
-
end
|
822
|
-
|
823
|
-
def test_properties_with_space_after_colon
|
824
|
-
assert_equal <<CSS, render(<<SASS)
|
825
|
-
foo {
|
826
|
-
bar: baz;
|
827
|
-
bizz: bap; }
|
828
|
-
CSS
|
829
|
-
foo
|
830
|
-
bar : baz
|
831
|
-
bizz : bap
|
832
|
-
SASS
|
833
|
-
end
|
834
|
-
|
835
|
-
def test_line_annotations
|
836
|
-
assert_equal(<<CSS, render(<<SASS, :line_comments => true, :style => :compact))
|
837
|
-
/* line 2, test_line_annotations_inline.sass */
|
838
|
-
foo bar { foo: bar; }
|
839
|
-
/* line 5, test_line_annotations_inline.sass */
|
840
|
-
foo baz { blip: blop; }
|
841
|
-
|
842
|
-
/* line 9, test_line_annotations_inline.sass */
|
843
|
-
floodle { flop: blop; }
|
844
|
-
|
845
|
-
/* line 18, test_line_annotations_inline.sass */
|
846
|
-
bup { mix: on; }
|
847
|
-
/* line 15, test_line_annotations_inline.sass */
|
848
|
-
bup mixin { moop: mup; }
|
849
|
-
|
850
|
-
/* line 22, test_line_annotations_inline.sass */
|
851
|
-
bip hop, skip hop { a: b; }
|
852
|
-
CSS
|
853
|
-
foo
|
854
|
-
bar
|
855
|
-
foo: bar
|
856
|
-
|
857
|
-
baz
|
858
|
-
blip: blop
|
859
|
-
|
860
|
-
|
861
|
-
floodle
|
862
|
-
|
863
|
-
flop: blop
|
864
|
-
|
865
|
-
=mxn
|
866
|
-
mix: on
|
867
|
-
mixin
|
868
|
-
moop: mup
|
869
|
-
|
870
|
-
bup
|
871
|
-
+mxn
|
872
|
-
|
873
|
-
bip, skip
|
874
|
-
hop
|
875
|
-
a: b
|
876
|
-
SASS
|
877
|
-
end
|
878
|
-
|
879
|
-
def test_line_annotations_with_filename
|
880
|
-
renders_correctly "line_numbers", :line_comments => true, :load_paths => [File.dirname(__FILE__) + "/templates"]
|
881
|
-
end
|
882
|
-
|
883
|
-
def test_debug_info
|
884
|
-
esc_file_name = Sass::SCSS::RX.escape_ident(Sass::Util.scope("test_debug_info_inline.sass"))
|
885
|
-
|
886
|
-
assert_equal(<<CSS, render(<<SASS, :debug_info => true, :style => :compact))
|
887
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\000032}}
|
888
|
-
foo bar { foo: bar; }
|
889
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\000035}}
|
890
|
-
foo baz { blip: blop; }
|
891
|
-
|
892
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\000039}}
|
893
|
-
floodle { flop: blop; }
|
894
|
-
|
895
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\0000318}}
|
896
|
-
bup { mix: on; }
|
897
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\0000315}}
|
898
|
-
bup mixin { moop: mup; }
|
899
|
-
|
900
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\0000322}}
|
901
|
-
bip hop, skip hop { a: b; }
|
902
|
-
CSS
|
903
|
-
foo
|
904
|
-
bar
|
905
|
-
foo: bar
|
906
|
-
|
907
|
-
baz
|
908
|
-
blip: blop
|
909
|
-
|
910
|
-
|
911
|
-
floodle
|
912
|
-
|
913
|
-
flop: blop
|
914
|
-
|
915
|
-
=mxn
|
916
|
-
mix: on
|
917
|
-
mixin
|
918
|
-
moop: mup
|
919
|
-
|
920
|
-
bup
|
921
|
-
+mxn
|
922
|
-
|
923
|
-
bip, skip
|
924
|
-
hop
|
925
|
-
a: b
|
926
|
-
SASS
|
927
|
-
end
|
928
|
-
|
929
|
-
def test_debug_info_without_filename
|
930
|
-
assert_equal(<<CSS, Sass::Engine.new(<<SASS, :debug_info => true).render)
|
931
|
-
@media -sass-debug-info{filename{font-family:}line{font-family:\\000031}}
|
932
|
-
foo {
|
933
|
-
a: b; }
|
934
|
-
CSS
|
935
|
-
foo
|
936
|
-
a: b
|
937
|
-
SASS
|
938
|
-
end
|
939
|
-
|
940
|
-
def test_debug_info_with_compressed
|
941
|
-
assert_equal(<<CSS, render(<<SASS, :debug_info => true, :style => :compressed))
|
942
|
-
foo{a:b}
|
943
|
-
CSS
|
944
|
-
foo
|
945
|
-
a: b
|
946
|
-
SASS
|
947
|
-
end
|
948
|
-
|
949
|
-
def test_debug_info_with_line_annotations
|
950
|
-
esc_file_name = Sass::SCSS::RX.escape_ident(Sass::Util.scope("test_debug_info_with_line_annotations_inline.sass"))
|
951
|
-
|
952
|
-
assert_equal(<<CSS, render(<<SASS, :debug_info => true, :line_comments => true))
|
953
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\000031}}
|
954
|
-
foo {
|
955
|
-
a: b; }
|
956
|
-
CSS
|
957
|
-
foo
|
958
|
-
a: b
|
959
|
-
SASS
|
960
|
-
end
|
961
|
-
|
962
|
-
def test_empty_first_line
|
963
|
-
assert_equal("#a {\n b: c; }\n", render("#a\n\n b: c"))
|
964
|
-
end
|
965
|
-
|
966
|
-
def test_escaped_rule
|
967
|
-
assert_equal(":focus {\n a: b; }\n", render("\\:focus\n a: b"))
|
968
|
-
assert_equal("a {\n b: c; }\n a :focus {\n d: e; }\n", render("\\a\n b: c\n \\:focus\n d: e"))
|
969
|
-
end
|
970
|
-
|
971
|
-
def test_cr_newline
|
972
|
-
assert_equal("foo {\n a: b;\n c: d;\n e: f; }\n", render("foo\r a: b\r\n c: d\n\r e: f"))
|
973
|
-
end
|
974
|
-
|
975
|
-
def test_property_with_content_and_nested_props
|
976
|
-
assert_equal(<<CSS, render(<<SASS))
|
977
|
-
foo {
|
978
|
-
a: b;
|
979
|
-
a-c: d;
|
980
|
-
a-c-e: f; }
|
981
|
-
CSS
|
982
|
-
foo
|
983
|
-
a: b
|
984
|
-
c: d
|
985
|
-
e: f
|
986
|
-
SASS
|
987
|
-
|
988
|
-
assert_equal(<<CSS, render(<<SASS))
|
989
|
-
foo {
|
990
|
-
a: b;
|
991
|
-
a-c-e: f; }
|
992
|
-
CSS
|
993
|
-
foo
|
994
|
-
a: b
|
995
|
-
c:
|
996
|
-
e: f
|
997
|
-
SASS
|
998
|
-
end
|
999
|
-
|
1000
|
-
def test_guarded_assign
|
1001
|
-
assert_equal("foo {\n a: b; }\n", render(%Q{$foo: b\n$foo: c !default\nfoo\n a: $foo}))
|
1002
|
-
assert_equal("foo {\n a: b; }\n", render(%Q{$foo: b !default\nfoo\n a: $foo}))
|
1003
|
-
end
|
1004
|
-
|
1005
|
-
def test_mixins
|
1006
|
-
renders_correctly "mixins", { :style => :expanded }
|
1007
|
-
end
|
1008
|
-
|
1009
|
-
def test_directive_style_mixins
|
1010
|
-
assert_equal <<CSS, render(<<SASS)
|
1011
|
-
bar {
|
1012
|
-
prop: baz; }
|
1013
|
-
CSS
|
1014
|
-
@mixin foo($arg)
|
1015
|
-
prop: $arg
|
1016
|
-
|
1017
|
-
bar
|
1018
|
-
@include foo(baz)
|
1019
|
-
SASS
|
1020
|
-
end
|
1021
|
-
|
1022
|
-
def test_mixins_dont_interfere_with_sibling_combinator
|
1023
|
-
assert_equal("foo + bar {\n a: b; }\nfoo + baz {\n c: d; }\n",
|
1024
|
-
render("foo\n +\n bar\n a: b\n baz\n c: d"))
|
1025
|
-
end
|
1026
|
-
|
1027
|
-
def test_mixin_args
|
1028
|
-
assert_equal("blat {\n baz: hi; }\n", render(<<SASS))
|
1029
|
-
=foo($bar)
|
1030
|
-
baz: $bar
|
1031
|
-
blat
|
1032
|
-
+foo(hi)
|
1033
|
-
SASS
|
1034
|
-
assert_equal("blat {\n baz: 3; }\n", render(<<SASS))
|
1035
|
-
=foo($a, $b)
|
1036
|
-
baz: $a + $b
|
1037
|
-
blat
|
1038
|
-
+foo(1, 2)
|
1039
|
-
SASS
|
1040
|
-
assert_equal("blat {\n baz: 4;\n baz: 3;\n baz: 5;\n bang: 3; }\n", render(<<SASS))
|
1041
|
-
=foo($c: (6 + 4) / 2)
|
1042
|
-
baz: $c
|
1043
|
-
$c: 3
|
1044
|
-
blat
|
1045
|
-
+foo($c + 1)
|
1046
|
-
+foo(($c + 3)/2)
|
1047
|
-
+foo
|
1048
|
-
bang: $c
|
1049
|
-
SASS
|
1050
|
-
end
|
1051
|
-
|
1052
|
-
def test_default_values_for_mixin_arguments
|
1053
|
-
assert_equal("white {\n color: white; }\n\nblack {\n color: black; }\n", render(<<SASS))
|
1054
|
-
=foo($a: #FFF)
|
1055
|
-
:color $a
|
1056
|
-
white
|
1057
|
-
+foo
|
1058
|
-
black
|
1059
|
-
+foo(#000)
|
1060
|
-
SASS
|
1061
|
-
assert_equal(<<CSS, render(<<SASS))
|
1062
|
-
one {
|
1063
|
-
color: white;
|
1064
|
-
padding: 1px;
|
1065
|
-
margin: 4px; }
|
1066
|
-
|
1067
|
-
two {
|
1068
|
-
color: white;
|
1069
|
-
padding: 2px;
|
1070
|
-
margin: 5px; }
|
1071
|
-
|
1072
|
-
three {
|
1073
|
-
color: white;
|
1074
|
-
padding: 2px;
|
1075
|
-
margin: 3px; }
|
1076
|
-
CSS
|
1077
|
-
$a: 5px
|
1078
|
-
=foo($a, $b: 1px, $c: 3px + $b)
|
1079
|
-
:color $a
|
1080
|
-
:padding $b
|
1081
|
-
:margin $c
|
1082
|
-
one
|
1083
|
-
+foo(#fff)
|
1084
|
-
two
|
1085
|
-
+foo(#fff, 2px)
|
1086
|
-
three
|
1087
|
-
+foo(#fff, 2px, 3px)
|
1088
|
-
SASS
|
1089
|
-
end
|
1090
|
-
|
1091
|
-
def test_hyphen_underscore_insensitive_mixins
|
1092
|
-
assert_equal(<<CSS, render(<<SASS))
|
1093
|
-
a {
|
1094
|
-
b: 12;
|
1095
|
-
c: foo; }
|
1096
|
-
CSS
|
1097
|
-
=mixin-hyphen
|
1098
|
-
b: 12
|
1099
|
-
|
1100
|
-
=mixin_under
|
1101
|
-
c: foo
|
1102
|
-
|
1103
|
-
a
|
1104
|
-
+mixin_hyphen
|
1105
|
-
+mixin-under
|
1106
|
-
SASS
|
1107
|
-
end
|
1108
|
-
|
1109
|
-
def test_css_identifier_mixin
|
1110
|
-
assert_equal(<<CSS, render(<<SASS))
|
1111
|
-
a {
|
1112
|
-
foo: 12; }
|
1113
|
-
CSS
|
1114
|
-
=\\{foo\\(12\\)($a)
|
1115
|
-
foo: $a
|
1116
|
-
|
1117
|
-
a
|
1118
|
-
+\\{foo\\(12\\)(12)
|
1119
|
-
SASS
|
1120
|
-
end
|
1121
|
-
|
1122
|
-
def test_basic_function
|
1123
|
-
assert_equal(<<CSS, render(<<SASS))
|
1124
|
-
bar {
|
1125
|
-
a: 3; }
|
1126
|
-
CSS
|
1127
|
-
@function foo()
|
1128
|
-
@return 1 + 2
|
1129
|
-
|
1130
|
-
bar
|
1131
|
-
a: foo()
|
1132
|
-
SASS
|
1133
|
-
end
|
1134
|
-
|
1135
|
-
def test_function_args
|
1136
|
-
assert_equal(<<CSS, render(<<SASS))
|
1137
|
-
bar {
|
1138
|
-
a: 3; }
|
1139
|
-
CSS
|
1140
|
-
@function plus($var1, $var2)
|
1141
|
-
@return $var1 + $var2
|
1142
|
-
|
1143
|
-
bar
|
1144
|
-
a: plus(1, 2)
|
1145
|
-
SASS
|
1146
|
-
end
|
1147
|
-
|
1148
|
-
def test_function_arg_default
|
1149
|
-
assert_equal(<<CSS, render(<<SASS))
|
1150
|
-
bar {
|
1151
|
-
a: 3; }
|
1152
|
-
CSS
|
1153
|
-
@function plus($var1, $var2: 2)
|
1154
|
-
@return $var1 + $var2
|
1155
|
-
|
1156
|
-
bar
|
1157
|
-
a: plus(1)
|
1158
|
-
SASS
|
1159
|
-
end
|
1160
|
-
|
1161
|
-
def test_function_arg_keyword
|
1162
|
-
assert_equal(<<CSS, render(<<SASS))
|
1163
|
-
bar {
|
1164
|
-
a: 1bar; }
|
1165
|
-
CSS
|
1166
|
-
@function plus($var1: 1, $var2: 2)
|
1167
|
-
@return $var1 + $var2
|
1168
|
-
|
1169
|
-
bar
|
1170
|
-
a: plus($var2: bar)
|
1171
|
-
SASS
|
1172
|
-
end
|
1173
|
-
|
1174
|
-
def test_function_with_if
|
1175
|
-
assert_equal(<<CSS, render(<<SASS))
|
1176
|
-
bar {
|
1177
|
-
a: foo;
|
1178
|
-
b: bar; }
|
1179
|
-
CSS
|
1180
|
-
@function my-if($cond, $val1, $val2)
|
1181
|
-
@if $cond
|
1182
|
-
@return $val1
|
1183
|
-
@else
|
1184
|
-
@return $val2
|
1185
|
-
|
1186
|
-
bar
|
1187
|
-
a: my-if(true, foo, bar)
|
1188
|
-
b: my-if(false, foo, bar)
|
1189
|
-
SASS
|
1190
|
-
end
|
1191
|
-
|
1192
|
-
def test_function_with_var
|
1193
|
-
assert_equal(<<CSS, render(<<SASS))
|
1194
|
-
bar {
|
1195
|
-
a: 1; }
|
1196
|
-
CSS
|
1197
|
-
@function foo($val1, $val2)
|
1198
|
-
$intermediate: $val1 + $val2
|
1199
|
-
@return $intermediate/3
|
1200
|
-
|
1201
|
-
bar
|
1202
|
-
a: foo(1, 2)
|
1203
|
-
SASS
|
1204
|
-
end
|
1205
|
-
|
1206
|
-
def test_control_directive_in_nested_property
|
1207
|
-
assert_equal(<<CSS, render(<<SASS))
|
1208
|
-
foo {
|
1209
|
-
a-b: c; }
|
1210
|
-
CSS
|
1211
|
-
foo
|
1212
|
-
a:
|
1213
|
-
@if true
|
1214
|
-
b: c
|
1215
|
-
SASS
|
1216
|
-
end
|
1217
|
-
|
1218
|
-
def test_interpolation
|
1219
|
-
assert_equal("a-1 {\n b-2-3: c-3; }\n", render(<<SASS))
|
1220
|
-
$a: 1
|
1221
|
-
$b: 2
|
1222
|
-
$c: 3
|
1223
|
-
a-\#{$a}
|
1224
|
-
b-\#{$b}-\#{$c}: c-\#{$a + $b}
|
1225
|
-
SASS
|
1226
|
-
end
|
1227
|
-
|
1228
|
-
def test_complex_property_interpolation
|
1229
|
-
assert_equal(<<CSS, render(<<SASS))
|
1230
|
-
a-1 {
|
1231
|
-
b-2 3-fizzap18: c-3; }
|
1232
|
-
CSS
|
1233
|
-
$a: 1
|
1234
|
-
$b: 2
|
1235
|
-
$c: 3
|
1236
|
-
a-\#{$a}
|
1237
|
-
b-\#{$b $c}-\#{fizzap + ($c + 15)}: c-\#{$a + $b}
|
1238
|
-
SASS
|
1239
|
-
end
|
1240
|
-
|
1241
|
-
def test_if_directive
|
1242
|
-
assert_equal("a {\n b: 1; }\n", render(<<SASS))
|
1243
|
-
$var: true
|
1244
|
-
a
|
1245
|
-
@if $var
|
1246
|
-
b: 1
|
1247
|
-
@if not $var
|
1248
|
-
b: 2
|
1249
|
-
SASS
|
1250
|
-
end
|
1251
|
-
|
1252
|
-
def test_for
|
1253
|
-
assert_equal(<<CSS, render(<<SASS))
|
1254
|
-
a-0 {
|
1255
|
-
two-i: 0; }
|
1256
|
-
|
1257
|
-
a-1 {
|
1258
|
-
two-i: 2; }
|
1259
|
-
|
1260
|
-
a-2 {
|
1261
|
-
two-i: 4; }
|
1262
|
-
|
1263
|
-
a-3 {
|
1264
|
-
two-i: 6; }
|
1265
|
-
|
1266
|
-
b-1 {
|
1267
|
-
j-1: 0; }
|
1268
|
-
|
1269
|
-
b-2 {
|
1270
|
-
j-1: 1; }
|
1271
|
-
|
1272
|
-
b-3 {
|
1273
|
-
j-1: 2; }
|
1274
|
-
|
1275
|
-
b-4 {
|
1276
|
-
j-1: 3; }
|
1277
|
-
CSS
|
1278
|
-
$a: 3
|
1279
|
-
@for $i from 0 to $a + 1
|
1280
|
-
a-\#{$i}
|
1281
|
-
two-i: 2 * $i
|
1282
|
-
|
1283
|
-
@for $j from 1 through 4
|
1284
|
-
b-\#{$j}
|
1285
|
-
j-1: $j - 1
|
1286
|
-
SASS
|
1287
|
-
end
|
1288
|
-
|
1289
|
-
def test_while
|
1290
|
-
assert_equal(<<CSS, render(<<SASS))
|
1291
|
-
a-5 {
|
1292
|
-
blooble: gloop; }
|
1293
|
-
|
1294
|
-
a-4 {
|
1295
|
-
blooble: gloop; }
|
1296
|
-
|
1297
|
-
a-3 {
|
1298
|
-
blooble: gloop; }
|
1299
|
-
|
1300
|
-
a-2 {
|
1301
|
-
blooble: gloop; }
|
1302
|
-
|
1303
|
-
a-1 {
|
1304
|
-
blooble: gloop; }
|
1305
|
-
CSS
|
1306
|
-
$a: 5
|
1307
|
-
@while $a != 0
|
1308
|
-
a-\#{$a}
|
1309
|
-
blooble: gloop
|
1310
|
-
$a: $a - 1
|
1311
|
-
SASS
|
1312
|
-
end
|
1313
|
-
|
1314
|
-
def test_else
|
1315
|
-
assert_equal(<<CSS, render(<<SASS))
|
1316
|
-
a {
|
1317
|
-
t1: t;
|
1318
|
-
t2: t;
|
1319
|
-
t3: t;
|
1320
|
-
t4: t; }
|
1321
|
-
CSS
|
1322
|
-
a
|
1323
|
-
@if true
|
1324
|
-
t1: t
|
1325
|
-
@else
|
1326
|
-
f1: f
|
1327
|
-
|
1328
|
-
@if false
|
1329
|
-
f2: f
|
1330
|
-
@else
|
1331
|
-
t2: t
|
1332
|
-
|
1333
|
-
@if false
|
1334
|
-
f3: f1
|
1335
|
-
@else if 1 + 1 == 3
|
1336
|
-
f3: f2
|
1337
|
-
@else
|
1338
|
-
t3: t
|
1339
|
-
|
1340
|
-
@if false
|
1341
|
-
f4: f1
|
1342
|
-
@else if 1 + 1 == 2
|
1343
|
-
t4: t
|
1344
|
-
@else
|
1345
|
-
f4: f2
|
1346
|
-
|
1347
|
-
@if false
|
1348
|
-
f5: f1
|
1349
|
-
@else if false
|
1350
|
-
f5: f2
|
1351
|
-
SASS
|
1352
|
-
end
|
1353
|
-
|
1354
|
-
def test_each
|
1355
|
-
assert_equal(<<CSS, render(<<SASS))
|
1356
|
-
a {
|
1357
|
-
b: 1px;
|
1358
|
-
b: 2px;
|
1359
|
-
b: 3px;
|
1360
|
-
b: 4px;
|
1361
|
-
c: foo;
|
1362
|
-
c: bar;
|
1363
|
-
c: baz;
|
1364
|
-
c: bang;
|
1365
|
-
d: blue; }
|
1366
|
-
CSS
|
1367
|
-
a
|
1368
|
-
@each $number in 1px 2px 3px 4px
|
1369
|
-
b: $number
|
1370
|
-
@each $str in foo, bar, baz, bang
|
1371
|
-
c: $str
|
1372
|
-
@each $single in blue
|
1373
|
-
d: $single
|
1374
|
-
SASS
|
1375
|
-
end
|
1376
|
-
|
1377
|
-
def test_variable_reassignment
|
1378
|
-
assert_equal(<<CSS, render(<<SASS))
|
1379
|
-
a {
|
1380
|
-
b: 1;
|
1381
|
-
c: 2; }
|
1382
|
-
CSS
|
1383
|
-
$a: 1
|
1384
|
-
a
|
1385
|
-
b: $a
|
1386
|
-
$a: 2
|
1387
|
-
c: $a
|
1388
|
-
SASS
|
1389
|
-
end
|
1390
|
-
|
1391
|
-
def test_variable_scope
|
1392
|
-
assert_equal(<<CSS, render(<<SASS))
|
1393
|
-
a {
|
1394
|
-
b-1: c;
|
1395
|
-
b-2: c;
|
1396
|
-
d: 12; }
|
1397
|
-
|
1398
|
-
b {
|
1399
|
-
d: 17; }
|
1400
|
-
CSS
|
1401
|
-
$i: 12
|
1402
|
-
a
|
1403
|
-
@for $i from 1 through 2
|
1404
|
-
b-\#{$i}: c
|
1405
|
-
d: $i
|
1406
|
-
|
1407
|
-
=foo
|
1408
|
-
$i: 17
|
1409
|
-
|
1410
|
-
b
|
1411
|
-
+foo
|
1412
|
-
d: $i
|
1413
|
-
SASS
|
1414
|
-
end
|
1415
|
-
|
1416
|
-
def test_hyphen_underscore_insensitive_variables
|
1417
|
-
assert_equal(<<CSS, render(<<SASS))
|
1418
|
-
a {
|
1419
|
-
b: c; }
|
1420
|
-
|
1421
|
-
d {
|
1422
|
-
e: 13;
|
1423
|
-
f: foobar; }
|
1424
|
-
CSS
|
1425
|
-
$var-hyphen: 12
|
1426
|
-
$var_under: foo
|
1427
|
-
|
1428
|
-
a
|
1429
|
-
$var_hyphen: 1 + $var_hyphen
|
1430
|
-
$var-under: $var-under + bar
|
1431
|
-
b: c
|
1432
|
-
|
1433
|
-
d
|
1434
|
-
e: $var-hyphen
|
1435
|
-
f: $var_under
|
1436
|
-
SASS
|
1437
|
-
end
|
1438
|
-
|
1439
|
-
def test_css_identifier_variable
|
1440
|
-
assert_equal(<<CSS, render(<<SASS))
|
1441
|
-
a {
|
1442
|
-
b: 12; }
|
1443
|
-
CSS
|
1444
|
-
$\\{foo\\(12\\): 12
|
1445
|
-
|
1446
|
-
a
|
1447
|
-
b: $\\{foo\\(12\\)
|
1448
|
-
SASS
|
1449
|
-
end
|
1450
|
-
|
1451
|
-
def test_important
|
1452
|
-
assert_equal(<<CSS, render(<<SASS))
|
1453
|
-
a {
|
1454
|
-
b: 12px !important; }
|
1455
|
-
CSS
|
1456
|
-
$foo: 12px
|
1457
|
-
a
|
1458
|
-
b: $foo !important
|
1459
|
-
SASS
|
1460
|
-
end
|
1461
|
-
|
1462
|
-
def test_argument_error
|
1463
|
-
assert_raise(Sass::SyntaxError) { render("a\n b: hsl(1)") }
|
1464
|
-
end
|
1465
|
-
|
1466
|
-
def test_comments_at_the_top_of_a_document
|
1467
|
-
render(<<SASS)
|
1468
|
-
//
|
1469
|
-
This is a comment that
|
1470
|
-
continues to the second line.
|
1471
|
-
foo
|
1472
|
-
bar: baz
|
1473
|
-
SASS
|
1474
|
-
end
|
1475
|
-
|
1476
|
-
def test_loud_comments_containing_a_comment_close
|
1477
|
-
actual_css = render(<<SASS)
|
1478
|
-
/*
|
1479
|
-
This is a comment that
|
1480
|
-
continues to the second line. */
|
1481
|
-
foo
|
1482
|
-
bar: baz
|
1483
|
-
SASS
|
1484
|
-
assert_equal(<<CSS, actual_css)
|
1485
|
-
/* This is a comment that
|
1486
|
-
* continues to the second line. */
|
1487
|
-
foo {
|
1488
|
-
bar: baz; }
|
1489
|
-
CSS
|
1490
|
-
end
|
1491
|
-
|
1492
|
-
def test_loud_comments_with_starred_lines
|
1493
|
-
assert_equal(<<CSS, render(<<SASS))
|
1494
|
-
/* This is a comment that
|
1495
|
-
* continues to the second line.
|
1496
|
-
* And even to the third! */
|
1497
|
-
CSS
|
1498
|
-
/* This is a comment that
|
1499
|
-
* continues to the second line.
|
1500
|
-
* And even to the third!
|
1501
|
-
SASS
|
1502
|
-
end
|
1503
|
-
|
1504
|
-
def test_loud_comments_with_no_space_after_starred_lines
|
1505
|
-
assert_equal(<<CSS, render(<<SASS))
|
1506
|
-
/*bip bop
|
1507
|
-
*beep boop
|
1508
|
-
*bap blimp */
|
1509
|
-
CSS
|
1510
|
-
/*bip bop
|
1511
|
-
*beep boop
|
1512
|
-
*bap blimp
|
1513
|
-
SASS
|
1514
|
-
end
|
1515
|
-
|
1516
|
-
def test_comment_indentation_at_beginning_of_doc
|
1517
|
-
assert_equal <<CSS, render(<<SASS)
|
1518
|
-
/* foo
|
1519
|
-
* bar
|
1520
|
-
* baz */
|
1521
|
-
foo {
|
1522
|
-
a: b; }
|
1523
|
-
CSS
|
1524
|
-
/* foo
|
1525
|
-
bar
|
1526
|
-
baz
|
1527
|
-
foo
|
1528
|
-
a: b
|
1529
|
-
SASS
|
1530
|
-
end
|
1531
|
-
|
1532
|
-
def test_unusual_comment_indentation
|
1533
|
-
assert_equal <<CSS, render(<<SASS)
|
1534
|
-
foo {
|
1535
|
-
/* foo
|
1536
|
-
* bar
|
1537
|
-
* baz */ }
|
1538
|
-
CSS
|
1539
|
-
foo
|
1540
|
-
/* foo
|
1541
|
-
bar
|
1542
|
-
baz
|
1543
|
-
SASS
|
1544
|
-
end
|
1545
|
-
|
1546
|
-
def test_loud_comment_with_close
|
1547
|
-
assert_equal <<CSS, render(<<SASS)
|
1548
|
-
foo {
|
1549
|
-
/* foo
|
1550
|
-
* bar */ }
|
1551
|
-
CSS
|
1552
|
-
foo
|
1553
|
-
/* foo
|
1554
|
-
bar */
|
1555
|
-
SASS
|
1556
|
-
end
|
1557
|
-
|
1558
|
-
def test_loud_comment_with_separate_line_close
|
1559
|
-
assert_equal <<CSS, render(<<SASS)
|
1560
|
-
foo {
|
1561
|
-
/* foo
|
1562
|
-
* bar
|
1563
|
-
*/ }
|
1564
|
-
CSS
|
1565
|
-
foo
|
1566
|
-
/* foo
|
1567
|
-
* bar
|
1568
|
-
*/
|
1569
|
-
SASS
|
1570
|
-
end
|
1571
|
-
|
1572
|
-
def test_loud_comment_in_compressed_mode
|
1573
|
-
assert_equal <<CSS, render(<<SASS, :style => :compressed)
|
1574
|
-
foo{color:blue;/* foo
|
1575
|
-
* bar
|
1576
|
-
*/}
|
1577
|
-
CSS
|
1578
|
-
foo
|
1579
|
-
color: blue
|
1580
|
-
/*! foo
|
1581
|
-
* bar
|
1582
|
-
*/
|
1583
|
-
SASS
|
1584
|
-
end
|
1585
|
-
|
1586
|
-
def test_loud_comment_in_silent_comment
|
1587
|
-
silence_warnings {assert_equal <<CSS, render(<<SASS, :style => :compressed)}
|
1588
|
-
foo{color:blue;/* foo */
|
1589
|
-
/* bar */
|
1590
|
-
/* bip */
|
1591
|
-
/* baz */}
|
1592
|
-
CSS
|
1593
|
-
foo
|
1594
|
-
color: blue
|
1595
|
-
//! foo
|
1596
|
-
//! bar
|
1597
|
-
//!
|
1598
|
-
bip
|
1599
|
-
baz
|
1600
|
-
SASS
|
1601
|
-
end
|
1602
|
-
|
1603
|
-
def test_loud_comment_is_evaluated
|
1604
|
-
assert_equal <<CSS, render(<<SASS)
|
1605
|
-
/* Hue: 327.216deg */
|
1606
|
-
CSS
|
1607
|
-
/*!
|
1608
|
-
Hue: \#{hue(#f836a0)}
|
1609
|
-
SASS
|
1610
|
-
end
|
1611
|
-
|
1612
|
-
def test_attribute_selector_with_spaces
|
1613
|
-
assert_equal(<<CSS, render(<<SASS))
|
1614
|
-
a b[foo=bar] {
|
1615
|
-
c: d; }
|
1616
|
-
CSS
|
1617
|
-
a
|
1618
|
-
b[foo = bar]
|
1619
|
-
c: d
|
1620
|
-
SASS
|
1621
|
-
end
|
1622
|
-
|
1623
|
-
def test_quoted_colon
|
1624
|
-
assert_equal(<<CSS, render(<<SASS))
|
1625
|
-
a b[foo="bar: baz"] {
|
1626
|
-
c: d; }
|
1627
|
-
CSS
|
1628
|
-
a
|
1629
|
-
b[foo="bar: baz"]
|
1630
|
-
c: d
|
1631
|
-
SASS
|
1632
|
-
end
|
1633
|
-
|
1634
|
-
def test_quoted_comma
|
1635
|
-
assert_equal(<<CSS, render(<<SASS))
|
1636
|
-
a b[foo="bar, baz"] {
|
1637
|
-
c: d; }
|
1638
|
-
CSS
|
1639
|
-
a
|
1640
|
-
b[foo="bar, baz"]
|
1641
|
-
c: d
|
1642
|
-
SASS
|
1643
|
-
end
|
1644
|
-
|
1645
|
-
def test_quoted_ampersand
|
1646
|
-
assert_equal(<<CSS, render(<<SASS))
|
1647
|
-
a b[foo="bar & baz"] {
|
1648
|
-
c: d; }
|
1649
|
-
CSS
|
1650
|
-
a
|
1651
|
-
b[foo="bar & baz"]
|
1652
|
-
c: d
|
1653
|
-
SASS
|
1654
|
-
end
|
1655
|
-
|
1656
|
-
def test_empty_selector_warning
|
1657
|
-
assert_warning(<<END) {render("foo bar")}
|
1658
|
-
WARNING on line 1 of test_empty_selector_warning_inline.sass:
|
1659
|
-
This selector doesn't have any properties and will not be rendered.
|
1660
|
-
END
|
1661
|
-
end
|
1662
|
-
|
1663
|
-
def test_root_level_pseudo_class_with_new_properties
|
1664
|
-
assert_equal(<<CSS, render(<<SASS, :property_syntax => :new))
|
1665
|
-
:focus {
|
1666
|
-
outline: 0; }
|
1667
|
-
CSS
|
1668
|
-
:focus
|
1669
|
-
outline: 0
|
1670
|
-
SASS
|
1671
|
-
end
|
1672
|
-
|
1673
|
-
def test_pseudo_class_with_new_properties
|
1674
|
-
assert_equal(<<CSS, render(<<SASS, :property_syntax => :new))
|
1675
|
-
p :focus {
|
1676
|
-
outline: 0; }
|
1677
|
-
CSS
|
1678
|
-
p
|
1679
|
-
:focus
|
1680
|
-
outline: 0
|
1681
|
-
SASS
|
1682
|
-
end
|
1683
|
-
|
1684
|
-
def test_nil_option
|
1685
|
-
assert_equal(<<CSS, render(<<SASS, :format => nil))
|
1686
|
-
foo {
|
1687
|
-
a: b; }
|
1688
|
-
CSS
|
1689
|
-
foo
|
1690
|
-
a: b
|
1691
|
-
SASS
|
1692
|
-
end
|
1693
|
-
|
1694
|
-
def test_interpolation_in_raw_functions
|
1695
|
-
assert_equal(<<CSS, render(<<SASS))
|
1696
|
-
foo {
|
1697
|
-
filter: progid:Microsoft.foo.bar.Baz(flip=foobar, bang=#00ff00cc); }
|
1698
|
-
CSS
|
1699
|
-
foo
|
1700
|
-
filter: progid:Microsoft.foo.bar.Baz(flip=\#{foo + bar}, bang=#00ff00cc)
|
1701
|
-
SASS
|
1702
|
-
end
|
1703
|
-
|
1704
|
-
# SassScript string behavior
|
1705
|
-
|
1706
|
-
def test_plus_preserves_quotedness
|
1707
|
-
assert_equal(<<CSS, render(<<SASS))
|
1708
|
-
foo {
|
1709
|
-
a: "foo1";
|
1710
|
-
b: "1foo";
|
1711
|
-
c: foo1;
|
1712
|
-
d: 1foo;
|
1713
|
-
e: "foobar";
|
1714
|
-
f: foobar; }
|
1715
|
-
CSS
|
1716
|
-
foo
|
1717
|
-
a: "foo" + 1
|
1718
|
-
b: 1 + "foo"
|
1719
|
-
c: foo + 1
|
1720
|
-
d: 1 + foo
|
1721
|
-
e: "foo" + bar
|
1722
|
-
f: foo + "bar"
|
1723
|
-
SASS
|
1724
|
-
end
|
1725
|
-
|
1726
|
-
def test_colon_properties_preserve_quotedness
|
1727
|
-
assert_equal(<<CSS, render(<<SASS))
|
1728
|
-
foo {
|
1729
|
-
a: "foo";
|
1730
|
-
b: bar;
|
1731
|
-
c: "foo" bar;
|
1732
|
-
d: foo, "bar"; }
|
1733
|
-
CSS
|
1734
|
-
foo
|
1735
|
-
a: "foo"
|
1736
|
-
b: bar
|
1737
|
-
c: "foo" bar
|
1738
|
-
d: foo, "bar"
|
1739
|
-
SASS
|
1740
|
-
end
|
1741
|
-
|
1742
|
-
def test_colon_variables_preserve_quotedness
|
1743
|
-
assert_equal(<<CSS, render(<<SASS))
|
1744
|
-
foo {
|
1745
|
-
a: "foo";
|
1746
|
-
b: bar; }
|
1747
|
-
CSS
|
1748
|
-
$a: "foo"
|
1749
|
-
$b: bar
|
1750
|
-
|
1751
|
-
foo
|
1752
|
-
a: $a
|
1753
|
-
b: $b
|
1754
|
-
SASS
|
1755
|
-
end
|
1756
|
-
|
1757
|
-
def test_colon_args_preserve_quotedness
|
1758
|
-
assert_equal(<<CSS, render(<<SASS))
|
1759
|
-
foo {
|
1760
|
-
a: "foo";
|
1761
|
-
b: bar;
|
1762
|
-
c: "foo" bar;
|
1763
|
-
d: foo, "bar"; }
|
1764
|
-
CSS
|
1765
|
-
=foo($a: "foo", $b: bar, $c: "foo" bar, $d: (foo, "bar"))
|
1766
|
-
foo
|
1767
|
-
a: $a
|
1768
|
-
b: $b
|
1769
|
-
c: $c
|
1770
|
-
d: $d
|
1771
|
-
|
1772
|
-
+foo
|
1773
|
-
SASS
|
1774
|
-
end
|
1775
|
-
|
1776
|
-
def test_interpolation_unquotes_strings
|
1777
|
-
assert_equal(<<CSS, render(<<SASS))
|
1778
|
-
.foo-bar {
|
1779
|
-
a: b; }
|
1780
|
-
CSS
|
1781
|
-
.foo-\#{"bar"}
|
1782
|
-
a: b
|
1783
|
-
SASS
|
1784
|
-
|
1785
|
-
assert_equal(<<CSS, render(<<SASS))
|
1786
|
-
.foo {
|
1787
|
-
a: b c; }
|
1788
|
-
CSS
|
1789
|
-
.foo
|
1790
|
-
a: b \#{"c"}
|
1791
|
-
SASS
|
1792
|
-
end
|
1793
|
-
|
1794
|
-
def test_interpolation_unquotes_strings_in_vars
|
1795
|
-
assert_equal(<<CSS, render(<<SASS))
|
1796
|
-
.foo-bar {
|
1797
|
-
a: b; }
|
1798
|
-
CSS
|
1799
|
-
$var: "bar"
|
1800
|
-
|
1801
|
-
.foo-\#{$var}
|
1802
|
-
a: b
|
1803
|
-
SASS
|
1804
|
-
end
|
1805
|
-
|
1806
|
-
def test_interpolation_doesnt_deep_unquote_strings
|
1807
|
-
assert_equal(<<CSS, render(<<SASS))
|
1808
|
-
.foo {
|
1809
|
-
a: "bar" "baz"; }
|
1810
|
-
CSS
|
1811
|
-
.foo
|
1812
|
-
a: \#{"bar" "baz"}
|
1813
|
-
SASS
|
1814
|
-
end
|
1815
|
-
|
1816
|
-
def test_warn_directive
|
1817
|
-
expected_warning = <<EXPECTATION
|
1818
|
-
WARNING: this is a warning
|
1819
|
-
on line 4 of test_warn_directive_inline.sass
|
1820
|
-
|
1821
|
-
WARNING: this is a mixin warning
|
1822
|
-
on line 2 of test_warn_directive_inline.sass, in `foo'
|
1823
|
-
from line 7 of test_warn_directive_inline.sass
|
1824
|
-
EXPECTATION
|
1825
|
-
assert_warning expected_warning do
|
1826
|
-
assert_equal <<CSS, render(<<SASS)
|
1827
|
-
bar {
|
1828
|
-
c: d; }
|
1829
|
-
CSS
|
1830
|
-
=foo
|
1831
|
-
@warn "this is a mixin warning"
|
1832
|
-
|
1833
|
-
@warn "this is a warning"
|
1834
|
-
bar
|
1835
|
-
c: d
|
1836
|
-
+foo
|
1837
|
-
SASS
|
1838
|
-
end
|
1839
|
-
end
|
1840
|
-
|
1841
|
-
def test_warn_directive_when_quiet
|
1842
|
-
assert_warning "" do
|
1843
|
-
assert_equal <<CSS, render(<<SASS, :quiet => true)
|
1844
|
-
CSS
|
1845
|
-
@warn "this is a warning"
|
1846
|
-
SASS
|
1847
|
-
end
|
1848
|
-
end
|
1849
|
-
|
1850
|
-
def test_warn_with_imports
|
1851
|
-
expected_warning = <<WARN
|
1852
|
-
WARNING: In the main file
|
1853
|
-
on line 1 of #{File.dirname(__FILE__)}/templates/warn.sass
|
1854
|
-
|
1855
|
-
WARNING: Imported
|
1856
|
-
on line 1 of #{File.dirname(__FILE__)}/templates/warn_imported.sass
|
1857
|
-
from line 2 of #{File.dirname(__FILE__)}/templates/warn.sass
|
1858
|
-
|
1859
|
-
WARNING: In an imported mixin
|
1860
|
-
on line 4 of #{File.dirname(__FILE__)}/templates/warn_imported.sass, in `emits-a-warning'
|
1861
|
-
from line 3 of #{File.dirname(__FILE__)}/templates/warn.sass
|
1862
|
-
WARN
|
1863
|
-
assert_warning expected_warning do
|
1864
|
-
renders_correctly "warn", :style => :compact, :load_paths => [File.dirname(__FILE__) + "/templates"]
|
1865
|
-
end
|
1866
|
-
end
|
1867
|
-
|
1868
|
-
def test_media_bubbling
|
1869
|
-
assert_equal <<CSS, render(<<SASS)
|
1870
|
-
.foo {
|
1871
|
-
a: b; }
|
1872
|
-
@media bar {
|
1873
|
-
.foo {
|
1874
|
-
c: d; } }
|
1875
|
-
.foo .baz {
|
1876
|
-
e: f; }
|
1877
|
-
@media bip {
|
1878
|
-
.foo .baz {
|
1879
|
-
g: h; } }
|
1880
|
-
|
1881
|
-
.other {
|
1882
|
-
i: j; }
|
1883
|
-
CSS
|
1884
|
-
.foo
|
1885
|
-
a: b
|
1886
|
-
@media bar
|
1887
|
-
c: d
|
1888
|
-
.baz
|
1889
|
-
e: f
|
1890
|
-
@media bip
|
1891
|
-
g: h
|
1892
|
-
|
1893
|
-
.other
|
1894
|
-
i: j
|
1895
|
-
SASS
|
1896
|
-
|
1897
|
-
assert_equal <<CSS, render(<<SASS, :style => :compact)
|
1898
|
-
.foo { a: b; }
|
1899
|
-
@media bar { .foo { c: d; } }
|
1900
|
-
.foo .baz { e: f; }
|
1901
|
-
@media bip { .foo .baz { g: h; } }
|
1902
|
-
|
1903
|
-
.other { i: j; }
|
1904
|
-
CSS
|
1905
|
-
.foo
|
1906
|
-
a: b
|
1907
|
-
@media bar
|
1908
|
-
c: d
|
1909
|
-
.baz
|
1910
|
-
e: f
|
1911
|
-
@media bip
|
1912
|
-
g: h
|
1913
|
-
|
1914
|
-
.other
|
1915
|
-
i: j
|
1916
|
-
SASS
|
1917
|
-
|
1918
|
-
assert_equal <<CSS, render(<<SASS, :style => :expanded)
|
1919
|
-
.foo {
|
1920
|
-
a: b;
|
1921
|
-
}
|
1922
|
-
@media bar {
|
1923
|
-
.foo {
|
1924
|
-
c: d;
|
1925
|
-
}
|
1926
|
-
}
|
1927
|
-
.foo .baz {
|
1928
|
-
e: f;
|
1929
|
-
}
|
1930
|
-
@media bip {
|
1931
|
-
.foo .baz {
|
1932
|
-
g: h;
|
1933
|
-
}
|
1934
|
-
}
|
1935
|
-
|
1936
|
-
.other {
|
1937
|
-
i: j;
|
1938
|
-
}
|
1939
|
-
CSS
|
1940
|
-
.foo
|
1941
|
-
a: b
|
1942
|
-
@media bar
|
1943
|
-
c: d
|
1944
|
-
.baz
|
1945
|
-
e: f
|
1946
|
-
@media bip
|
1947
|
-
g: h
|
1948
|
-
|
1949
|
-
.other
|
1950
|
-
i: j
|
1951
|
-
SASS
|
1952
|
-
end
|
1953
|
-
|
1954
|
-
def test_double_media_bubbling
|
1955
|
-
assert_equal <<CSS, render(<<SASS)
|
1956
|
-
@media bar and baz {
|
1957
|
-
.foo {
|
1958
|
-
c: d; } }
|
1959
|
-
CSS
|
1960
|
-
@media bar
|
1961
|
-
@media baz
|
1962
|
-
.foo
|
1963
|
-
c: d
|
1964
|
-
SASS
|
1965
|
-
|
1966
|
-
assert_equal <<CSS, render(<<SASS)
|
1967
|
-
@media bar {
|
1968
|
-
.foo {
|
1969
|
-
a: b; } }
|
1970
|
-
@media bar and baz {
|
1971
|
-
.foo {
|
1972
|
-
c: d; } }
|
1973
|
-
CSS
|
1974
|
-
.foo
|
1975
|
-
@media bar
|
1976
|
-
a: b
|
1977
|
-
@media baz
|
1978
|
-
c: d
|
1979
|
-
SASS
|
1980
|
-
end
|
1981
|
-
|
1982
|
-
def test_rule_media_rule_bubbling
|
1983
|
-
assert_equal <<CSS, render(<<SASS)
|
1984
|
-
@media bar {
|
1985
|
-
.foo {
|
1986
|
-
a: b;
|
1987
|
-
e: f; }
|
1988
|
-
.foo .baz {
|
1989
|
-
c: d; } }
|
1990
|
-
CSS
|
1991
|
-
.foo
|
1992
|
-
@media bar
|
1993
|
-
a: b
|
1994
|
-
.baz
|
1995
|
-
c: d
|
1996
|
-
e: f
|
1997
|
-
SASS
|
1998
|
-
end
|
1999
|
-
|
2000
|
-
def test_nested_media_around_properties
|
2001
|
-
assert_equal <<CSS, render(<<SASS)
|
2002
|
-
.outside {
|
2003
|
-
color: red;
|
2004
|
-
background: blue; }
|
2005
|
-
@media print {
|
2006
|
-
.outside {
|
2007
|
-
color: black; } }
|
2008
|
-
@media print and nested {
|
2009
|
-
.outside .inside {
|
2010
|
-
border: 1px solid black; } }
|
2011
|
-
.outside .middle {
|
2012
|
-
display: block; }
|
2013
|
-
CSS
|
2014
|
-
.outside
|
2015
|
-
color: red
|
2016
|
-
@media print
|
2017
|
-
color: black
|
2018
|
-
.inside
|
2019
|
-
@media nested
|
2020
|
-
border: 1px solid black
|
2021
|
-
background: blue
|
2022
|
-
.middle
|
2023
|
-
display: block
|
2024
|
-
SASS
|
2025
|
-
end
|
2026
|
-
|
2027
|
-
def test_media_with_parent_references
|
2028
|
-
sass_str = <<SASS
|
2029
|
-
.outside
|
2030
|
-
@media print
|
2031
|
-
&.inside
|
2032
|
-
border: 1px solid black
|
2033
|
-
SASS
|
2034
|
-
css_str = <<CSS
|
2035
|
-
@media print {
|
2036
|
-
.outside.inside {
|
2037
|
-
border: 1px solid black; } }
|
2038
|
-
CSS
|
2039
|
-
assert_equal css_str, render(sass_str)
|
2040
|
-
end
|
2041
|
-
|
2042
|
-
# Regression tests
|
2043
|
-
|
2044
|
-
def test_interpolated_comment_in_mixin
|
2045
|
-
assert_equal <<CSS, render(<<SASS)
|
2046
|
-
/* color: red */
|
2047
|
-
.foo {
|
2048
|
-
color: red; }
|
2049
|
-
|
2050
|
-
/* color: blue */
|
2051
|
-
.foo {
|
2052
|
-
color: blue; }
|
2053
|
-
|
2054
|
-
/* color: green */
|
2055
|
-
.foo {
|
2056
|
-
color: green; }
|
2057
|
-
CSS
|
2058
|
-
=foo($var)
|
2059
|
-
/*! color: \#{$var}
|
2060
|
-
.foo
|
2061
|
-
color: $var
|
2062
|
-
|
2063
|
-
+foo(red)
|
2064
|
-
+foo(blue)
|
2065
|
-
+foo(green)
|
2066
|
-
SASS
|
2067
|
-
end
|
2068
|
-
|
2069
|
-
def test_parens_in_mixins
|
2070
|
-
assert_equal(<<CSS, render(<<SASS))
|
2071
|
-
.foo {
|
2072
|
-
color: #01ff7f;
|
2073
|
-
background-color: #000102; }
|
2074
|
-
CSS
|
2075
|
-
=foo($c1, $c2: rgb(0, 1, 2))
|
2076
|
-
color: $c1
|
2077
|
-
background-color: $c2
|
2078
|
-
|
2079
|
-
.foo
|
2080
|
-
+foo(rgb(1,255,127))
|
2081
|
-
SASS
|
2082
|
-
end
|
2083
|
-
|
2084
|
-
def test_comment_beneath_prop
|
2085
|
-
assert_equal(<<RESULT, render(<<SOURCE))
|
2086
|
-
.box {
|
2087
|
-
border-style: solid; }
|
2088
|
-
RESULT
|
2089
|
-
.box
|
2090
|
-
:border
|
2091
|
-
//:color black
|
2092
|
-
:style solid
|
2093
|
-
SOURCE
|
2094
|
-
|
2095
|
-
assert_equal(<<RESULT, render(<<SOURCE))
|
2096
|
-
.box {
|
2097
|
-
/* :color black */
|
2098
|
-
border-style: solid; }
|
2099
|
-
RESULT
|
2100
|
-
.box
|
2101
|
-
:border
|
2102
|
-
/* :color black
|
2103
|
-
:style solid
|
2104
|
-
SOURCE
|
2105
|
-
|
2106
|
-
assert_equal(<<RESULT, render(<<SOURCE, :style => :compressed))
|
2107
|
-
.box{border-style:solid}
|
2108
|
-
RESULT
|
2109
|
-
.box
|
2110
|
-
:border
|
2111
|
-
/*:color black
|
2112
|
-
:style solid
|
2113
|
-
SOURCE
|
2114
|
-
end
|
2115
|
-
|
2116
|
-
def test_compressed_comment_beneath_directive
|
2117
|
-
assert_equal(<<RESULT, render(<<SOURCE, :style => :compressed))
|
2118
|
-
@foo{a:b}
|
2119
|
-
RESULT
|
2120
|
-
@foo
|
2121
|
-
a: b
|
2122
|
-
/*b: c
|
2123
|
-
SOURCE
|
2124
|
-
end
|
2125
|
-
|
2126
|
-
def test_comment_with_crazy_indentation
|
2127
|
-
assert_equal(<<CSS, render(<<SASS))
|
2128
|
-
/* This is a loud comment:
|
2129
|
-
* Where the indentation is wonky. */
|
2130
|
-
.comment {
|
2131
|
-
width: 1px; }
|
2132
|
-
CSS
|
2133
|
-
/*
|
2134
|
-
This is a loud comment:
|
2135
|
-
Where the indentation is wonky.
|
2136
|
-
//
|
2137
|
-
This is a silent comment:
|
2138
|
-
Where the indentation is wonky.
|
2139
|
-
.comment
|
2140
|
-
width: 1px
|
2141
|
-
SASS
|
2142
|
-
end
|
2143
|
-
|
2144
|
-
def test_plus_with_space
|
2145
|
-
assert_equal(<<CSS, render(<<SASS))
|
2146
|
-
a + b {
|
2147
|
-
color: green; }
|
2148
|
-
CSS
|
2149
|
-
a
|
2150
|
-
+ b
|
2151
|
-
color: green
|
2152
|
-
SASS
|
2153
|
-
end
|
2154
|
-
|
2155
|
-
def test_empty_line_comment
|
2156
|
-
assert_equal(<<CSS, render(<<SASS))
|
2157
|
-
/* Foo
|
2158
|
-
*
|
2159
|
-
* Bar */
|
2160
|
-
CSS
|
2161
|
-
/*
|
2162
|
-
Foo
|
2163
|
-
|
2164
|
-
Bar
|
2165
|
-
SASS
|
2166
|
-
end
|
2167
|
-
|
2168
|
-
def test_empty_comment
|
2169
|
-
assert_equal(<<CSS, render(<<SASS))
|
2170
|
-
/* */
|
2171
|
-
a {
|
2172
|
-
/* */
|
2173
|
-
b: c; }
|
2174
|
-
CSS
|
2175
|
-
/*
|
2176
|
-
a
|
2177
|
-
/*
|
2178
|
-
b: c
|
2179
|
-
SASS
|
2180
|
-
end
|
2181
|
-
|
2182
|
-
def test_options_available_in_environment
|
2183
|
-
assert_equal(<<CSS, render(<<SASS))
|
2184
|
-
a {
|
2185
|
-
b: nested; }
|
2186
|
-
CSS
|
2187
|
-
a
|
2188
|
-
b: option("style")
|
2189
|
-
SASS
|
2190
|
-
end
|
2191
|
-
|
2192
|
-
def test_mixin_no_arg_error
|
2193
|
-
assert_raise_message(Sass::SyntaxError, 'Invalid CSS after "($bar,": expected variable (e.g. $foo), was ")"') do
|
2194
|
-
render(<<SASS)
|
2195
|
-
=foo($bar,)
|
2196
|
-
bip: bap
|
2197
|
-
SASS
|
2198
|
-
end
|
2199
|
-
end
|
2200
|
-
|
2201
|
-
def test_import_with_commas_in_url
|
2202
|
-
assert_equal <<CSS, render(<<SASS)
|
2203
|
-
@import url(foo.css?bar,baz);
|
2204
|
-
CSS
|
2205
|
-
@import url(foo.css?bar,baz)
|
2206
|
-
SASS
|
2207
|
-
end
|
2208
|
-
|
2209
|
-
def test_silent_comment_in_prop_val_after_important
|
2210
|
-
assert_equal(<<CSS, render(<<SASS))
|
2211
|
-
.advanced {
|
2212
|
-
display: none !important; }
|
2213
|
-
CSS
|
2214
|
-
.advanced
|
2215
|
-
display: none !important // yeah, yeah. it's not really a style anyway.
|
2216
|
-
SASS
|
2217
|
-
end
|
2218
|
-
|
2219
|
-
def test_mixin_with_keyword_args
|
2220
|
-
assert_equal <<CSS, render(<<SASS)
|
2221
|
-
.mixed {
|
2222
|
-
required: foo;
|
2223
|
-
arg1: default-val1;
|
2224
|
-
arg2: non-default-val2; }
|
2225
|
-
CSS
|
2226
|
-
=a-mixin($required, $arg1: default-val1, $arg2: default-val2)
|
2227
|
-
required: $required
|
2228
|
-
arg1: $arg1
|
2229
|
-
arg2: $arg2
|
2230
|
-
.mixed
|
2231
|
-
+a-mixin(foo, $arg2: non-default-val2)
|
2232
|
-
SASS
|
2233
|
-
end
|
2234
|
-
|
2235
|
-
def test_mixin_with_keyword_arg_variable_value
|
2236
|
-
assert_equal <<CSS, render(<<SASS)
|
2237
|
-
.mixed {
|
2238
|
-
required: foo;
|
2239
|
-
arg1: default-val1;
|
2240
|
-
arg2: a-value; }
|
2241
|
-
CSS
|
2242
|
-
=a-mixin($required, $arg1: default-val1, $arg2: default-val2)
|
2243
|
-
required: $required
|
2244
|
-
arg1: $arg1
|
2245
|
-
arg2: $arg2
|
2246
|
-
.mixed
|
2247
|
-
$a-value: a-value
|
2248
|
-
+a-mixin(foo, $arg2: $a-value)
|
2249
|
-
SASS
|
2250
|
-
end
|
2251
|
-
|
2252
|
-
def test_mixin_keyword_args_handle_variable_underscore_dash_equivalence
|
2253
|
-
assert_equal <<CSS, render(<<SASS)
|
2254
|
-
.mixed {
|
2255
|
-
required: foo;
|
2256
|
-
arg1: non-default-val1;
|
2257
|
-
arg2: non-default-val2; }
|
2258
|
-
CSS
|
2259
|
-
=a-mixin($required, $arg-1: default-val1, $arg_2: default-val2)
|
2260
|
-
required: $required
|
2261
|
-
arg1: $arg_1
|
2262
|
-
arg2: $arg-2
|
2263
|
-
.mixed
|
2264
|
-
+a-mixin(foo, $arg-2: non-default-val2, $arg_1: non-default-val1)
|
2265
|
-
SASS
|
2266
|
-
end
|
2267
|
-
|
2268
|
-
def test_passing_required_args_as_a_keyword_arg
|
2269
|
-
assert_equal <<CSS, render(<<SASS)
|
2270
|
-
.mixed {
|
2271
|
-
required: foo;
|
2272
|
-
arg1: default-val1;
|
2273
|
-
arg2: default-val2; }
|
2274
|
-
CSS
|
2275
|
-
=a-mixin($required, $arg1: default-val1, $arg2: default-val2)
|
2276
|
-
required: $required
|
2277
|
-
arg1: $arg1
|
2278
|
-
arg2: $arg2
|
2279
|
-
.mixed
|
2280
|
-
+a-mixin($required: foo)
|
2281
|
-
SASS
|
2282
|
-
end
|
2283
|
-
|
2284
|
-
def test_passing_all_as_keyword_args_in_opposite_order
|
2285
|
-
assert_equal <<CSS, render(<<SASS)
|
2286
|
-
.mixed {
|
2287
|
-
required: foo;
|
2288
|
-
arg1: non-default-val1;
|
2289
|
-
arg2: non-default-val2; }
|
2290
|
-
CSS
|
2291
|
-
=a-mixin($required, $arg1: default-val1, $arg2: default-val2)
|
2292
|
-
required: $required
|
2293
|
-
arg1: $arg1
|
2294
|
-
arg2: $arg2
|
2295
|
-
.mixed
|
2296
|
-
+a-mixin($arg2: non-default-val2, $arg1: non-default-val1, $required: foo)
|
2297
|
-
SASS
|
2298
|
-
end
|
2299
|
-
|
2300
|
-
def test_function_output_with_comma
|
2301
|
-
assert_equal <<CSS, render(<<SASS)
|
2302
|
-
foo {
|
2303
|
-
a: b(c), d(e); }
|
2304
|
-
CSS
|
2305
|
-
foo
|
2306
|
-
a: b(c), d(e)
|
2307
|
-
SASS
|
2308
|
-
end
|
2309
|
-
|
2310
|
-
def test_interpolation_with_comma
|
2311
|
-
assert_equal <<CSS, render(<<SASS)
|
2312
|
-
foo {
|
2313
|
-
a: foo, bar; }
|
2314
|
-
CSS
|
2315
|
-
$foo: foo
|
2316
|
-
foo
|
2317
|
-
a: \#{$foo}, bar
|
2318
|
-
SASS
|
2319
|
-
end
|
2320
|
-
|
2321
|
-
def test_string_interpolation_with_comma
|
2322
|
-
assert_equal <<CSS, render(<<SASS)
|
2323
|
-
foo {
|
2324
|
-
a: "bip foo bap", bar; }
|
2325
|
-
CSS
|
2326
|
-
$foo: foo
|
2327
|
-
foo
|
2328
|
-
a: "bip \#{$foo} bap", bar
|
2329
|
-
SASS
|
2330
|
-
end
|
2331
|
-
|
2332
|
-
def test_unknown_directive
|
2333
|
-
assert_equal <<CSS, render(<<SASS)
|
2334
|
-
@baz {
|
2335
|
-
c: d; }
|
2336
|
-
CSS
|
2337
|
-
@baz
|
2338
|
-
c: d
|
2339
|
-
SASS
|
2340
|
-
end
|
2341
|
-
|
2342
|
-
def test_comment_interpolation_warning
|
2343
|
-
assert_warning(<<END) {render("/* \#{foo}")}
|
2344
|
-
WARNING:
|
2345
|
-
On line 1 of 'test_comment_interpolation_warning_inline.sass'
|
2346
|
-
Comments will evaluate the contents of interpolations (\#{ ... }) in Sass 3.2.
|
2347
|
-
Please escape the interpolation by adding a backslash before the `#`.
|
2348
|
-
END
|
2349
|
-
end
|
2350
|
-
|
2351
|
-
def test_loud_silent_comment_warning
|
2352
|
-
assert_warning(<<END) {render("//! \#{foo}")}
|
2353
|
-
WARNING:
|
2354
|
-
On line 1 of 'test_loud_silent_comment_warning_inline.sass'
|
2355
|
-
`//` comments will no longer be allowed to use the `!` flag in Sass 3.2.
|
2356
|
-
Please change to `/*` comments.
|
2357
|
-
END
|
2358
|
-
end
|
2359
|
-
|
2360
|
-
def test_loud_comment_interpolations_can_be_escaped
|
2361
|
-
assert_equal <<CSS, render(<<SASS)
|
2362
|
-
/* \#{foo} */
|
2363
|
-
CSS
|
2364
|
-
/* \\\#{foo}
|
2365
|
-
SASS
|
2366
|
-
assert_equal <<CSS, render(<<SASS)
|
2367
|
-
/* \#{foo} */
|
2368
|
-
CSS
|
2369
|
-
/*! \\\#{foo}
|
2370
|
-
SASS
|
2371
|
-
end
|
2372
|
-
|
2373
|
-
# Encodings
|
2374
|
-
|
2375
|
-
unless Sass::Util.ruby1_8?
|
2376
|
-
def test_encoding_error
|
2377
|
-
render("foo\nbar\nb\xFEaz".force_encoding("utf-8"))
|
2378
|
-
assert(false, "Expected exception")
|
2379
|
-
rescue Sass::SyntaxError => e
|
2380
|
-
assert_equal(3, e.sass_line)
|
2381
|
-
assert_equal('Invalid UTF-8 character "\xFE"', e.message)
|
2382
|
-
end
|
2383
|
-
|
2384
|
-
def test_ascii_incompatible_encoding_error
|
2385
|
-
template = "foo\nbar\nb_z".encode("utf-16le")
|
2386
|
-
template[9] = "\xFE".force_encoding("utf-16le")
|
2387
|
-
render(template)
|
2388
|
-
assert(false, "Expected exception")
|
2389
|
-
rescue Sass::SyntaxError => e
|
2390
|
-
assert_equal(3, e.sass_line)
|
2391
|
-
assert_equal('Invalid UTF-16LE character "\xFE"', e.message)
|
2392
|
-
end
|
2393
|
-
|
2394
|
-
def test_same_charset_as_encoding
|
2395
|
-
assert_renders_encoded(<<CSS, <<SASS)
|
2396
|
-
@charset "UTF-8";
|
2397
|
-
fóó {
|
2398
|
-
a: b; }
|
2399
|
-
CSS
|
2400
|
-
@charset "utf-8"
|
2401
|
-
fóó
|
2402
|
-
a: b
|
2403
|
-
SASS
|
2404
|
-
end
|
2405
|
-
|
2406
|
-
def test_different_charset_than_encoding
|
2407
|
-
assert_renders_encoded(<<CSS.force_encoding("IBM866"), <<SASS)
|
2408
|
-
@charset "IBM866";
|
2409
|
-
fóó {
|
2410
|
-
a: b; }
|
2411
|
-
CSS
|
2412
|
-
@charset "ibm866"
|
2413
|
-
fóó
|
2414
|
-
a: b
|
2415
|
-
SASS
|
2416
|
-
end
|
2417
|
-
|
2418
|
-
def test_different_encoding_than_system
|
2419
|
-
assert_renders_encoded(<<CSS.encode("IBM866"), <<SASS.encode("IBM866"))
|
2420
|
-
@charset "IBM866";
|
2421
|
-
тАЬ {
|
2422
|
-
a: b; }
|
2423
|
-
CSS
|
2424
|
-
тАЬ
|
2425
|
-
a: b
|
2426
|
-
SASS
|
2427
|
-
end
|
2428
|
-
|
2429
|
-
def test_multibyte_charset
|
2430
|
-
assert_renders_encoded(<<CSS.encode("UTF-16LE"), <<SASS.encode("UTF-16LE").force_encoding("UTF-8"))
|
2431
|
-
@charset "UTF-16LE";
|
2432
|
-
fóó {
|
2433
|
-
a: b; }
|
2434
|
-
CSS
|
2435
|
-
@charset "utf-16le"
|
2436
|
-
fóó
|
2437
|
-
a: b
|
2438
|
-
SASS
|
2439
|
-
end
|
2440
|
-
|
2441
|
-
def test_multibyte_charset_without_endian_specifier
|
2442
|
-
assert_renders_encoded(<<CSS.encode("UTF-32BE"), <<SASS.encode("UTF-32BE").force_encoding("UTF-8"))
|
2443
|
-
@charset "UTF-32BE";
|
2444
|
-
fóó {
|
2445
|
-
a: b; }
|
2446
|
-
CSS
|
2447
|
-
@charset "utf-32"
|
2448
|
-
fóó
|
2449
|
-
a: b
|
2450
|
-
SASS
|
2451
|
-
end
|
2452
|
-
|
2453
|
-
def test_utf8_bom
|
2454
|
-
assert_renders_encoded(<<CSS, <<SASS.force_encoding("BINARY"))
|
2455
|
-
@charset "UTF-8";
|
2456
|
-
fóó {
|
2457
|
-
a: b; }
|
2458
|
-
CSS
|
2459
|
-
\uFEFFfóó
|
2460
|
-
a: b
|
2461
|
-
SASS
|
2462
|
-
end
|
2463
|
-
|
2464
|
-
def test_utf16le_bom
|
2465
|
-
assert_renders_encoded(<<CSS.encode("UTF-16LE"), <<SASS.encode("UTF-16LE").force_encoding("BINARY"))
|
2466
|
-
@charset "UTF-16LE";
|
2467
|
-
fóó {
|
2468
|
-
a: b; }
|
2469
|
-
CSS
|
2470
|
-
\uFEFFfóó
|
2471
|
-
a: b
|
2472
|
-
SASS
|
2473
|
-
end
|
2474
|
-
|
2475
|
-
def test_utf32be_bom
|
2476
|
-
assert_renders_encoded(<<CSS.encode("UTF-32BE"), <<SASS.encode("UTF-32BE").force_encoding("BINARY"))
|
2477
|
-
@charset "UTF-32BE";
|
2478
|
-
fóó {
|
2479
|
-
a: b; }
|
2480
|
-
CSS
|
2481
|
-
\uFEFFfóó
|
2482
|
-
a: b
|
2483
|
-
SASS
|
2484
|
-
end
|
2485
|
-
end
|
2486
|
-
|
2487
|
-
def test_original_filename_set
|
2488
|
-
importer = MockImporter.new
|
2489
|
-
importer.add_import("imported", "div{color:red}")
|
2490
|
-
|
2491
|
-
original_filename = filename_for_test
|
2492
|
-
engine = Sass::Engine.new('@import "imported"; div{color:blue}',
|
2493
|
-
:filename => original_filename, :load_paths => [importer], :syntax => :scss)
|
2494
|
-
engine.render
|
2495
|
-
|
2496
|
-
assert_equal original_filename, engine.options[:original_filename]
|
2497
|
-
assert_equal original_filename, importer.engine("imported").options[:original_filename]
|
2498
|
-
end
|
2499
|
-
|
2500
|
-
def test_deprecated_PRECISION
|
2501
|
-
assert_warning(<<END) {assert_equal 1000.0, Sass::Script::Number::PRECISION}
|
2502
|
-
Sass::Script::Number::PRECISION is deprecated and will be removed in a future release. Use Sass::Script::Number.precision_factor instead.
|
2503
|
-
END
|
2504
|
-
end
|
2505
|
-
def test_changing_precision
|
2506
|
-
begin
|
2507
|
-
Sass::Script::Number.precision = 8
|
2508
|
-
assert_equal <<CSS, render(<<SASS)
|
2509
|
-
div {
|
2510
|
-
maximum: 1.00000001;
|
2511
|
-
too-much: 1.0; }
|
2512
|
-
CSS
|
2513
|
-
div
|
2514
|
-
maximum : 1.00000001
|
2515
|
-
too-much: 1.000000001
|
2516
|
-
SASS
|
2517
|
-
ensure
|
2518
|
-
Sass::Script::Number.precision = 3
|
2519
|
-
end
|
2520
|
-
end
|
2521
|
-
|
2522
|
-
private
|
2523
|
-
|
2524
|
-
def assert_hash_has(hash, expected)
|
2525
|
-
expected.each {|k, v| assert_equal(v, hash[k])}
|
2526
|
-
end
|
2527
|
-
|
2528
|
-
def assert_renders_encoded(css, sass)
|
2529
|
-
result = render(sass)
|
2530
|
-
assert_equal css.encoding, result.encoding
|
2531
|
-
assert_equal css, result
|
2532
|
-
end
|
2533
|
-
|
2534
|
-
def render(sass, options = {})
|
2535
|
-
munge_filename options
|
2536
|
-
Sass::Engine.new(sass, options).render
|
2537
|
-
end
|
2538
|
-
|
2539
|
-
def renders_correctly(name, options={})
|
2540
|
-
sass_file = load_file(name, "sass")
|
2541
|
-
css_file = load_file(name, "css")
|
2542
|
-
options[:filename] ||= filename(name, "sass")
|
2543
|
-
options[:syntax] ||= :sass
|
2544
|
-
options[:css_filename] ||= filename(name, "css")
|
2545
|
-
css_result = Sass::Engine.new(sass_file, options).render
|
2546
|
-
assert_equal css_file, css_result
|
2547
|
-
end
|
2548
|
-
|
2549
|
-
def load_file(name, type = "sass")
|
2550
|
-
@result = ''
|
2551
|
-
File.new(filename(name, type)).each_line { |l| @result += l }
|
2552
|
-
@result
|
2553
|
-
end
|
2554
|
-
|
2555
|
-
def filename(name, type)
|
2556
|
-
File.dirname(__FILE__) + "/#{type == 'sass' ? 'templates' : 'results'}/#{name}.#{type}"
|
2557
|
-
end
|
2558
|
-
|
2559
|
-
def sassc_path(template)
|
2560
|
-
sassc_path = File.join(File.dirname(__FILE__) + "/templates/#{template}.sass")
|
2561
|
-
engine = Sass::Engine.new("", :filename => sassc_path,
|
2562
|
-
:importer => Sass::Importers::Filesystem.new("."))
|
2563
|
-
key = engine.send(:sassc_key)
|
2564
|
-
File.join(engine.options[:cache_location], key)
|
2565
|
-
end
|
2566
|
-
end
|
2567
|
-
|