mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 14:38:17 +08:00
FIX: Customize form template view modal footer buttons (#25804)
This commit is contained in:
parent
867c2989d7
commit
3b87a174e7
|
@ -18,17 +18,20 @@ export default class CustomizeFormTemplateViewModal extends Component {
|
|||
|
||||
@action
|
||||
editTemplate() {
|
||||
this.router.transitionTo("adminCustomizeFormTemplates.edit", this.model);
|
||||
this.router.transitionTo(
|
||||
"adminCustomizeFormTemplates.edit",
|
||||
this.args.model
|
||||
);
|
||||
}
|
||||
|
||||
@action
|
||||
deleteTemplate() {
|
||||
return this.dialog.yesNoConfirm({
|
||||
message: I18n.t("admin.form_templates.delete_confirm", {
|
||||
template_name: this.model.name,
|
||||
template_name: this.args.model.name,
|
||||
}),
|
||||
didConfirm: () => {
|
||||
ajax(`/admin/customize/form-templates/${this.model.id}.json`, {
|
||||
ajax(`/admin/customize/form-templates/${this.args.model.id}.json`, {
|
||||
type: "DELETE",
|
||||
})
|
||||
.then(() => {
|
||||
|
|
|
@ -44,6 +44,25 @@ describe "Admin Customize Form Templates", type: :system do
|
|||
form_template_page.click_toggle_preview
|
||||
expect(form_template_page).to have_input_field("input")
|
||||
end
|
||||
|
||||
context "when using the view template modal" do
|
||||
it "should navigate to the edit page when clicking the edit button" do
|
||||
form_template_page.visit
|
||||
form_template_page.click_view_form_template
|
||||
form_template_page.find(".d-modal__footer .btn-primary").click
|
||||
expect(page).to have_current_path("/admin/customize/form-templates/#{form_template.id}")
|
||||
end
|
||||
|
||||
it "should delete the form template when clicking the delete button" do
|
||||
form_template_page.visit
|
||||
original_template_name = form_template.name
|
||||
form_template_page.click_view_form_template
|
||||
form_template_page.find(".d-modal__footer .btn-danger").click
|
||||
form_template_page.find(".dialog-footer .btn-primary").click
|
||||
|
||||
expect(form_template_page).to have_no_form_template(original_template_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "when visiting the page to edit a form template" do
|
||||
|
|
|
@ -31,6 +31,10 @@ module PageObjects
|
|||
find(".form-templates__table tbody tr td", text: name).present?
|
||||
end
|
||||
|
||||
def has_no_form_template?(name)
|
||||
has_no_css?(".form-templates__table tbody tr td", text: name)
|
||||
end
|
||||
|
||||
def has_category_in_template_row?(category_name)
|
||||
find(
|
||||
".form-templates__table .categories .badge-category__name",
|
||||
|
|
Loading…
Reference in New Issue
Block a user