Skip to content

Commit

Permalink
Customize alt text instructions link
Browse files Browse the repository at this point in the history
  • Loading branch information
corylown committed Oct 24, 2024
1 parent 8ac7ccb commit 73f6e6e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/assets/javascripts/sir_trevor_block_overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ if (navigator.userAgentData && navigator.userAgentData.brands &&
Boolean(navigator.userAgentData.brands.find(function(b) { return b.brand === 'Chromium' && parseFloat(b.version, 10) >= 95 && parseFloat(b.version, 10) < 97; }))) {
SirTrevor.Blocks.Text.prototype.editorHTML = "<div class=\"st-text-block\" spellcheck=\"false\" contenteditable=\"true\"></div>";
}

// Override the alt text link url so it goes to Stanford's guidelines
SirTrevor.Locales.en.blocks.alt_text_guidelines = $.extend(SirTrevor.Locales.en.blocks.alt_text_guidelines, {
link_url: 'https://uit.stanford.edu/accessibility/concepts/images'
});
21 changes: 21 additions & 0 deletions spec/features/alt_text_instructions_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

require 'rails_helper'

describe 'Alt text instructions', :js do
include JavascriptFeatureHelpers

let(:exhibit) { create(:exhibit) }
let(:exhibit_curator) { create(:exhibit_curator, exhibit: exhibit) }

before do
login_as exhibit_curator
visit spotlight.edit_exhibit_home_page_path(exhibit)
add_widget 'uploaded_items'
end

it 'displays alternative text guidelines with the customized link' do
expect(page).to have_content('For each item, please enter alternative text')
expect(page).to have_link('Guidelines for writing alt text.', href: 'https://uit.stanford.edu/accessibility/concepts/images')
end
end

0 comments on commit 73f6e6e

Please sign in to comment.