Skip to content

Commit

Permalink
add sassc import source map test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Horth committed Oct 4, 2016
1 parent fbcfd33 commit 30986f2
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/test_source_maps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,39 @@ def setup
"names" => []
}, map)
end

test "compile scss source map with imported dependencies" do
asset = silence_warnings do
@env.find_asset("sass/with-import.css")
end
assert asset
assert_equal fixture_path('source-maps/sass/with-import.scss'), asset.filename
assert_equal "text/css", asset.content_type

assert_match "body {\n color: red; }", asset.source

asset = silence_warnings do
@env.find_asset("sass/with-import.css.map")
end
assert asset
assert_equal fixture_path('source-maps/sass/with-import.scss'), asset.filename
assert_equal "sass/with-import.css.map", asset.logical_path
assert_equal "application/css-sourcemap+json", asset.content_type
assert_equal [
"file://#{fixture_path_for_uri('source-maps/sass/_imported.scss')}?type=text/scss&pipeline=source",
"file://#{fixture_path_for_uri('source-maps/sass/with-import.scss')}?type=text/scss&pipeline=source"
], normalize_uris(asset.links)

assert map = JSON.parse(asset.source)
assert_equal({
"version" => 3,
"file" => "sass/with-import.css",
"mappings" => "AAAA,IAAK;EAAE,KAAK,EAAE,GAAG;;ACEjB,GAAI;EAAE,KAAK,EAAE,IAAI",
"sources" => [
"_imported.source-9767e91e9d4b0334e59a1d389e9801bc6a2c5c4a5500a3c2c7915687965b2c16.scss",
"with-import.source-5d53742ba113ac26396986bf14ab5c7e19ef193e494d5d868a9362e3e057cb26.scss"
],
"names" => []
}, map)
end
end

0 comments on commit 30986f2

Please sign in to comment.