Commit 4a1a06f4 authored by Fatih Acet's avatar Fatih Acet

Merge branch '26346-cannot-reset-or-remove-mr-issues-description-templates' into 'master'

Resolve "Cannot reset or remove MR/Issues description templates"

Closes #26346

See merge request !8446
parents cd85baf5 ebdea371
......@@ -23,7 +23,7 @@
});
$('.no-template', this.dropdown.parent()).on('click', () => {
this.currentTemplate = '';
this.currentTemplate.content = '';
this.setInputValueToTemplateContent();
$('.dropdown-toggle-text', this.dropdown).text('Choose a template');
});
......
......@@ -27,7 +27,7 @@ feature 'issuable templates', feature: true, js: true do
scenario 'user selects "bug" template' do
select_template 'bug'
wait_for_ajax
preview_template
assert_template
save_changes
end
......@@ -35,8 +35,7 @@ feature 'issuable templates', feature: true, js: true do
select_template 'bug'
wait_for_ajax
select_option 'No template'
wait_for_ajax
preview_template('')
assert_template('')
save_changes('')
end
......@@ -44,9 +43,9 @@ feature 'issuable templates', feature: true, js: true do
select_template 'bug'
wait_for_ajax
find_field('issue_description').send_keys(description_addition)
preview_template(template_content + description_addition)
assert_template(template_content + description_addition)
select_option 'Reset template'
preview_template
assert_template
save_changes
end
......@@ -77,7 +76,7 @@ feature 'issuable templates', feature: true, js: true do
scenario 'user selects "bug" template' do
select_template 'bug'
wait_for_ajax
preview_template("#{template_content}")
assert_template("#{template_content}")
save_changes
end
end
......@@ -95,7 +94,7 @@ feature 'issuable templates', feature: true, js: true do
scenario 'user selects "feature-proposal" template' do
select_template 'feature-proposal'
wait_for_ajax
preview_template
assert_template
save_changes
end
end
......@@ -122,17 +121,15 @@ feature 'issuable templates', feature: true, js: true do
scenario 'user selects template' do
select_template 'feature-proposal'
wait_for_ajax
preview_template
assert_template
save_changes
end
end
end
end
def preview_template(expected_content = template_content)
click_link 'Preview'
expect(page).to have_content expected_content
click_link 'Write'
def assert_template(expected_content = template_content)
expect(find('textarea')['value']).to eq(expected_content)
end
def save_changes(expected_content = template_content)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment