Skip to content

Commit

Permalink
Fix ScssTemplate#sass_options when using sass-embedded
Browse files Browse the repository at this point in the history
Add a test for SassTemplate with unsupported options.
  • Loading branch information
jeremyevans committed Jun 21, 2024
1 parent 9f47973 commit 646bd8b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/tilt/sass.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ class ScssTemplate < SassTemplate
private

def sass_options
super
@options[:syntax] = :scss
@options
opts = super
opts[:syntax] = :scss
opts
end
end
end
11 changes: 8 additions & 3 deletions test/tilt_sasstemplate_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,26 @@
assert_equal false, Tilt::SassTemplate.new{''}.metadata[:allows_script]
end

it "compiles and evaluates the template on #render" do
it "compiles and evaluates the sass template on #render" do
template = Tilt::SassTemplate.new({ style: :compressed }) { |t| "#main\n background-color: #0000f1" }
3.times { assert_equal "#main{background-color:#0000f1}", template.render.chomp }
end

it "compiles and evaluates the sass template on #render with unsupported options" do
template = Tilt::SassTemplate.new({ style: :compressed, outvar: '@a' }) { |t| "#main\n background-color: #0000f1" }
3.times { assert_equal "#main{background-color:#0000f1}", template.render.chomp }
end

it "is registered for '.scss' files" do
assert_equal Tilt::ScssTemplate, Tilt['test.scss']
end

it "compiles and evaluates the template on #render" do
it "compiles and evaluates the scss template on #render" do
template = Tilt::ScssTemplate.new({ style: :compressed }) { |t| "#main {\n background-color: #0000f1;\n}" }
3.times { assert_equal "#main{background-color:#0000f1}", template.render.chomp }
end

it "compiles and evaluates the template on #render with unsupported options" do
it "compiles and evaluates the scss template on #render with unsupported options" do
template = Tilt::ScssTemplate.new({ style: :compressed, outvar: '@a' }) { |t| "#main {\n background-color: #0000f1;\n}" }
3.times { assert_equal "#main{background-color:#0000f1}", template.render.chomp }
end
Expand Down

0 comments on commit 646bd8b

Please sign in to comment.