Sha256: 22182d9687f81edb04861bad5287d8a181ce46f3e19082432f20104657400c52
Contents?: true
Size: 1.56 KB
Versions: 3
Compression:
Stored size: 1.56 KB
Contents
require_relative "test_helper" class FunctionsTest < SassCTest SassString = Struct.new(:value, :type) do def to_s value end end module ::SassC::Script::Functions def javascript_path(path) ::SassC::Script::String.new("/js/#{path.value}", :string) end def no_return_path(path) nil end def sass_return_path(path) return SassString.new("'#{path.value}'", :string) end module Compass def stylesheet_path(path) ::SassC::Script::String.new("/css/#{path.value}", :identifier) end end include Compass end def test_functions_may_return_sass_string_type engine = ::SassC::Engine.new("div {url: url(sass_return_path('foo.svg'));}") assert_equal <<-EOS, engine.render div { url: url("foo.svg"); } EOS end def test_functions_work filename = fixture_path('paths.scss') data = File.read(filename) engine = ::SassC::Engine.new(data, { filename: filename, syntax: :scss }) # test identifier / string types # test varying quotes assert_equal <<-EOS, engine.render div { url: url(asset-path("foo.svg")); url: url(image-path("foo.png")); url: url(video-path("foo.mov")); url: url(audio-path("foo.mp3")); url: url(font-path("foo.woff")); url: url("/js/foo.js"); url: url("/js/foo.js"); url: url(/css/foo.css); } EOS end def test_function_with_no_return_value engine = ::SassC::Engine.new("div {url: url(no-return-path('foo.svg'));}") assert_equal <<-EOS, engine.render div { url: url(); } EOS end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sassc-0.0.10 | test/functions_test.rb |
sassc-0.0.9 | test/functions_test.rb |
sassc-0.0.8 | test/functions_test.rb |