diff --git a/lib/locomotive/liquid/filters/html.rb b/lib/locomotive/liquid/filters/html.rb index 963cfd30..0f804f5c 100644 --- a/lib/locomotive/liquid/filters/html.rb +++ b/lib/locomotive/liquid/filters/html.rb @@ -5,7 +5,7 @@ module Locomotive # Write the link to a stylesheet resource # input: url of the css file - def stylesheet_tag(input) + def stylesheet_tag(input,media='screen') return '' if input.nil? unless input =~ /^(\/|http:)/ @@ -14,7 +14,7 @@ module Locomotive input = "#{input}.css" unless input.ends_with?('.css') - %{} + %{} end # Write the link to javascript resource diff --git a/spec/lib/locomotive/liquid/filters/html_spec.rb b/spec/lib/locomotive/liquid/filters/html_spec.rb index d6da61f1..99f1ef03 100644 --- a/spec/lib/locomotive/liquid/filters/html_spec.rb +++ b/spec/lib/locomotive/liquid/filters/html_spec.rb @@ -25,6 +25,24 @@ describe Locomotive::Liquid::Filters::Html do stylesheet_tag('/trash/main.css').should == result stylesheet_tag('/trash/main').should == result end + + it 'should return a link tag for a stylesheet file and media attribute set to print' do + result = "" + stylesheet_tag('main.css','print').should == result + stylesheet_tag('main','print').should == result + stylesheet_tag(nil).should == '' + end + + it 'should return a link tag for a stylesheet file with folder and media attribute set to print' do + result = "" + stylesheet_tag('trash/main.css','print').should == result + end + + it 'should return a link tag for a stylesheet file without touching the url and media attribute set to print' do + result = "" + stylesheet_tag('/trash/main.css','print').should == result + stylesheet_tag('/trash/main','print').should == result + end it 'should return a script tag for a javascript file' do result = %{}