Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/repository/components/commit_info_spec.js')
-rw-r--r--spec/frontend/repository/components/commit_info_spec.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/spec/frontend/repository/components/commit_info_spec.js b/spec/frontend/repository/components/commit_info_spec.js
index 34e941aa858..4e570346d97 100644
--- a/spec/frontend/repository/components/commit_info_spec.js
+++ b/spec/frontend/repository/components/commit_info_spec.js
@@ -21,9 +21,9 @@ const findAuthorName = () => wrapper.findByText(`${commit.authorName} authored`)
const findCommitRowDescription = () => wrapper.find('pre');
const findTitleHtml = () => wrapper.findByText(commit.titleHtml);
-const createComponent = async ({ commitMock = {} } = {}) => {
+const createComponent = async ({ commitMock = {}, prevBlameLink } = {}) => {
wrapper = shallowMountExtended(CommitInfo, {
- propsData: { commit: { ...commit, ...commitMock } },
+ propsData: { commit: { ...commit, ...commitMock }, prevBlameLink },
});
await nextTick();
@@ -35,6 +35,7 @@ describe('Repository last commit component', () => {
expect(findUserLink().exists()).toBe(true);
expect(findUserAvatarLink().exists()).toBe(true);
+ expect(findUserAvatarLink().props('imgAlt')).toBe("Test authorName's avatar");
});
it('hides author component when author does not exist', () => {
@@ -79,6 +80,22 @@ describe('Repository last commit component', () => {
});
});
+ describe('previous blame link', () => {
+ const prevBlameLink = '<a>Previous blame link</a>';
+
+ it('renders a previous blame link when it is present', () => {
+ createComponent({ prevBlameLink });
+
+ expect(wrapper.html()).toContain(prevBlameLink);
+ });
+
+ it('does not render a previous blame link when it is not present', () => {
+ createComponent({ prevBlameLink: null });
+
+ expect(wrapper.html()).not.toContain(prevBlameLink);
+ });
+ });
+
it('sets correct CSS class if the commit message is empty', () => {
createComponent({ commitMock: { message: '' } });