UX: limit "outputs HTML" watched word option to replacements (#28063)

We were displaying the "outputs HTML" option in all watched word actions, while it's only supposed to be used in the Replace action.
This commit is contained in:
Renato Atilio 2024-07-25 16:25:56 -03:00 committed by GitHub
parent 3195d692a1
commit 75e4b8f330
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 15 deletions

View File

@ -75,19 +75,21 @@
</label>
</div>
<div class="watched-word-input">
<label for="watched-html">{{i18n
"admin.watched_words.form.html_label"
}}</label>
<label class="html-checkbox checkbox-label">
<Input
@type="checkbox"
@checked={{this.isHtml}}
disabled={{this.formSubmitted}}
/>
{{i18n "admin.watched_words.form.html_description"}}
</label>
</div>
{{#if this.canReplace}}
<div class="watched-word-input">
<label for="watched-html">{{i18n
"admin.watched_words.form.html_label"
}}</label>
<label class="html-checkbox checkbox-label">
<Input
@type="checkbox"
@checked={{this.isHtml}}
disabled={{this.formSubmitted}}
/>
{{i18n "admin.watched_words.form.html_description"}}
</label>
</div>
{{/if}}
<DButton
@action={{this.submitForm}}

View File

@ -24,4 +24,12 @@ describe "Admin Watched Words", type: :system, js: true do
expect(ww_page).to have_error("Word is too long (maximum is 100 characters)")
end
it "shows the 'outputs HTML' option when action=replace" do
ww_page.visit
expect(ww_page).not_to have_text(I18n.t("admin_js.admin.watched_words.form.html_description"))
ww_page.visit(action: "replace")
expect(ww_page).to have_text(I18n.t("admin_js.admin.watched_words.form.html_description"))
end
end

View File

@ -3,8 +3,8 @@
module PageObjects
module Pages
class AdminWatchedWords < PageObjects::Pages::Base
def visit
page.visit "admin/customize/watched_words"
def visit(action: "block")
page.visit "admin/customize/watched_words/action/#{action}"
self
end