Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tests #1123

Merged
merged 2 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
branches:
- main
- bl8

jobs:
tests:
Expand Down
3 changes: 2 additions & 1 deletion app/components/blacklight/top_navbar_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@
<div class="container pt-3">
<div class="row justify-content-center">
<form
class="col-md-8"
class="col-md-8 feedback-form"
action="/feedback"
accept-charset="UTF-8"
method="post"
>
<input type="hidden" id="url" name="url" value="<%= request.original_url %>" />
<div class="alert alert-info" role="alert">
Reporting from:
<%= root_url %>
Expand Down
4 changes: 3 additions & 1 deletion app/components/blacklight/top_navbar_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

module Blacklight
class TopNavbarComponent < Blacklight::Component
def initialize(blacklight_config:)
super
@blacklight_config = blacklight_config
end

Expand All @@ -13,4 +15,4 @@ def logo_link(title: application_name)
link_to title, blacklight_config.logo_link, class: 'mb-0 navbar-brand navbar-logo'
end
end
end
end
4 changes: 3 additions & 1 deletion app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ class CatalogController < ApplicationController

# Custom tools for GeoBlacklight
config.add_show_tools_partial :metadata, if: proc { |_context, _config, options|
options[:document] && (Settings.METADATA_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any?
options[:document] &&
(Settings.METADATA_SHOWN &
options[:document].references.refs.map { |x| x.type.to_s }).any?
}
config.add_show_tools_partial :searchworks_url, component: Earthworks::SearchworksUrl,
if: proc { |_context, _config, options|
Expand Down
16 changes: 16 additions & 0 deletions app/views/layouts/blacklight/base.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="google-site-verification" content="<%= Settings.GOOGLE_SITE_VERIFICATION %>" />
<meta name="msvalidate.01" content="<%= Settings.BING_SITE_VERIFICATION %>" />
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ZL7MQNBFW9"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('js', new Date());

const config = {};
<% if Settings.ANALYTICS_DEBUG %>
config.debug_mode = true
<% end %>

gtag('config', 'G-ZL7MQNBFW9', config)
</script>

<title><%= render_page_title %></title>
<script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"vite-plugin-ruby": "^5.0.0"
},
"dependencies": {
"@geoblacklight/frontend": "^5.0.0-alpha.4",
"@geoblacklight/frontend": "^5.0.0-alpha.3",
"blacklight-frontend": "^8.3.0",
"blacklight-range-limit": "^8.5.0",
"bootstrap": "^5.3.3",
Expand Down
12 changes: 6 additions & 6 deletions spec/features/feedback_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
end

it 'feedback form should be hidden' do
expect(page).to have_no_css('#feedback-form', visible: true)
expect(page).to have_css('#feedback', visible: false)
end

it 'feedback form should be shown filled out and submitted' do
click_on 'Feedback'
skip('Passes locally, not on Travis.') if ENV['CI']
expect(page).to have_css('#feedback-form', visible: true)
expect(page).to have_css('#feedback', visible: true)
expect(page).to have_button('Cancel')
within 'form.feedback-form' do
fill_in('message', with: 'This is only a test')
fill_in('name', with: 'Ronald McDonald')
fill_in('to', with: 'test@kittenz.eu')
fill_in('email', with: 'test@kittenz.eu')
click_on 'Send'
end
expect(page).to have_css('div.alert-success', text: 'Thank you! Your feedback has been sent.')
Expand All @@ -31,12 +31,12 @@

it 'feedback form should be shown filled out and submitted' do
click_on 'Feedback'
expect(page).to have_css('#feedback-form', visible: true)
expect(page).to have_link('Cancel')
expect(page).to have_css('#feedback', visible: true)
expect(page).to have_button('Cancel')
within 'form.feedback-form' do
fill_in('message', with: 'This is only a test')
fill_in('name', with: 'Ronald McDonald')
fill_in('to', with: 'test@kittenz.eu')
fill_in('email', with: 'test@kittenz.eu')
click_on 'Send'
end
expect(page).to have_css('div.alert-success', text: 'Thank you! Your feedback has been sent.')
Expand Down
4 changes: 2 additions & 2 deletions spec/features/top_navbar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
describe 'Top Navbar' do
it 'has links' do
visit root_path
within '#topnav' do
expect(page).to have_link 'Stanford University Libraries'
within 'header' do
expect(page).to have_link 'Stanford University'
expect(page).to have_link 'Login'
expect(page).to have_link 'Feedback'
end
Expand Down