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> </label>
</div> </div>
<div class="watched-word-input"> {{#if this.canReplace}}
<label for="watched-html">{{i18n <div class="watched-word-input">
"admin.watched_words.form.html_label" <label for="watched-html">{{i18n
}}</label> "admin.watched_words.form.html_label"
<label class="html-checkbox checkbox-label"> }}</label>
<Input <label class="html-checkbox checkbox-label">
@type="checkbox" <Input
@checked={{this.isHtml}} @type="checkbox"
disabled={{this.formSubmitted}} @checked={{this.isHtml}}
/> disabled={{this.formSubmitted}}
{{i18n "admin.watched_words.form.html_description"}} />
</label> {{i18n "admin.watched_words.form.html_description"}}
</div> </label>
</div>
{{/if}}
<DButton <DButton
@action={{this.submitForm}} @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)") expect(ww_page).to have_error("Word is too long (maximum is 100 characters)")
end 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 end

View File

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