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

Prevent submission if password not added #5241

Prev Previous commit
Next Next commit
adds test
jacklynhma committed Nov 14, 2024
commit 29e05754235ab1555d31e6bd7a56cd381bca93f1
11 changes: 11 additions & 0 deletions app/views/dashboards/_subject.html.erb
Original file line number Diff line number Diff line change
@@ -23,6 +23,17 @@
</div>
<% end %>

<% if user.homepage_url.present? %>
<div class="flex items-center mb-4 text-b3 lg:text-b2">
<%= icon_tag("link", color: :primary, class: "w-6 text-orange mr-3") %>
<p class="text-neutral-800 dark:text-white"><%=
link_to(
user.homepage_url
)
%></p>
</div>
<% end %>

<% if user.twitter_username.present? %>
<div class="flex items-center mb-4 text-b3 lg:text-b2">
<%= icon_tag("x-twitter", color: :primary, class: "w-6 text-orange mr-3") %>
2 changes: 1 addition & 1 deletion app/views/profiles/edit.html.erb
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@

<div class="text_field">
<%= form.label :homepage_url, class: 'form__label form__label__icon-container' do %>

<span class='form__label__text'><%= t('.homepage_url') %></span>
<% end %>

15 changes: 15 additions & 0 deletions test/integration/profile_test.rb
Original file line number Diff line number Diff line change
@@ -133,6 +133,21 @@ def sign_out
assert page.has_link?("@nick1", href: "https://twitter.com/nick1")
end

test "adding homepage url" do
sign_in
visit profile_path("nick1")

click_link "Edit Profile"
fill_in "user_homepage_url", with: "https://nickisawesome.com"
fill_in "Password", with: PasswordHelpers::SECURE_TEST_PASSWORD
click_button "Update"

click_link "Sign out"
visit profile_path("nick1")

assert page.has_link?("https://nickisawesome.com")
end

test "deleting profile" do
sign_in
visit profile_path("nick1")