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,156 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
require File.dirname(__FILE__) + '/../../test_helper'
|
4
|
-
require 'sass/engine'
|
5
|
-
|
6
|
-
class ScssRxTest < Test::Unit::TestCase
|
7
|
-
include Sass::SCSS::RX
|
8
|
-
|
9
|
-
def test_identifiers
|
10
|
-
assert_match IDENT, "foo"
|
11
|
-
assert_match IDENT, "\xC3\xBFoo" # Initial char can be nonascii
|
12
|
-
assert_match IDENT, "\\123abcoo" # Initial char can be unicode escape
|
13
|
-
assert_match IDENT, "\\f oo" # Unicode escapes can be followed by whitespace
|
14
|
-
assert_match IDENT, "\\fa\too"
|
15
|
-
assert_match IDENT, "\\ff2\roo"
|
16
|
-
assert_match IDENT, "\\f13a\foo"
|
17
|
-
assert_match IDENT, "\\f13abcoo"
|
18
|
-
assert_match IDENT, "\\ oo" # Initial char can be a plain escape as well
|
19
|
-
assert_match IDENT, "\\~oo"
|
20
|
-
assert_match IDENT, "\\\\oo"
|
21
|
-
assert_match IDENT, "\\{oo"
|
22
|
-
assert_match IDENT, "\\\xC3\xBFoo"
|
23
|
-
assert_match IDENT, "-foo" # Can put a - before anything
|
24
|
-
assert_match IDENT, "-\xC3\xBFoo"
|
25
|
-
assert_match IDENT, "-\\f oo"
|
26
|
-
assert_match IDENT, "_foo" # Can put a _ before anything
|
27
|
-
assert_match IDENT, "_\xC3\xBFoo"
|
28
|
-
assert_match IDENT, "_\\f oo"
|
29
|
-
|
30
|
-
assert_match IDENT, "foo-bar"
|
31
|
-
assert_match IDENT, "f012-23"
|
32
|
-
assert_match IDENT, "foo_-_bar"
|
33
|
-
assert_match IDENT, "f012_23"
|
34
|
-
|
35
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/escapes-003.xht
|
36
|
-
assert_match IDENT, "c\\lass"
|
37
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/escapes-004.xht
|
38
|
-
assert_match IDENT, "c\\00006Cas\\000073"
|
39
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/ident-001.xht
|
40
|
-
assert_match IDENT, "IdE6n-3t0_6"
|
41
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/ident-006.xht
|
42
|
-
assert_match IDENT, "\\6000ident"
|
43
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/ident-007.xht
|
44
|
-
assert_match IDENT, "iden\\6000t\\6000"
|
45
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/ident-013.xht
|
46
|
-
assert_match IDENT, "\\-ident"
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_underscores_in_identifiers
|
50
|
-
assert_match IDENT, "foo_bar"
|
51
|
-
assert_match IDENT, "_\xC3\xBFfoo"
|
52
|
-
assert_match IDENT, "__foo"
|
53
|
-
assert_match IDENT, "_1foo"
|
54
|
-
assert_match IDENT, "-_foo"
|
55
|
-
assert_match IDENT, "_-foo"
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_invalid_identifiers
|
59
|
-
assert_no_match IDENT, ""
|
60
|
-
assert_no_match IDENT, "1foo"
|
61
|
-
assert_no_match IDENT, "-1foo"
|
62
|
-
assert_no_match IDENT, "--foo"
|
63
|
-
assert_no_match IDENT, "foo bar"
|
64
|
-
assert_no_match IDENT, "foo~bar"
|
65
|
-
|
66
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/escapes-008.xht
|
67
|
-
assert_no_match IDENT, "c\\06C ass"
|
68
|
-
assert_no_match IDENT, "back\\67\n round"
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_double_quote_strings
|
72
|
-
assert_match STRING, '"foo bar"'
|
73
|
-
assert_match STRING, '"foo\\\nbar"'
|
74
|
-
assert_match STRING, "\"\\\"\""
|
75
|
-
assert_match STRING, '"\t !#$%&(-~()*+,-./0123456789~"'
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_single_quote_strings
|
79
|
-
assert_match STRING, "'foo bar'"
|
80
|
-
assert_match STRING, "'foo\\\nbar'"
|
81
|
-
assert_match STRING, "'\\''"
|
82
|
-
assert_match STRING, "'\t !#\$%&(-~()*+,-./0123456789~'"
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_invalid_strings
|
86
|
-
assert_no_match STRING, "\"foo\nbar\""
|
87
|
-
assert_no_match STRING, "\"foo\"bar\""
|
88
|
-
assert_no_match STRING, "'foo\nbar'"
|
89
|
-
assert_no_match STRING, "'foo'bar'"
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_uri
|
93
|
-
assert_match URI, 'url("foo bar)")'
|
94
|
-
assert_match URI, "url('foo bar)')"
|
95
|
-
assert_match URI, 'url( "foo bar)" )'
|
96
|
-
assert_match URI, "url(#\\%&**+,-./0123456789~)"
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_invalid_uri
|
100
|
-
assert_no_match URI, 'url(foo)bar)'
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_unicode_range
|
104
|
-
assert_match UNICODERANGE, 'U+00-Ff'
|
105
|
-
assert_match UNICODERANGE, 'u+980-9FF'
|
106
|
-
assert_match UNICODERANGE, 'U+9aF??'
|
107
|
-
assert_match UNICODERANGE, 'U+??'
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_escape_empty_ident
|
111
|
-
assert_equal "", Sass::SCSS::RX.escape_ident("")
|
112
|
-
end
|
113
|
-
|
114
|
-
def test_escape_just_prefix_ident
|
115
|
-
assert_equal "\\-", Sass::SCSS::RX.escape_ident("-")
|
116
|
-
assert_equal "\\_", Sass::SCSS::RX.escape_ident("_")
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_escape_plain_ident
|
120
|
-
assert_equal "foo", Sass::SCSS::RX.escape_ident("foo")
|
121
|
-
assert_equal "foo-1bar", Sass::SCSS::RX.escape_ident("foo-1bar")
|
122
|
-
assert_equal "-foo-bar", Sass::SCSS::RX.escape_ident("-foo-bar")
|
123
|
-
assert_equal "f2oo_bar", Sass::SCSS::RX.escape_ident("f2oo_bar")
|
124
|
-
assert_equal "_foo_bar", Sass::SCSS::RX.escape_ident("_foo_bar")
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_escape_initial_funky_ident
|
128
|
-
assert_equal "\\000035foo", Sass::SCSS::RX.escape_ident("5foo")
|
129
|
-
assert_equal "-\\000035foo", Sass::SCSS::RX.escape_ident("-5foo")
|
130
|
-
assert_equal "_\\000035foo", Sass::SCSS::RX.escape_ident("_5foo")
|
131
|
-
|
132
|
-
assert_equal "\\&foo", Sass::SCSS::RX.escape_ident("&foo")
|
133
|
-
assert_equal "-\\&foo", Sass::SCSS::RX.escape_ident("-&foo")
|
134
|
-
|
135
|
-
assert_equal "-\\ foo", Sass::SCSS::RX.escape_ident("- foo")
|
136
|
-
end
|
137
|
-
|
138
|
-
def test_escape_mid_funky_ident
|
139
|
-
assert_equal "foo\\&bar", Sass::SCSS::RX.escape_ident("foo&bar")
|
140
|
-
assert_equal "foo\\ \\ bar", Sass::SCSS::RX.escape_ident("foo bar")
|
141
|
-
assert_equal "foo\\00007fbar", Sass::SCSS::RX.escape_ident("foo\177bar")
|
142
|
-
end
|
143
|
-
|
144
|
-
private
|
145
|
-
|
146
|
-
def assert_match(rx, str)
|
147
|
-
assert_not_nil(match = rx.match(str))
|
148
|
-
assert_equal str.size, match[0].size
|
149
|
-
end
|
150
|
-
|
151
|
-
def assert_no_match(rx, str)
|
152
|
-
match = rx.match(str)
|
153
|
-
assert_not_equal str.size, match && match[0].size
|
154
|
-
end
|
155
|
-
|
156
|
-
end
|
@@ -1,1273 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
require File.dirname(__FILE__) + '/test_helper'
|
4
|
-
|
5
|
-
class ScssTest < Test::Unit::TestCase
|
6
|
-
include ScssTestHelper
|
7
|
-
|
8
|
-
## One-Line Comments
|
9
|
-
|
10
|
-
def test_one_line_comments
|
11
|
-
assert_equal <<CSS, render(<<SCSS)
|
12
|
-
.foo {
|
13
|
-
baz: bang; }
|
14
|
-
CSS
|
15
|
-
.foo {// bar: baz;}
|
16
|
-
baz: bang; //}
|
17
|
-
}
|
18
|
-
SCSS
|
19
|
-
assert_equal <<CSS, render(<<SCSS)
|
20
|
-
.foo bar[val="//"] {
|
21
|
-
baz: bang; }
|
22
|
-
CSS
|
23
|
-
.foo bar[val="//"] {
|
24
|
-
baz: bang; //}
|
25
|
-
}
|
26
|
-
SCSS
|
27
|
-
end
|
28
|
-
|
29
|
-
## Script
|
30
|
-
|
31
|
-
def test_variables
|
32
|
-
assert_equal <<CSS, render(<<SCSS)
|
33
|
-
blat {
|
34
|
-
a: foo; }
|
35
|
-
CSS
|
36
|
-
$var: foo;
|
37
|
-
|
38
|
-
blat {a: $var}
|
39
|
-
SCSS
|
40
|
-
|
41
|
-
assert_equal <<CSS, render(<<SCSS)
|
42
|
-
foo {
|
43
|
-
a: 2;
|
44
|
-
b: 6; }
|
45
|
-
CSS
|
46
|
-
foo {
|
47
|
-
$var: 2;
|
48
|
-
$another-var: 4;
|
49
|
-
a: $var;
|
50
|
-
b: $var + $another-var;}
|
51
|
-
SCSS
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_unicode_variables
|
55
|
-
assert_equal <<CSS, render(<<SCSS)
|
56
|
-
blat {
|
57
|
-
a: foo; }
|
58
|
-
CSS
|
59
|
-
$vär: foo;
|
60
|
-
|
61
|
-
blat {a: $vär}
|
62
|
-
SCSS
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_guard_assign
|
66
|
-
assert_equal <<CSS, render(<<SCSS)
|
67
|
-
foo {
|
68
|
-
a: 1; }
|
69
|
-
CSS
|
70
|
-
$var: 1;
|
71
|
-
$var: 2 !default;
|
72
|
-
|
73
|
-
foo {a: $var}
|
74
|
-
SCSS
|
75
|
-
|
76
|
-
assert_equal <<CSS, render(<<SCSS)
|
77
|
-
foo {
|
78
|
-
a: 2; }
|
79
|
-
CSS
|
80
|
-
$var: 2 !default;
|
81
|
-
|
82
|
-
foo {a: $var}
|
83
|
-
SCSS
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_sass_script
|
87
|
-
assert_equal <<CSS, render(<<SCSS)
|
88
|
-
foo {
|
89
|
-
a: 3;
|
90
|
-
b: -1;
|
91
|
-
c: foobar;
|
92
|
-
d: 12px; }
|
93
|
-
CSS
|
94
|
-
foo {
|
95
|
-
a: 1 + 2;
|
96
|
-
b: 1 - 2;
|
97
|
-
c: foo + bar;
|
98
|
-
d: floor(12.3px); }
|
99
|
-
SCSS
|
100
|
-
end
|
101
|
-
|
102
|
-
def test_debug_directive
|
103
|
-
assert_warning "test_debug_directive_inline.scss:2 DEBUG: hello world!" do
|
104
|
-
assert_equal <<CSS, render(<<SCSS)
|
105
|
-
foo {
|
106
|
-
a: b; }
|
107
|
-
|
108
|
-
bar {
|
109
|
-
c: d; }
|
110
|
-
CSS
|
111
|
-
foo {a: b}
|
112
|
-
@debug "hello world!";
|
113
|
-
bar {c: d}
|
114
|
-
SCSS
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_warn_directive
|
119
|
-
expected_warning = <<EXPECTATION
|
120
|
-
WARNING: this is a warning
|
121
|
-
on line 2 of test_warn_directive_inline.scss
|
122
|
-
|
123
|
-
WARNING: this is a mixin
|
124
|
-
on line 1 of test_warn_directive_inline.scss, in `foo'
|
125
|
-
from line 3 of test_warn_directive_inline.scss
|
126
|
-
EXPECTATION
|
127
|
-
assert_warning expected_warning do
|
128
|
-
assert_equal <<CSS, render(<<SCSS)
|
129
|
-
bar {
|
130
|
-
c: d; }
|
131
|
-
CSS
|
132
|
-
@mixin foo { @warn "this is a mixin";}
|
133
|
-
@warn "this is a warning";
|
134
|
-
bar {c: d; @include foo;}
|
135
|
-
SCSS
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
def test_for_directive
|
140
|
-
assert_equal <<CSS, render(<<SCSS)
|
141
|
-
.foo {
|
142
|
-
a: 1;
|
143
|
-
a: 2;
|
144
|
-
a: 3;
|
145
|
-
a: 4; }
|
146
|
-
CSS
|
147
|
-
.foo {
|
148
|
-
@for $var from 1 to 5 {a: $var;}
|
149
|
-
}
|
150
|
-
SCSS
|
151
|
-
|
152
|
-
assert_equal <<CSS, render(<<SCSS)
|
153
|
-
.foo {
|
154
|
-
a: 1;
|
155
|
-
a: 2;
|
156
|
-
a: 3;
|
157
|
-
a: 4;
|
158
|
-
a: 5; }
|
159
|
-
CSS
|
160
|
-
.foo {
|
161
|
-
@for $var from 1 through 5 {a: $var;}
|
162
|
-
}
|
163
|
-
SCSS
|
164
|
-
end
|
165
|
-
|
166
|
-
def test_if_directive
|
167
|
-
assert_equal <<CSS, render(<<SCSS)
|
168
|
-
foo {
|
169
|
-
a: b; }
|
170
|
-
CSS
|
171
|
-
@if "foo" == "foo" {foo {a: b}}
|
172
|
-
@if "foo" != "foo" {bar {a: b}}
|
173
|
-
SCSS
|
174
|
-
|
175
|
-
assert_equal <<CSS, render(<<SCSS)
|
176
|
-
bar {
|
177
|
-
a: b; }
|
178
|
-
CSS
|
179
|
-
@if "foo" != "foo" {foo {a: b}}
|
180
|
-
@else if "foo" == "foo" {bar {a: b}}
|
181
|
-
@else if true {baz {a: b}}
|
182
|
-
SCSS
|
183
|
-
|
184
|
-
assert_equal <<CSS, render(<<SCSS)
|
185
|
-
bar {
|
186
|
-
a: b; }
|
187
|
-
CSS
|
188
|
-
@if "foo" != "foo" {foo {a: b}}
|
189
|
-
@else {bar {a: b}}
|
190
|
-
SCSS
|
191
|
-
end
|
192
|
-
|
193
|
-
def test_comment_after_if_directive
|
194
|
-
assert_equal <<CSS, render(<<SCSS)
|
195
|
-
foo {
|
196
|
-
a: b;
|
197
|
-
/* This is a comment */
|
198
|
-
c: d; }
|
199
|
-
CSS
|
200
|
-
foo {
|
201
|
-
@if true {a: b}
|
202
|
-
/* This is a comment */
|
203
|
-
c: d }
|
204
|
-
SCSS
|
205
|
-
assert_equal <<CSS, render(<<SCSS)
|
206
|
-
foo {
|
207
|
-
a: b;
|
208
|
-
/* This is a comment */
|
209
|
-
c: d; }
|
210
|
-
CSS
|
211
|
-
foo {
|
212
|
-
@if true {a: b}
|
213
|
-
@else {x: y}
|
214
|
-
/* This is a comment */
|
215
|
-
c: d }
|
216
|
-
SCSS
|
217
|
-
end
|
218
|
-
|
219
|
-
def test_while_directive
|
220
|
-
assert_equal <<CSS, render(<<SCSS)
|
221
|
-
.foo {
|
222
|
-
a: 1;
|
223
|
-
a: 2;
|
224
|
-
a: 3;
|
225
|
-
a: 4; }
|
226
|
-
CSS
|
227
|
-
$i: 1;
|
228
|
-
|
229
|
-
.foo {
|
230
|
-
@while $i != 5 {
|
231
|
-
a: $i;
|
232
|
-
$i: $i + 1;
|
233
|
-
}
|
234
|
-
}
|
235
|
-
SCSS
|
236
|
-
end
|
237
|
-
|
238
|
-
def test_each_directive
|
239
|
-
assert_equal <<CSS, render(<<SCSS)
|
240
|
-
a {
|
241
|
-
b: 1px;
|
242
|
-
b: 2px;
|
243
|
-
b: 3px;
|
244
|
-
b: 4px; }
|
245
|
-
|
246
|
-
c {
|
247
|
-
d: foo;
|
248
|
-
d: bar;
|
249
|
-
d: baz;
|
250
|
-
d: bang; }
|
251
|
-
CSS
|
252
|
-
a {
|
253
|
-
@each $number in 1px 2px 3px 4px {
|
254
|
-
b: $number;
|
255
|
-
}
|
256
|
-
}
|
257
|
-
c {
|
258
|
-
@each $str in foo, bar, baz, bang {
|
259
|
-
d: $str;
|
260
|
-
}
|
261
|
-
}
|
262
|
-
SCSS
|
263
|
-
end
|
264
|
-
|
265
|
-
def test_css_import_directive
|
266
|
-
assert_equal "@import url(foo.css);\n", render('@import "foo.css";')
|
267
|
-
assert_equal "@import url(foo.css);\n", render("@import 'foo.css';")
|
268
|
-
assert_equal "@import url(\"foo.css\");\n", render('@import url("foo.css");')
|
269
|
-
assert_equal "@import url('foo.css');\n", render("@import url('foo.css');")
|
270
|
-
assert_equal "@import url(foo.css);\n", render('@import url(foo.css);')
|
271
|
-
end
|
272
|
-
|
273
|
-
def test_media_import
|
274
|
-
assert_equal("@import \"./fonts.sass\" all;\n", render("@import \"./fonts.sass\" all;"))
|
275
|
-
end
|
276
|
-
|
277
|
-
def test_http_import
|
278
|
-
assert_equal("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\";\n",
|
279
|
-
render("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\";"))
|
280
|
-
end
|
281
|
-
|
282
|
-
def test_url_import
|
283
|
-
assert_equal("@import url(fonts.sass);\n", render("@import url(fonts.sass);"))
|
284
|
-
end
|
285
|
-
|
286
|
-
def test_block_comment_in_script
|
287
|
-
assert_equal <<CSS, render(<<SCSS)
|
288
|
-
foo {
|
289
|
-
a: 1bar; }
|
290
|
-
CSS
|
291
|
-
foo {a: 1 + /* flang */ bar}
|
292
|
-
SCSS
|
293
|
-
end
|
294
|
-
|
295
|
-
def test_line_comment_in_script
|
296
|
-
assert_equal <<CSS, render(<<SCSS)
|
297
|
-
foo {
|
298
|
-
a: 1blang; }
|
299
|
-
CSS
|
300
|
-
foo {a: 1 + // flang }
|
301
|
-
blang }
|
302
|
-
SCSS
|
303
|
-
end
|
304
|
-
|
305
|
-
## Nested Rules
|
306
|
-
|
307
|
-
def test_nested_rules
|
308
|
-
assert_equal <<CSS, render(<<SCSS)
|
309
|
-
foo bar {
|
310
|
-
a: b; }
|
311
|
-
CSS
|
312
|
-
foo {bar {a: b}}
|
313
|
-
SCSS
|
314
|
-
assert_equal <<CSS, render(<<SCSS)
|
315
|
-
foo bar {
|
316
|
-
a: b; }
|
317
|
-
foo baz {
|
318
|
-
b: c; }
|
319
|
-
CSS
|
320
|
-
foo {
|
321
|
-
bar {a: b}
|
322
|
-
baz {b: c}}
|
323
|
-
SCSS
|
324
|
-
assert_equal <<CSS, render(<<SCSS)
|
325
|
-
foo bar baz {
|
326
|
-
a: b; }
|
327
|
-
foo bang bip {
|
328
|
-
a: b; }
|
329
|
-
CSS
|
330
|
-
foo {
|
331
|
-
bar {baz {a: b}}
|
332
|
-
bang {bip {a: b}}}
|
333
|
-
SCSS
|
334
|
-
end
|
335
|
-
|
336
|
-
def test_nested_rules_with_declarations
|
337
|
-
assert_equal <<CSS, render(<<SCSS)
|
338
|
-
foo {
|
339
|
-
a: b; }
|
340
|
-
foo bar {
|
341
|
-
c: d; }
|
342
|
-
CSS
|
343
|
-
foo {
|
344
|
-
a: b;
|
345
|
-
bar {c: d}}
|
346
|
-
SCSS
|
347
|
-
assert_equal <<CSS, render(<<SCSS)
|
348
|
-
foo {
|
349
|
-
a: b; }
|
350
|
-
foo bar {
|
351
|
-
c: d; }
|
352
|
-
CSS
|
353
|
-
foo {
|
354
|
-
bar {c: d}
|
355
|
-
a: b}
|
356
|
-
SCSS
|
357
|
-
assert_equal <<CSS, render(<<SCSS)
|
358
|
-
foo {
|
359
|
-
ump: nump;
|
360
|
-
grump: clump; }
|
361
|
-
foo bar {
|
362
|
-
blat: bang;
|
363
|
-
habit: rabbit; }
|
364
|
-
foo bar baz {
|
365
|
-
a: b; }
|
366
|
-
foo bar bip {
|
367
|
-
c: d; }
|
368
|
-
foo bibble bap {
|
369
|
-
e: f; }
|
370
|
-
CSS
|
371
|
-
foo {
|
372
|
-
ump: nump;
|
373
|
-
grump: clump;
|
374
|
-
bar {
|
375
|
-
blat: bang;
|
376
|
-
habit: rabbit;
|
377
|
-
baz {a: b}
|
378
|
-
bip {c: d}}
|
379
|
-
bibble {
|
380
|
-
bap {e: f}}}
|
381
|
-
SCSS
|
382
|
-
end
|
383
|
-
|
384
|
-
def test_nested_rules_with_fancy_selectors
|
385
|
-
assert_equal <<CSS, render(<<SCSS)
|
386
|
-
foo .bar {
|
387
|
-
a: b; }
|
388
|
-
foo :baz {
|
389
|
-
c: d; }
|
390
|
-
foo bang:bop {
|
391
|
-
e: f; }
|
392
|
-
CSS
|
393
|
-
foo {
|
394
|
-
.bar {a: b}
|
395
|
-
:baz {c: d}
|
396
|
-
bang:bop {e: f}}
|
397
|
-
SCSS
|
398
|
-
end
|
399
|
-
|
400
|
-
def test_almost_ambiguous_nested_rules_and_declarations
|
401
|
-
assert_equal <<CSS, render(<<SCSS)
|
402
|
-
foo {
|
403
|
-
bar: baz bang bop biddle woo look at all these elems; }
|
404
|
-
foo bar:baz:bang:bop:biddle:woo:look:at:all:these:pseudoclasses {
|
405
|
-
a: b; }
|
406
|
-
foo bar:baz bang bop biddle woo look at all these elems {
|
407
|
-
a: b; }
|
408
|
-
CSS
|
409
|
-
foo {
|
410
|
-
bar:baz:bang:bop:biddle:woo:look:at:all:these:pseudoclasses {a: b};
|
411
|
-
bar:baz bang bop biddle woo look at all these elems {a: b};
|
412
|
-
bar:baz bang bop biddle woo look at all these elems; }
|
413
|
-
SCSS
|
414
|
-
end
|
415
|
-
|
416
|
-
def test_newlines_in_selectors
|
417
|
-
assert_equal <<CSS, render(<<SCSS)
|
418
|
-
foo
|
419
|
-
bar {
|
420
|
-
a: b; }
|
421
|
-
CSS
|
422
|
-
foo
|
423
|
-
bar {a: b}
|
424
|
-
SCSS
|
425
|
-
|
426
|
-
assert_equal <<CSS, render(<<SCSS)
|
427
|
-
foo baz,
|
428
|
-
foo bang,
|
429
|
-
bar baz,
|
430
|
-
bar bang {
|
431
|
-
a: b; }
|
432
|
-
CSS
|
433
|
-
foo,
|
434
|
-
bar {
|
435
|
-
baz,
|
436
|
-
bang {a: b}}
|
437
|
-
SCSS
|
438
|
-
|
439
|
-
assert_equal <<CSS, render(<<SCSS)
|
440
|
-
foo
|
441
|
-
bar baz
|
442
|
-
bang {
|
443
|
-
a: b; }
|
444
|
-
foo
|
445
|
-
bar bip bop {
|
446
|
-
c: d; }
|
447
|
-
CSS
|
448
|
-
foo
|
449
|
-
bar {
|
450
|
-
baz
|
451
|
-
bang {a: b}
|
452
|
-
|
453
|
-
bip bop {c: d}}
|
454
|
-
SCSS
|
455
|
-
|
456
|
-
assert_equal <<CSS, render(<<SCSS)
|
457
|
-
foo bang, foo bip
|
458
|
-
bop, bar
|
459
|
-
baz bang, bar
|
460
|
-
baz bip
|
461
|
-
bop {
|
462
|
-
a: b; }
|
463
|
-
CSS
|
464
|
-
foo, bar
|
465
|
-
baz {
|
466
|
-
bang, bip
|
467
|
-
bop {a: b}}
|
468
|
-
SCSS
|
469
|
-
end
|
470
|
-
|
471
|
-
def test_trailing_comma_in_selector
|
472
|
-
assert_equal <<CSS, render(<<SCSS)
|
473
|
-
#foo #bar,
|
474
|
-
#baz #boom {
|
475
|
-
a: b; }
|
476
|
-
|
477
|
-
#bip #bop {
|
478
|
-
c: d; }
|
479
|
-
CSS
|
480
|
-
#foo #bar,,
|
481
|
-
,#baz #boom, {a: b}
|
482
|
-
|
483
|
-
#bip #bop, ,, {c: d}
|
484
|
-
SCSS
|
485
|
-
end
|
486
|
-
|
487
|
-
def test_parent_selectors
|
488
|
-
assert_equal <<CSS, render(<<SCSS)
|
489
|
-
foo:hover {
|
490
|
-
a: b; }
|
491
|
-
bar foo.baz {
|
492
|
-
c: d; }
|
493
|
-
CSS
|
494
|
-
foo {
|
495
|
-
&:hover {a: b}
|
496
|
-
bar &.baz {c: d}}
|
497
|
-
SCSS
|
498
|
-
end
|
499
|
-
|
500
|
-
## Namespace Properties
|
501
|
-
|
502
|
-
def test_namespace_properties
|
503
|
-
assert_equal <<CSS, render(<<SCSS)
|
504
|
-
foo {
|
505
|
-
bar: baz;
|
506
|
-
bang-bip: 1px;
|
507
|
-
bang-bop: bar; }
|
508
|
-
CSS
|
509
|
-
foo {
|
510
|
-
bar: baz;
|
511
|
-
bang: {
|
512
|
-
bip: 1px;
|
513
|
-
bop: bar;}}
|
514
|
-
SCSS
|
515
|
-
end
|
516
|
-
|
517
|
-
def test_several_namespace_properties
|
518
|
-
assert_equal <<CSS, render(<<SCSS)
|
519
|
-
foo {
|
520
|
-
bar: baz;
|
521
|
-
bang-bip: 1px;
|
522
|
-
bang-bop: bar;
|
523
|
-
buzz-fram: "foo";
|
524
|
-
buzz-frum: moo; }
|
525
|
-
CSS
|
526
|
-
foo {
|
527
|
-
bar: baz;
|
528
|
-
bang: {
|
529
|
-
bip: 1px;
|
530
|
-
bop: bar;}
|
531
|
-
buzz: {
|
532
|
-
fram: "foo";
|
533
|
-
frum: moo;
|
534
|
-
}
|
535
|
-
}
|
536
|
-
SCSS
|
537
|
-
end
|
538
|
-
|
539
|
-
def test_nested_namespace_properties
|
540
|
-
assert_equal <<CSS, render(<<SCSS)
|
541
|
-
foo {
|
542
|
-
bar: baz;
|
543
|
-
bang-bip: 1px;
|
544
|
-
bang-bop: bar;
|
545
|
-
bang-blat-baf: bort; }
|
546
|
-
CSS
|
547
|
-
foo {
|
548
|
-
bar: baz;
|
549
|
-
bang: {
|
550
|
-
bip: 1px;
|
551
|
-
bop: bar;
|
552
|
-
blat:{baf:bort}}}
|
553
|
-
SCSS
|
554
|
-
end
|
555
|
-
|
556
|
-
def test_namespace_properties_with_value
|
557
|
-
assert_equal <<CSS, render(<<SCSS)
|
558
|
-
foo {
|
559
|
-
bar: baz;
|
560
|
-
bar-bip: bop;
|
561
|
-
bar-bing: bop; }
|
562
|
-
CSS
|
563
|
-
foo {
|
564
|
-
bar: baz {
|
565
|
-
bip: bop;
|
566
|
-
bing: bop; }}
|
567
|
-
SCSS
|
568
|
-
end
|
569
|
-
|
570
|
-
def test_namespace_properties_with_script_value
|
571
|
-
assert_equal <<CSS, render(<<SCSS)
|
572
|
-
foo {
|
573
|
-
bar: bazbang;
|
574
|
-
bar-bip: bop;
|
575
|
-
bar-bing: bop; }
|
576
|
-
CSS
|
577
|
-
foo {
|
578
|
-
bar: baz + bang {
|
579
|
-
bip: bop;
|
580
|
-
bing: bop; }}
|
581
|
-
SCSS
|
582
|
-
end
|
583
|
-
|
584
|
-
def test_no_namespace_properties_without_space
|
585
|
-
assert_equal <<CSS, render(<<SCSS)
|
586
|
-
foo bar:baz {
|
587
|
-
bip: bop; }
|
588
|
-
CSS
|
589
|
-
foo {
|
590
|
-
bar:baz {
|
591
|
-
bip: bop }}
|
592
|
-
SCSS
|
593
|
-
end
|
594
|
-
|
595
|
-
def test_no_namespace_properties_without_space_even_when_its_unambiguous
|
596
|
-
render(<<SCSS)
|
597
|
-
foo {
|
598
|
-
bar:1px {
|
599
|
-
bip: bop }}
|
600
|
-
SCSS
|
601
|
-
assert(false, "Expected syntax error")
|
602
|
-
rescue Sass::SyntaxError => e
|
603
|
-
assert_equal <<MESSAGE, e.message
|
604
|
-
Invalid CSS: a space is required between a property and its definition
|
605
|
-
when it has other properties nested beneath it.
|
606
|
-
MESSAGE
|
607
|
-
assert_equal 2, e.sass_line
|
608
|
-
end
|
609
|
-
|
610
|
-
## Mixins
|
611
|
-
|
612
|
-
def test_basic_mixins
|
613
|
-
assert_equal <<CSS, render(<<SCSS)
|
614
|
-
.foo {
|
615
|
-
a: b; }
|
616
|
-
CSS
|
617
|
-
@mixin foo {
|
618
|
-
.foo {a: b}}
|
619
|
-
|
620
|
-
@include foo;
|
621
|
-
SCSS
|
622
|
-
|
623
|
-
assert_equal <<CSS, render(<<SCSS)
|
624
|
-
bar {
|
625
|
-
c: d; }
|
626
|
-
bar .foo {
|
627
|
-
a: b; }
|
628
|
-
CSS
|
629
|
-
@mixin foo {
|
630
|
-
.foo {a: b}}
|
631
|
-
|
632
|
-
bar {
|
633
|
-
@include foo;
|
634
|
-
c: d; }
|
635
|
-
SCSS
|
636
|
-
|
637
|
-
assert_equal <<CSS, render(<<SCSS)
|
638
|
-
bar {
|
639
|
-
a: b;
|
640
|
-
c: d; }
|
641
|
-
CSS
|
642
|
-
@mixin foo {a: b}
|
643
|
-
|
644
|
-
bar {
|
645
|
-
@include foo;
|
646
|
-
c: d; }
|
647
|
-
SCSS
|
648
|
-
end
|
649
|
-
|
650
|
-
def test_mixins_with_empty_args
|
651
|
-
assert_equal <<CSS, render(<<SCSS)
|
652
|
-
.foo {
|
653
|
-
a: b; }
|
654
|
-
CSS
|
655
|
-
@mixin foo() {a: b}
|
656
|
-
|
657
|
-
.foo {@include foo();}
|
658
|
-
SCSS
|
659
|
-
|
660
|
-
assert_equal <<CSS, render(<<SCSS)
|
661
|
-
.foo {
|
662
|
-
a: b; }
|
663
|
-
CSS
|
664
|
-
@mixin foo() {a: b}
|
665
|
-
|
666
|
-
.foo {@include foo;}
|
667
|
-
SCSS
|
668
|
-
|
669
|
-
assert_equal <<CSS, render(<<SCSS)
|
670
|
-
.foo {
|
671
|
-
a: b; }
|
672
|
-
CSS
|
673
|
-
@mixin foo {a: b}
|
674
|
-
|
675
|
-
.foo {@include foo();}
|
676
|
-
SCSS
|
677
|
-
end
|
678
|
-
|
679
|
-
def test_mixins_with_args
|
680
|
-
assert_equal <<CSS, render(<<SCSS)
|
681
|
-
.foo {
|
682
|
-
a: bar; }
|
683
|
-
CSS
|
684
|
-
@mixin foo($a) {a: $a}
|
685
|
-
|
686
|
-
.foo {@include foo(bar)}
|
687
|
-
SCSS
|
688
|
-
|
689
|
-
assert_equal <<CSS, render(<<SCSS)
|
690
|
-
.foo {
|
691
|
-
a: bar;
|
692
|
-
b: 12px; }
|
693
|
-
CSS
|
694
|
-
@mixin foo($a, $b) {
|
695
|
-
a: $a;
|
696
|
-
b: $b; }
|
697
|
-
|
698
|
-
.foo {@include foo(bar, 12px)}
|
699
|
-
SCSS
|
700
|
-
end
|
701
|
-
|
702
|
-
## Functions
|
703
|
-
|
704
|
-
def test_basic_function
|
705
|
-
assert_equal(<<CSS, render(<<SASS))
|
706
|
-
bar {
|
707
|
-
a: 3; }
|
708
|
-
CSS
|
709
|
-
@function foo() {
|
710
|
-
@return 1 + 2;
|
711
|
-
}
|
712
|
-
|
713
|
-
bar {
|
714
|
-
a: foo();
|
715
|
-
}
|
716
|
-
SASS
|
717
|
-
end
|
718
|
-
|
719
|
-
def test_function_args
|
720
|
-
assert_equal(<<CSS, render(<<SASS))
|
721
|
-
bar {
|
722
|
-
a: 3; }
|
723
|
-
CSS
|
724
|
-
@function plus($var1, $var2) {
|
725
|
-
@return $var1 + $var2;
|
726
|
-
}
|
727
|
-
|
728
|
-
bar {
|
729
|
-
a: plus(1, 2);
|
730
|
-
}
|
731
|
-
SASS
|
732
|
-
end
|
733
|
-
|
734
|
-
## Interpolation
|
735
|
-
|
736
|
-
def test_basic_selector_interpolation
|
737
|
-
assert_equal <<CSS, render(<<SCSS)
|
738
|
-
foo 3 baz {
|
739
|
-
a: b; }
|
740
|
-
CSS
|
741
|
-
foo \#{1 + 2} baz {a: b}
|
742
|
-
SCSS
|
743
|
-
assert_equal <<CSS, render(<<SCSS)
|
744
|
-
foo.bar baz {
|
745
|
-
a: b; }
|
746
|
-
CSS
|
747
|
-
foo\#{".bar"} baz {a: b}
|
748
|
-
SCSS
|
749
|
-
assert_equal <<CSS, render(<<SCSS)
|
750
|
-
foo.bar baz {
|
751
|
-
a: b; }
|
752
|
-
CSS
|
753
|
-
\#{"foo"}.bar baz {a: b}
|
754
|
-
SCSS
|
755
|
-
end
|
756
|
-
|
757
|
-
def test_selector_only_interpolation
|
758
|
-
assert_equal <<CSS, render(<<SCSS)
|
759
|
-
foo bar {
|
760
|
-
a: b; }
|
761
|
-
CSS
|
762
|
-
\#{"foo" + " bar"} {a: b}
|
763
|
-
SCSS
|
764
|
-
end
|
765
|
-
|
766
|
-
def test_selector_interpolation_before_element_name
|
767
|
-
assert_equal <<CSS, render(<<SCSS)
|
768
|
-
foo barbaz {
|
769
|
-
a: b; }
|
770
|
-
CSS
|
771
|
-
\#{"foo" + " bar"}baz {a: b}
|
772
|
-
SCSS
|
773
|
-
end
|
774
|
-
|
775
|
-
def test_selector_interpolation_in_string
|
776
|
-
assert_equal <<CSS, render(<<SCSS)
|
777
|
-
foo[val="bar foo bar baz"] {
|
778
|
-
a: b; }
|
779
|
-
CSS
|
780
|
-
foo[val="bar \#{"foo" + " bar"} baz"] {a: b}
|
781
|
-
SCSS
|
782
|
-
end
|
783
|
-
|
784
|
-
def test_selector_interpolation_in_pseudoclass
|
785
|
-
assert_equal <<CSS, render(<<SCSS)
|
786
|
-
foo:nth-child(5n) {
|
787
|
-
a: b; }
|
788
|
-
CSS
|
789
|
-
foo:nth-child(\#{5 + "n"}) {a: b}
|
790
|
-
SCSS
|
791
|
-
end
|
792
|
-
|
793
|
-
def test_selector_interpolation_at_class_begininng
|
794
|
-
assert_equal <<CSS, render(<<SCSS)
|
795
|
-
.zzz {
|
796
|
-
a: b; }
|
797
|
-
CSS
|
798
|
-
$zzz: zzz;
|
799
|
-
.\#{$zzz} { a: b; }
|
800
|
-
SCSS
|
801
|
-
end
|
802
|
-
|
803
|
-
def test_selector_interpolation_at_id_begininng
|
804
|
-
assert_equal <<CSS, render(<<SCSS)
|
805
|
-
#zzz {
|
806
|
-
a: b; }
|
807
|
-
CSS
|
808
|
-
$zzz: zzz;
|
809
|
-
#\#{$zzz} { a: b; }
|
810
|
-
SCSS
|
811
|
-
end
|
812
|
-
|
813
|
-
def test_selector_interpolation_at_pseudo_begininng
|
814
|
-
assert_equal <<CSS, render(<<SCSS)
|
815
|
-
:zzz::zzz {
|
816
|
-
a: b; }
|
817
|
-
CSS
|
818
|
-
$zzz: zzz;
|
819
|
-
:\#{$zzz}::\#{$zzz} { a: b; }
|
820
|
-
SCSS
|
821
|
-
end
|
822
|
-
|
823
|
-
def test_selector_interpolation_at_attr_beginning
|
824
|
-
assert_equal <<CSS, render(<<SCSS)
|
825
|
-
[zzz=foo] {
|
826
|
-
a: b; }
|
827
|
-
CSS
|
828
|
-
$zzz: zzz;
|
829
|
-
[\#{$zzz}=foo] { a: b; }
|
830
|
-
SCSS
|
831
|
-
end
|
832
|
-
|
833
|
-
def test_selector_interpolation_at_dashes
|
834
|
-
assert_equal <<CSS, render(<<SCSS)
|
835
|
-
div {
|
836
|
-
-foo-a-b-foo: foo; }
|
837
|
-
CSS
|
838
|
-
$a : a;
|
839
|
-
$b : b;
|
840
|
-
div { -foo-\#{$a}-\#{$b}-foo: foo }
|
841
|
-
SCSS
|
842
|
-
end
|
843
|
-
|
844
|
-
def test_basic_prop_name_interpolation
|
845
|
-
assert_equal <<CSS, render(<<SCSS)
|
846
|
-
foo {
|
847
|
-
barbazbang: blip; }
|
848
|
-
CSS
|
849
|
-
foo {bar\#{"baz" + "bang"}: blip}
|
850
|
-
SCSS
|
851
|
-
assert_equal <<CSS, render(<<SCSS)
|
852
|
-
foo {
|
853
|
-
bar3: blip; }
|
854
|
-
CSS
|
855
|
-
foo {bar\#{1 + 2}: blip}
|
856
|
-
SCSS
|
857
|
-
end
|
858
|
-
|
859
|
-
def test_prop_name_only_interpolation
|
860
|
-
assert_equal <<CSS, render(<<SCSS)
|
861
|
-
foo {
|
862
|
-
bazbang: blip; }
|
863
|
-
CSS
|
864
|
-
foo {\#{"baz" + "bang"}: blip}
|
865
|
-
SCSS
|
866
|
-
end
|
867
|
-
|
868
|
-
## Errors
|
869
|
-
|
870
|
-
def test_mixin_defs_only_at_toplevel
|
871
|
-
render <<SCSS
|
872
|
-
foo {
|
873
|
-
@mixin bar {a: b}}
|
874
|
-
SCSS
|
875
|
-
assert(false, "Expected syntax error")
|
876
|
-
rescue Sass::SyntaxError => e
|
877
|
-
assert_equal "Mixins may only be defined at the root of a document.", e.message
|
878
|
-
assert_equal 2, e.sass_line
|
879
|
-
end
|
880
|
-
|
881
|
-
def test_rules_beneath_properties
|
882
|
-
render <<SCSS
|
883
|
-
foo {
|
884
|
-
bar: {
|
885
|
-
baz {
|
886
|
-
bang: bop }}}
|
887
|
-
SCSS
|
888
|
-
assert(false, "Expected syntax error")
|
889
|
-
rescue Sass::SyntaxError => e
|
890
|
-
assert_equal 'Illegal nesting: Only properties may be nested beneath properties.', e.message
|
891
|
-
assert_equal 3, e.sass_line
|
892
|
-
end
|
893
|
-
|
894
|
-
def test_uses_property_exception_with_star_hack
|
895
|
-
# Silence the "beginning of selector" warning
|
896
|
-
Sass::Util.silence_warnings {render <<SCSS}
|
897
|
-
foo {
|
898
|
-
*bar:baz [fail]; }
|
899
|
-
SCSS
|
900
|
-
assert(false, "Expected syntax error")
|
901
|
-
rescue Sass::SyntaxError => e
|
902
|
-
assert_equal 'Invalid CSS after " *bar:baz ": expected ";", was "[fail]; }"', e.message
|
903
|
-
assert_equal 2, e.sass_line
|
904
|
-
end
|
905
|
-
|
906
|
-
def test_uses_property_exception_with_colon_hack
|
907
|
-
render <<SCSS
|
908
|
-
foo {
|
909
|
-
:bar:baz [fail]; }
|
910
|
-
SCSS
|
911
|
-
assert(false, "Expected syntax error")
|
912
|
-
rescue Sass::SyntaxError => e
|
913
|
-
assert_equal 'Invalid CSS after " :bar:baz ": expected ";", was "[fail]; }"', e.message
|
914
|
-
assert_equal 2, e.sass_line
|
915
|
-
end
|
916
|
-
|
917
|
-
def test_uses_rule_exception_with_dot_hack
|
918
|
-
render <<SCSS
|
919
|
-
foo {
|
920
|
-
.bar:baz <fail>; }
|
921
|
-
SCSS
|
922
|
-
assert(false, "Expected syntax error")
|
923
|
-
rescue Sass::SyntaxError => e
|
924
|
-
assert_equal 'Invalid CSS after " .bar:baz ": expected "{", was "<fail>; }"', e.message
|
925
|
-
assert_equal 2, e.sass_line
|
926
|
-
end
|
927
|
-
|
928
|
-
def test_uses_property_exception_with_space_after_name
|
929
|
-
render <<SCSS
|
930
|
-
foo {
|
931
|
-
bar: baz [fail]; }
|
932
|
-
SCSS
|
933
|
-
assert(false, "Expected syntax error")
|
934
|
-
rescue Sass::SyntaxError => e
|
935
|
-
assert_equal 'Invalid CSS after " bar: baz ": expected ";", was "[fail]; }"', e.message
|
936
|
-
assert_equal 2, e.sass_line
|
937
|
-
end
|
938
|
-
|
939
|
-
def test_uses_property_exception_with_non_identifier_after_name
|
940
|
-
render <<SCSS
|
941
|
-
foo {
|
942
|
-
bar:1px [fail]; }
|
943
|
-
SCSS
|
944
|
-
assert(false, "Expected syntax error")
|
945
|
-
rescue Sass::SyntaxError => e
|
946
|
-
assert_equal 'Invalid CSS after " bar:1px ": expected ";", was "[fail]; }"', e.message
|
947
|
-
assert_equal 2, e.sass_line
|
948
|
-
end
|
949
|
-
|
950
|
-
def test_uses_property_exception_when_followed_by_open_bracket
|
951
|
-
render <<SCSS
|
952
|
-
foo {
|
953
|
-
bar:{baz: .fail} }
|
954
|
-
SCSS
|
955
|
-
assert(false, "Expected syntax error")
|
956
|
-
rescue Sass::SyntaxError => e
|
957
|
-
assert_equal 'Invalid CSS after " bar:{baz: ": expected expression (e.g. 1px, bold), was ".fail} }"', e.message
|
958
|
-
assert_equal 2, e.sass_line
|
959
|
-
end
|
960
|
-
|
961
|
-
def test_script_error
|
962
|
-
render <<SCSS
|
963
|
-
foo {
|
964
|
-
bar: "baz" * * }
|
965
|
-
SCSS
|
966
|
-
assert(false, "Expected syntax error")
|
967
|
-
rescue Sass::SyntaxError => e
|
968
|
-
assert_equal 'Invalid CSS after " bar: "baz" * ": expected expression (e.g. 1px, bold), was "* }"', e.message
|
969
|
-
assert_equal 2, e.sass_line
|
970
|
-
end
|
971
|
-
|
972
|
-
def test_multiline_script_syntax_error
|
973
|
-
render <<SCSS
|
974
|
-
foo {
|
975
|
-
bar:
|
976
|
-
"baz" * * }
|
977
|
-
SCSS
|
978
|
-
assert(false, "Expected syntax error")
|
979
|
-
rescue Sass::SyntaxError => e
|
980
|
-
assert_equal 'Invalid CSS after " "baz" * ": expected expression (e.g. 1px, bold), was "* }"', e.message
|
981
|
-
assert_equal 3, e.sass_line
|
982
|
-
end
|
983
|
-
|
984
|
-
def test_multiline_script_runtime_error
|
985
|
-
render <<SCSS
|
986
|
-
foo {
|
987
|
-
bar: "baz" +
|
988
|
-
"bar" +
|
989
|
-
$bang }
|
990
|
-
SCSS
|
991
|
-
assert(false, "Expected syntax error")
|
992
|
-
rescue Sass::SyntaxError => e
|
993
|
-
assert_equal "Undefined variable: \"$bang\".", e.message
|
994
|
-
assert_equal 4, e.sass_line
|
995
|
-
end
|
996
|
-
|
997
|
-
def test_post_multiline_script_runtime_error
|
998
|
-
render <<SCSS
|
999
|
-
foo {
|
1000
|
-
bar: "baz" +
|
1001
|
-
"bar" +
|
1002
|
-
"baz";
|
1003
|
-
bip: $bop; }
|
1004
|
-
SCSS
|
1005
|
-
assert(false, "Expected syntax error")
|
1006
|
-
rescue Sass::SyntaxError => e
|
1007
|
-
assert_equal "Undefined variable: \"$bop\".", e.message
|
1008
|
-
assert_equal 5, e.sass_line
|
1009
|
-
end
|
1010
|
-
|
1011
|
-
def test_multiline_property_runtime_error
|
1012
|
-
render <<SCSS
|
1013
|
-
foo {
|
1014
|
-
bar: baz
|
1015
|
-
bar
|
1016
|
-
\#{$bang} }
|
1017
|
-
SCSS
|
1018
|
-
assert(false, "Expected syntax error")
|
1019
|
-
rescue Sass::SyntaxError => e
|
1020
|
-
assert_equal "Undefined variable: \"$bang\".", e.message
|
1021
|
-
assert_equal 4, e.sass_line
|
1022
|
-
end
|
1023
|
-
|
1024
|
-
def test_post_resolution_selector_error
|
1025
|
-
render "\n\nfoo \#{\") bar\"} {a: b}"
|
1026
|
-
assert(false, "Expected syntax error")
|
1027
|
-
rescue Sass::SyntaxError => e
|
1028
|
-
assert_equal 'Invalid CSS after "foo ": expected selector, was ") bar"', e.message
|
1029
|
-
assert_equal 3, e.sass_line
|
1030
|
-
end
|
1031
|
-
|
1032
|
-
def test_parent_in_mid_selector_error
|
1033
|
-
assert_raise_message(Sass::SyntaxError, <<MESSAGE.rstrip) {render <<SCSS}
|
1034
|
-
Invalid CSS after ".foo": expected "{", was "&.bar"
|
1035
|
-
|
1036
|
-
"&" may only be used at the beginning of a selector.
|
1037
|
-
MESSAGE
|
1038
|
-
flim {
|
1039
|
-
.foo&.bar {a: b}
|
1040
|
-
}
|
1041
|
-
SCSS
|
1042
|
-
end
|
1043
|
-
|
1044
|
-
def test_parent_in_mid_selector_error
|
1045
|
-
assert_raise_message(Sass::SyntaxError, <<MESSAGE.rstrip) {render <<SCSS}
|
1046
|
-
Invalid CSS after " .foo.bar": expected "{", was "& {a: b}"
|
1047
|
-
|
1048
|
-
"&" may only be used at the beginning of a selector.
|
1049
|
-
MESSAGE
|
1050
|
-
flim {
|
1051
|
-
.foo.bar& {a: b}
|
1052
|
-
}
|
1053
|
-
SCSS
|
1054
|
-
end
|
1055
|
-
|
1056
|
-
def test_double_parent_selector_error
|
1057
|
-
assert_raise_message(Sass::SyntaxError, <<MESSAGE.rstrip) {render <<SCSS}
|
1058
|
-
Invalid CSS after " &": expected "{", was "& {a: b}"
|
1059
|
-
|
1060
|
-
"&" may only be used at the beginning of a selector.
|
1061
|
-
MESSAGE
|
1062
|
-
flim {
|
1063
|
-
&& {a: b}
|
1064
|
-
}
|
1065
|
-
SCSS
|
1066
|
-
end
|
1067
|
-
|
1068
|
-
def test_no_interpolation_in_media_queries
|
1069
|
-
assert_raise_message(Sass::SyntaxError, <<MESSAGE.rstrip) {render <<SCSS}
|
1070
|
-
Invalid CSS after "...nd (min-width: ": expected expression (e.g. 1px, bold), was "\#{100}px) {"
|
1071
|
-
MESSAGE
|
1072
|
-
@media screen and (min-width: \#{100}px) {
|
1073
|
-
foo {bar: baz}
|
1074
|
-
}
|
1075
|
-
SCSS
|
1076
|
-
end
|
1077
|
-
|
1078
|
-
def test_no_interpolation_in_unrecognized_directives
|
1079
|
-
assert_raise_message(Sass::SyntaxError, <<MESSAGE.rstrip) {render <<SCSS}
|
1080
|
-
Invalid CSS after "@foo ": expected selector or at-rule, was "\#{100} {"
|
1081
|
-
MESSAGE
|
1082
|
-
@foo \#{100} {
|
1083
|
-
foo {bar: baz}
|
1084
|
-
}
|
1085
|
-
SCSS
|
1086
|
-
end
|
1087
|
-
|
1088
|
-
def test_no_lonely_else
|
1089
|
-
assert_raise_message(Sass::SyntaxError, <<MESSAGE.rstrip) {render <<SCSS}
|
1090
|
-
Invalid CSS: @else must come after @if
|
1091
|
-
MESSAGE
|
1092
|
-
@else {foo: bar}
|
1093
|
-
SCSS
|
1094
|
-
end
|
1095
|
-
|
1096
|
-
# Regression
|
1097
|
-
|
1098
|
-
def test_prop_name_interpolation_after_hyphen
|
1099
|
-
assert_equal <<CSS, render(<<SCSS)
|
1100
|
-
a {
|
1101
|
-
-foo-bar: b; }
|
1102
|
-
CSS
|
1103
|
-
a { -\#{"foo"}-bar: b; }
|
1104
|
-
SCSS
|
1105
|
-
end
|
1106
|
-
|
1107
|
-
def test_star_plus_and_parent
|
1108
|
-
assert_equal <<CSS, render(<<SCSS)
|
1109
|
-
* + html foo {
|
1110
|
-
a: b; }
|
1111
|
-
CSS
|
1112
|
-
foo {*+html & {a: b}}
|
1113
|
-
SCSS
|
1114
|
-
end
|
1115
|
-
|
1116
|
-
def test_weird_added_space
|
1117
|
-
assert_equal <<CSS, render(<<SCSS)
|
1118
|
-
foo {
|
1119
|
-
bar: -moz-bip; }
|
1120
|
-
CSS
|
1121
|
-
$value : bip;
|
1122
|
-
|
1123
|
-
foo {
|
1124
|
-
bar: -moz-\#{$value};
|
1125
|
-
}
|
1126
|
-
SCSS
|
1127
|
-
end
|
1128
|
-
|
1129
|
-
def test_interpolation_with_bracket_on_next_line
|
1130
|
-
assert_equal <<CSS, render(<<SCSS)
|
1131
|
-
a.foo b {
|
1132
|
-
color: red; }
|
1133
|
-
CSS
|
1134
|
-
a.\#{"foo"} b
|
1135
|
-
{color: red}
|
1136
|
-
SCSS
|
1137
|
-
end
|
1138
|
-
|
1139
|
-
def test_extra_comma_in_mixin_arglist_error
|
1140
|
-
assert_raise_message(Sass::SyntaxError, <<MESSAGE.rstrip) {render <<SCSS}
|
1141
|
-
Invalid CSS after "...clude foo(bar, ": expected mixin argument, was ");"
|
1142
|
-
MESSAGE
|
1143
|
-
@mixin foo($a1, $a2) {
|
1144
|
-
baz: $a1 $a2;
|
1145
|
-
}
|
1146
|
-
|
1147
|
-
.bar {
|
1148
|
-
@include foo(bar, );
|
1149
|
-
}
|
1150
|
-
SCSS
|
1151
|
-
end
|
1152
|
-
|
1153
|
-
def test_interpolation
|
1154
|
-
assert_equal <<CSS, render(<<SCSS)
|
1155
|
-
ul li#foo a span.label {
|
1156
|
-
foo: bar; }
|
1157
|
-
CSS
|
1158
|
-
$bar : "#foo";
|
1159
|
-
ul li\#{$bar} a span.label { foo: bar; }
|
1160
|
-
SCSS
|
1161
|
-
end
|
1162
|
-
|
1163
|
-
def test_mixin_with_keyword_args
|
1164
|
-
assert_equal <<CSS, render(<<SCSS)
|
1165
|
-
.mixed {
|
1166
|
-
required: foo;
|
1167
|
-
arg1: default-val1;
|
1168
|
-
arg2: non-default-val2; }
|
1169
|
-
CSS
|
1170
|
-
@mixin a-mixin($required, $arg1: default-val1, $arg2: default-val2) {
|
1171
|
-
required: $required;
|
1172
|
-
arg1: $arg1;
|
1173
|
-
arg2: $arg2;
|
1174
|
-
}
|
1175
|
-
.mixed { @include a-mixin(foo, $arg2: non-default-val2); }
|
1176
|
-
SCSS
|
1177
|
-
end
|
1178
|
-
|
1179
|
-
def test_passing_required_args_as_a_keyword_arg
|
1180
|
-
assert_equal <<CSS, render(<<SCSS)
|
1181
|
-
.mixed {
|
1182
|
-
required: foo;
|
1183
|
-
arg1: default-val1;
|
1184
|
-
arg2: default-val2; }
|
1185
|
-
CSS
|
1186
|
-
@mixin a-mixin($required, $arg1: default-val1, $arg2: default-val2) {
|
1187
|
-
required: $required;
|
1188
|
-
arg1: $arg1;
|
1189
|
-
arg2: $arg2; }
|
1190
|
-
.mixed { @include a-mixin($required: foo); }
|
1191
|
-
SCSS
|
1192
|
-
end
|
1193
|
-
|
1194
|
-
def test_passing_all_as_keyword_args_in_opposite_order
|
1195
|
-
assert_equal <<CSS, render(<<SCSS)
|
1196
|
-
.mixed {
|
1197
|
-
required: foo;
|
1198
|
-
arg1: non-default-val1;
|
1199
|
-
arg2: non-default-val2; }
|
1200
|
-
CSS
|
1201
|
-
@mixin a-mixin($required, $arg1: default-val1, $arg2: default-val2) {
|
1202
|
-
required: $required;
|
1203
|
-
arg1: $arg1;
|
1204
|
-
arg2: $arg2; }
|
1205
|
-
.mixed { @include a-mixin($arg2: non-default-val2, $arg1: non-default-val1, $required: foo); }
|
1206
|
-
SCSS
|
1207
|
-
end
|
1208
|
-
|
1209
|
-
def test_keyword_args_in_functions
|
1210
|
-
assert_equal <<CSS, render(<<SCSS)
|
1211
|
-
.keyed {
|
1212
|
-
color: rgba(170, 119, 204, 0.4); }
|
1213
|
-
CSS
|
1214
|
-
.keyed { color: rgba($color: #a7c, $alpha: 0.4) }
|
1215
|
-
SCSS
|
1216
|
-
end
|
1217
|
-
|
1218
|
-
def test_unknown_keyword_arg_raises_error
|
1219
|
-
assert_raise_message(Sass::SyntaxError, "Mixin a doesn't have an argument named $c") {render <<SCSS}
|
1220
|
-
@mixin a($b: 1) { a: $b; }
|
1221
|
-
div { @include a(1, $c: 3); }
|
1222
|
-
SCSS
|
1223
|
-
end
|
1224
|
-
|
1225
|
-
|
1226
|
-
def test_newlines_removed_from_selectors_when_compressed
|
1227
|
-
assert_equal <<CSS, render(<<SCSS, :style=>:compressed)
|
1228
|
-
z a,z b{display:block}
|
1229
|
-
CSS
|
1230
|
-
a,
|
1231
|
-
b {
|
1232
|
-
z & {
|
1233
|
-
display: block;
|
1234
|
-
}
|
1235
|
-
}
|
1236
|
-
SCSS
|
1237
|
-
end
|
1238
|
-
|
1239
|
-
def test_if_error_line
|
1240
|
-
assert_raise_line(2) {render(<<SCSS)}
|
1241
|
-
@if true {foo: bar}
|
1242
|
-
}
|
1243
|
-
SCSS
|
1244
|
-
end
|
1245
|
-
|
1246
|
-
def test_multiline_var
|
1247
|
-
assert_equal <<CSS, render(<<SCSS)
|
1248
|
-
foo {
|
1249
|
-
a: 3;
|
1250
|
-
b: false;
|
1251
|
-
c: a b c; }
|
1252
|
-
CSS
|
1253
|
-
foo {
|
1254
|
-
$var1: 1 +
|
1255
|
-
2;
|
1256
|
-
$var2: true and
|
1257
|
-
false;
|
1258
|
-
$var3: a b
|
1259
|
-
c;
|
1260
|
-
a: $var1;
|
1261
|
-
b: $var2;
|
1262
|
-
c: $var3; }
|
1263
|
-
SCSS
|
1264
|
-
end
|
1265
|
-
|
1266
|
-
def test_options_passed_to_script
|
1267
|
-
assert_equal <<CSS, render(<<SCSS, :style => :compressed)
|
1268
|
-
foo{color:#000}
|
1269
|
-
CSS
|
1270
|
-
foo {color: darken(black, 10%)}
|
1271
|
-
SCSS
|
1272
|
-
end
|
1273
|
-
end
|