Skip to content

Commit

Permalink
Skip safari pinned tab when source is not a SVG. Fixes #16 (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
afaundez authored Jan 16, 2019
1 parent 8097239 commit 851006d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Skip safari pinned tab when source is not a SVG

## [0.2.4] - 2018-10-05
### Fixed
Expand Down
2 changes: 2 additions & 0 deletions lib/jekyll/favicon/templates/safari.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
<%- Favicon.config['apple-touch-icon']['sizes'].each do |size| -%>
<link rel="apple-touch-icon" sizes="<%= size %>" href="<%= File.join favicon_path, "favicon-#{size}.png" %>">
<%- end -%>
<% if Favicon.config['source'].svg? %>
<link rel="mask-icon" color="<%= Favicon.config['safari-pinned-tab']['mask-icon-color'] %>" href="<%= File.join favicon_path, 'safari-pinned-tab.svg' %>">
<% end %>
30 changes: 30 additions & 0 deletions test/jekyll/favicon/tag_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,35 @@
css_selector = 'meta[content="' + browserconfig_path + '"]'
assert @index_document.at_css(css_selector)
end

it 'should include safari pinned tag' do
pinned_path = File.join @site_baseurl,
Jekyll::Favicon.config['path'],
'safari-pinned-tab.svg'
css_selector = 'link[ rel="mask-icon"][href="' + pinned_path + '"]'
assert @index_document.at_css(css_selector)
assert pinned_path, @index_document.css(css_selector).attribute('href')
end
end

describe 'when site uses default PNG favicon' do
before :all do
@options['source'] = fixture 'sites', 'minimal-png-source'
@config = Jekyll.configuration @options
@site = Jekyll::Site.new @config
@site.process
@destination = @options['destination']
index_destination = File.join(@destination, 'index.html')
@index_document = Nokogiri::Slop File.open(index_destination)
@site_baseurl = @site.baseurl || ''
end

it 'should skip safari pinned tag' do
pinned_path = File.join @site_baseurl,
Jekyll::Favicon.config['path'],
'safari-pinned-tab.svg'
css_selector = 'link[ rel="mask-icon"][href="' + pinned_path + '"]'
refute @index_document.at_css(css_selector)
end
end
end

0 comments on commit 851006d

Please sign in to comment.