[deploy] Fix article preamble style (#8756)

* Fix article preamble style

* Proper tests
This commit is contained in:
Ben Halpern 2020-06-17 20:10:41 -04:00 committed by GitHub
parent 62fdf6f897
commit 478b048fc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -129,7 +129,7 @@
<% end %>
<h1 class="fs-3xl s:fs-4xl l:fs-5xl fw-bold s:fw-heavy lh-tight mb-4 <%= @article.title_length_classification %>">
<% if @article.search_optimized_title_preamble.present? && !user_signed_in? %>
<span class="article-title-preamble"><%= @article.search_optimized_title_preamble %></span>
<span class="fs-xl color-base-70 block"><%= @article.search_optimized_title_preamble %></span>
<% end %>
<%= sanitize_and_decode @article.title %>
</h1>

View file

@ -54,19 +54,19 @@ RSpec.describe "StoriesShow", type: :request do
it "renders title preamble with search_optimized_title_preamble if set and not signed in" do
article.update_column(:search_optimized_title_preamble, "Hey this is a test")
get article.reload.path
expect(response.body).to include "<span class=\"article-title-preamble\">Hey this is a test</span>"
expect(response.body).to include "<span class=\"fs-xl color-base-70 block\">Hey this is a test</span>"
end
it "does not render preamble with search_optimized_title_preamble if set and signed in" do
sign_in user
article.update_column(:search_optimized_title_preamble, "Hey this is a test")
get article.path
expect(response.body).not_to include "<span class=\"article-title-preamble\">Hey this is a test</span>"
expect(response.body).not_to include "<span class=\"fs-xl color-base-70 block\">Hey this is a test</span>"
end
it "does not render title tag with search_optimized_title_preamble not signed in but search_optimized_title_preamble not set" do
get article.path
expect(response.body).not_to include "<span class=\"article-title-preamble\">Hey this is a test</span>"
expect(response.body).not_to include "<span class=\"fs-xl color-base-70 block\">Hey this is a test</span>"
end
it "renders user payment pointer if set" do