diff options
author | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2017-12-06 23:04:53 +0300 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2018-06-05 17:20:21 +0300 |
commit | 9e14f437b6ed205744d916f5566ee2c11e52b734 (patch) | |
tree | 5c4bf1237cfc4a6cf73f30f942d25e0ab4f0973c /spec/lib/gitlab/favicon_spec.rb | |
parent | 5202c3f0c8da618e2d3821917f6f5d48ae8ae3c2 (diff) |
create favicon overlay on the client
the initial reason for this change was that graphicsmagick does not
support writing to ico files. this fact lead to a chain of changes:
1. use png instead of ico (browser support is good enough)
2. render the overlays on the client using the canvas API. this way we
only need to store the original favion and generate the overlay versions
dynamically.
this change also enables (next step) to simplify the handling of the
stock favicons as well, as we don't need to generate all the versions
upfront.
Diffstat (limited to 'spec/lib/gitlab/favicon_spec.rb')
-rw-r--r-- | spec/lib/gitlab/favicon_spec.rb | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/spec/lib/gitlab/favicon_spec.rb b/spec/lib/gitlab/favicon_spec.rb index 51b8fda81d1..22b9c631ed8 100644 --- a/spec/lib/gitlab/favicon_spec.rb +++ b/spec/lib/gitlab/favicon_spec.rb @@ -19,20 +19,34 @@ RSpec.describe Gitlab::Favicon, :request_store do it 'uses the custom favicon if a favicon appearance is present' do create :appearance, favicon: fixture_file_upload(Rails.root.join('spec/fixtures/dk.png')) - expect(described_class.main).to match %r{/uploads/-/system/appearance/favicon/\d+/favicon_main_dk.ico} + expect(described_class.main).to match %r{/uploads/-/system/appearance/favicon/\d+/favicon_main_dk.png} end end - describe '.status' do - subject { described_class.status('favicon_status_created') } + describe '.status_overlay' do + subject { described_class.status_overlay('favicon_status_created') } - it 'defaults to the stock icon' do - expect(subject).to eq '/assets/ci_favicons/favicon_status_created.ico' + it 'returns the overlay for the status' do + expect(subject).to eq '/assets/ci_favicons/overlays/favicon_status_created.png' end + end - it 'uses the custom favicon if a favicon appearance is present' do - create :appearance, favicon: fixture_file_upload(Rails.root.join('spec/fixtures/dk.png')) - expect(subject).to match(%r{/uploads/-/system/appearance/favicon/\d+/favicon_status_created_dk.ico}) + describe '.available_status_names' do + subject { described_class.available_status_names } + + it 'returns the available status names' do + expect(subject).to eq %w( + favicon_status_canceled + favicon_status_created + favicon_status_failed + favicon_status_manual + favicon_status_not_found + favicon_status_pending + favicon_status_running + favicon_status_skipped + favicon_status_success + favicon_status_warning + ) end end end |