Fixed hiding 'Click to edit' link for drafts (#17051)

* Fixed hiding 'Click to edit' link for drafts

* Improve "click to edit" link spec

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* Make the expectation more clear

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
This commit is contained in:
Anna Buianova 2022-03-30 22:29:36 +03:00 committed by GitHub
parent 33195929aa
commit b14e5522cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -69,7 +69,7 @@
<div class="crayons-notice crayons-notice--danger mb-4" aria-live="polite">
<strong><%= t("views.articles.unpublished.subtitle") %></strong><%= t("views.articles.unpublished.text") %>
<% if user_signed_in? %>
<a id="author-click-to-edit" href="<%= @article.path %>/edit" class="fw-bold" display="none"><%= t("views.articles.unpublished.edit") %></a>
<a id="author-click-to-edit" href="<%= @article.path %>/edit" class="fw-bold" style="display: none;"><%= t("views.articles.unpublished.edit") %></a>
<% end %>
</div>
<% end %>

View file

@ -158,9 +158,9 @@ RSpec.describe "Views an article", type: :system do
let(:query_params) { "?preview=#{article.password}" }
let(:article_user) { create(:user) }
it "does not the article edit link" do
it "renders the article edit link" do
visit article_path
expect(page.body).not_to include('display: inline-block;">Click to edit</a>')
expect(page.body).to include('display: none;">Click to edit</a>')
end
end
@ -168,10 +168,10 @@ RSpec.describe "Views an article", type: :system do
let(:query_params) { "?preview=#{article.password}" }
let(:article_user) { user }
it "does not the article edit link" do
it "does not render the article edit link" do
sign_out user
visit article_path
expect(page.body).not_to include('display: inline-block;">Click to edit</a>')
expect(page.body).not_to include("Click to edit")
end
end