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

AO3-6608 Delete Alt Text With Pseud Icon #4765

Merged
merged 7 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions app/models/pseud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ def delete_icon

def clear_icon
self.icon = nil if delete_icon? && !icon.dirty?
self.icon_alt_text = nil if delete_icon?
brianjaustin marked this conversation as resolved.
Show resolved Hide resolved
end

#################################
Expand Down
12 changes: 12 additions & 0 deletions features/collections/icon.feature
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,15 @@ Feature: User icons
When I delete the icon from the collection "Pretty"
Then I should see "Collection was successfully updated."
And the "Pretty" collection should not have an icon

Scenario: Users can delete icon and alt text

Given I have an icon uploaded
When I follow "Edit Pseud"
And I fill in "pseud_icon_alt_text" with "Some test description"
And I press "Update"
Then I should see the image "alt" text "Some test description"
When I delete the icon from my psued
Then I should see "Pseud was successfully updated."
When I follow "Edit Pseud"
Then I should see the icon and alt text boxes are blank
11 changes: 11 additions & 0 deletions features/step_definitions/icon_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
step %{I press "Update"}
end

When /^I delete the icon from my psued$/ do
brianjaustin marked this conversation as resolved.
Show resolved Hide resolved
visit edit_user_pseud_path(User.current_user, User.current_user.default_pseud)
check("pseud_delete_icon")
step %{I press "Update"}
end

Then /^the "([^"]*)" collection should have an icon$/ do |title|
collection = Collection.find_by(title: title)
assert !collection.icon_file_name.blank?
Expand All @@ -45,3 +51,8 @@
end

### THEN

Then /^I should see the icon and alt text boxes are blank$/ do
brianjaustin marked this conversation as resolved.
Show resolved Hide resolved
expect(find("#pseud_icon").value).to be_blank
expect(find("#pseud_icon_alt_text").value).to be_nil
end
Loading