mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
[Sass] [SCSS] Add tests for things defined in the wrong spots.
This commit is contained in:
parent
220edd6773
commit
d25716143a
2 changed files with 35 additions and 0 deletions
|
@ -525,6 +525,17 @@ SCSS
|
|||
assert_not_parses('"{"', 'p<err># foo {a: b}')
|
||||
end
|
||||
|
||||
def test_no_properties_at_toplevel
|
||||
render <<SCSS
|
||||
foo {a: b}
|
||||
a: b;
|
||||
SCSS
|
||||
assert(false, "Expected error")
|
||||
rescue Sass::SyntaxError => e
|
||||
assert_equal "Properties aren't allowed at the root of a document.", e.message
|
||||
assert_equal 2, e.sass_line
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def assert_valid_string(ident)
|
||||
|
|
|
@ -271,4 +271,28 @@ CSS
|
|||
.foo {@include foo("bar", 12px)}
|
||||
SCSS
|
||||
end
|
||||
|
||||
## Errors
|
||||
|
||||
def test_mixin_defs_only_at_toplevel
|
||||
render <<SCSS
|
||||
foo {
|
||||
@mixin bar {a: b}}
|
||||
SCSS
|
||||
assert(false, "Expected syntax error")
|
||||
rescue Sass::SyntaxError => e
|
||||
assert_equal "Mixins may only be defined at the root of a document.", e.message
|
||||
assert_equal 2, e.sass_line
|
||||
end
|
||||
|
||||
def test_imports_only_at_toplevel
|
||||
render <<SCSS
|
||||
foo {
|
||||
@import foo.scss;}
|
||||
SCSS
|
||||
assert(false, "Expected syntax error")
|
||||
rescue Sass::SyntaxError => e
|
||||
assert_equal "Import directives may only be used at the root of a document.", e.message
|
||||
assert_equal 2, e.sass_line
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue