Skip to content

Commit

Permalink
Merge pull request #1640 from datadryad/logo-test
Browse files Browse the repository at this point in the history
fix: tenant logo javascript & test
  • Loading branch information
ahamelers authored May 7, 2024
2 parents 845dd0e + 1a97028 commit 00673c1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/views/stash_engine/tenant_admin/_logo.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
<% end %>
<p><label for="file-select">Choose new logo:</label>
<p><input id="file-select" type="file" accept="image/png, image/jpg, image/jpeg, image/svg+xml, .png, .jpg, .jpeg, .svg, .svgz" /></p>
<div id="file-preview" style="max-height: 60px">
<div id="file-preview">
</div>
<%= form.hidden_field :logo, value: @tenant.logo, id: 'logo_input' %>
2 changes: 1 addition & 1 deletion app/views/stash_engine/tenant_admin/edit.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ when 'ror_orgs'
when 'logo'
@tenant.logo.blank? ? '' : "<img src='#{@tenant.logo}' alt='#{@tenant.short_name} logo'/>".html_safe
end %>";
document.getElementById('<%= @field %>_button').setAttribute('aria-expanded', 'false');
document.getElementById('<%= @field %>_button_<%= @tenant.id %>').setAttribute('aria-expanded', 'false');
document.getElementById('genericModalDialog').close();
2 changes: 1 addition & 1 deletion app/views/stash_engine/tenant_admin/popup.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ document.getElementById('file-select').addEventListener('change', () => {
const reader = new FileReader();
reader.addEventListener('load', () => {
document.getElementById('logo_input').value = reader.result;
document.getElementById('file-preview').innerHTML = `<img src="${reader.result}" aria-hidden="true"/>`;
document.getElementById('file-preview').innerHTML = `<img src="${reader.result}" style="max-height: 60px;" aria-hidden="true"/>`;
});
if (file) {
reader.readAsDataURL(file);
Expand Down
2 changes: 1 addition & 1 deletion spec/features/stash_engine/tenant_admin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
expect(page).not_to have_content(@match.short_name)
end

xit 'allows changing the logo as a superuser', js: true do
it 'allows changing the logo as a superuser', js: true do
visit stash_url_helpers.tenant_admin_path
expect(page).to have_content(@match.short_name)
within(:css, "form[action=\"#{tenant_popup_path(id: @match.id, field: 'logo')}\"]") do
Expand Down

0 comments on commit 00673c1

Please sign in to comment.