-
-
- {{ __('Add new comment template') }}
-
-
+
+
+
+
+ {{ __('My comment templates') }}
+
+
+
+ {{ count }}
+
+
+
+ {{ __('Add new') }}
+
+
+
+
{{ __('Add new comment template') }}
+
+
-
+
+ {{ __('You have no saved replies yet.') }}
+
+
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 96fb9d44511d2f5f522f380f87df4b177b8c4240..b57256e51c519c8affcd75b1eeecf43961028942 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -2866,6 +2866,9 @@ msgstr ""
msgid "Add list"
msgstr ""
+msgid "Add new"
+msgstr ""
+
msgid "Add new application"
msgstr ""
@@ -30110,7 +30113,7 @@ msgstr ""
msgid "My awesome group"
msgstr ""
-msgid "My comment templates (%{count})"
+msgid "My comment templates"
msgstr ""
msgid "My company or team"
@@ -53595,6 +53598,9 @@ msgstr ""
msgid "You have no permissions"
msgstr ""
+msgid "You have no saved replies yet."
+msgstr ""
+
msgid "You have not added any approvers. Start by adding users or groups."
msgstr ""
diff --git a/spec/features/profiles/list_users_comment_template_spec.rb b/spec/features/profiles/list_users_comment_template_spec.rb
index 85e455ba98810dbb02b387cd0efbe95df7cbd568..b2faee3ae045eb0c3541c9c29662e42e6ba778f3 100644
--- a/spec/features/profiles/list_users_comment_template_spec.rb
+++ b/spec/features/profiles/list_users_comment_template_spec.rb
@@ -14,7 +14,7 @@
it 'shows the user a list of their comment templates' do
visit profile_comment_templates_path
- expect(page).to have_content('My comment templates (1)')
+ expect(page).to have_content('My comment templates')
expect(page).to have_content(saved_reply.name)
expect(page).to have_content(saved_reply.content)
end
diff --git a/spec/features/profiles/user_creates_comment_template_spec.rb b/spec/features/profiles/user_creates_comment_template_spec.rb
index 44e2b932c008f872a4869c4c54e99ac8b9d93954..dcaf47088b02d4fa4b4dae5ce3562b6efc640996 100644
--- a/spec/features/profiles/user_creates_comment_template_spec.rb
+++ b/spec/features/profiles/user_creates_comment_template_spec.rb
@@ -15,6 +15,7 @@
end
it 'shows the user a list of their saved replies' do
+ click_button 'Add new'
find('[data-testid="comment-template-name-input"]').set('test')
find('[data-testid="comment-template-content-input"]').set('Test content')
@@ -22,7 +23,7 @@
wait_for_requests
- expect(page).to have_content('My comment templates (1)')
+ expect(page).to have_content('My comment templates')
expect(page).to have_content('test')
expect(page).to have_content('Test content')
end
diff --git a/spec/frontend/comment_templates/components/__snapshots__/list_item_spec.js.snap b/spec/frontend/comment_templates/components/__snapshots__/list_item_spec.js.snap
index d0bc7a55f8e1887b5f7c868e97c5bbf0a7bc16b4..c5704d6866031b10dbdf44e2849eb09d5e035b8b 100644
--- a/spec/frontend/comment_templates/components/__snapshots__/list_item_spec.js.snap
+++ b/spec/frontend/comment_templates/components/__snapshots__/list_item_spec.js.snap
@@ -2,10 +2,10 @@
exports[`Comment templates list item component renders list item 1`] = `
+
/assign_reviewer
+
diff --git a/spec/frontend/comment_templates/components/list_spec.js b/spec/frontend/comment_templates/components/list_spec.js
index 8b0daf2fe2f5135b5d6798291205571f8301f328..8973857c33855b25cedadf1b04f98a4efad94cf1 100644
--- a/spec/frontend/comment_templates/components/list_spec.js
+++ b/spec/frontend/comment_templates/components/list_spec.js
@@ -25,12 +25,6 @@ describe('Comment templates list component', () => {
expect(wrapper.findAllComponents(ListItem).length).toBe(0);
});
- it('render comment templates count', () => {
- wrapper = createComponent(savedRepliesResponse);
-
- expect(wrapper.find('[data-testid="title"]').text()).toEqual('My comment templates (2)');
- });
-
it('renders list of comment templates', () => {
const savedReplies = savedRepliesResponse.data.currentUser.savedReplies.nodes;
wrapper = createComponent(savedRepliesResponse);
diff --git a/spec/frontend/comment_templates/pages/index_spec.js b/spec/frontend/comment_templates/pages/index_spec.js
index 6dbec3ef4a450c09b42464bb0462e4cde458185e..fa195ec8281aeb8727613f045ad2545b10ae8df4 100644
--- a/spec/frontend/comment_templates/pages/index_spec.js
+++ b/spec/frontend/comment_templates/pages/index_spec.js
@@ -42,4 +42,13 @@ describe('Comment templates index page component', () => {
expect.objectContaining(savedReplies[1]),
);
});
+
+ it('render comment templates count', async () => {
+ const mockApollo = createMockApolloProvider(savedRepliesResponse);
+ wrapper = createComponent({ mockApollo });
+
+ await waitForPromises();
+
+ expect(wrapper.find('[data-testid="title"]').text()).toContain('2');
+ });
});