2019-04-29 20:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-12 10:52:52 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
require 'stylesheet/compiler'
|
|
|
|
|
|
|
|
describe Stylesheet::Compiler do
|
2017-07-25 21:49:39 -04:00
|
|
|
describe 'compilation' do
|
|
|
|
Dir["#{Rails.root.join("app/assets/stylesheets")}/*.scss"].each do |path|
|
|
|
|
path = File.basename(path, '.scss')
|
|
|
|
|
|
|
|
it "can compile '#{path}' css" do
|
|
|
|
css, _map = Stylesheet::Compiler.compile_asset(path)
|
|
|
|
expect(css.length).to be > 1000
|
|
|
|
end
|
|
|
|
end
|
2017-04-12 10:52:52 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports asset-url" do
|
2017-08-31 00:06:56 -04:00
|
|
|
css, _map = Stylesheet::Compiler.compile(".body{background-image: asset-url('/images/favicons/github.png');}", "test.scss")
|
2017-04-12 10:52:52 -04:00
|
|
|
|
2017-08-31 00:06:56 -04:00
|
|
|
expect(css).to include("url('/images/favicons/github.png')")
|
2017-04-12 10:52:52 -04:00
|
|
|
expect(css).not_to include('asset-url')
|
|
|
|
end
|
2017-05-01 15:31:51 -04:00
|
|
|
|
|
|
|
it "supports image-url" do
|
2017-08-31 00:06:56 -04:00
|
|
|
css, _map = Stylesheet::Compiler.compile(".body{background-image: image-url('/favicons/github.png');}", "test.scss")
|
2017-05-01 15:31:51 -04:00
|
|
|
|
2017-08-31 00:06:56 -04:00
|
|
|
expect(css).to include("url('/favicons/github.png')")
|
2017-05-01 15:31:51 -04:00
|
|
|
expect(css).not_to include('image-url')
|
|
|
|
end
|
2017-04-12 10:52:52 -04:00
|
|
|
end
|