Commit 4e2b96d6 authored by Filipa Lacerda's avatar Filipa Lacerda

Updates test to check svg for commit icon is being rendered

parent a8fb4865
...@@ -66,7 +66,7 @@ describe('Commit component', () => { ...@@ -66,7 +66,7 @@ describe('Commit component', () => {
it('should render a link to the ref url', () => { it('should render a link to the ref url', () => {
expect(component.$el.querySelector('.ref-name').getAttribute('href')).toEqual( expect(component.$el.querySelector('.ref-name').getAttribute('href')).toEqual(
props.commitRef.ref_url, props.commitRef.ref_url
); );
}); });
...@@ -76,15 +76,21 @@ describe('Commit component', () => { ...@@ -76,15 +76,21 @@ describe('Commit component', () => {
it('should render the commit short sha with a link to the commit url', () => { it('should render the commit short sha with a link to the commit url', () => {
expect(component.$el.querySelector('.commit-sha').getAttribute('href')).toEqual( expect(component.$el.querySelector('.commit-sha').getAttribute('href')).toEqual(
props.commitUrl, props.commitUrl
); );
expect(component.$el.querySelector('.commit-sha').textContent).toContain(props.shortSha); expect(component.$el.querySelector('.commit-sha').textContent).toContain(props.shortSha);
}); });
it('should render icon for commit', () => {
expect(
component.$el.querySelector('.js-commit-icon use').getAttribute('xlink:href')
).toContain('commit');
});
describe('Given commit title and author props', () => { describe('Given commit title and author props', () => {
it('should render a link to the author profile', () => { it('should render a link to the author profile', () => {
expect( expect(
component.$el.querySelector('.commit-title .avatar-image-container').getAttribute('href'), component.$el.querySelector('.commit-title .avatar-image-container').getAttribute('href')
).toEqual(props.author.path); ).toEqual(props.author.path);
}); });
...@@ -92,22 +98,22 @@ describe('Commit component', () => { ...@@ -92,22 +98,22 @@ describe('Commit component', () => {
expect( expect(
component.$el component.$el
.querySelector('.commit-title .avatar-image-container img') .querySelector('.commit-title .avatar-image-container img')
.getAttribute('data-original-title'), .getAttribute('data-original-title')
).toContain(props.author.username); ).toContain(props.author.username);
expect( expect(
component.$el component.$el
.querySelector('.commit-title .avatar-image-container img') .querySelector('.commit-title .avatar-image-container img')
.getAttribute('alt'), .getAttribute('alt')
).toContain(`${props.author.username}'s avatar`); ).toContain(`${props.author.username}'s avatar`);
}); });
}); });
it('should render the commit title', () => { it('should render the commit title', () => {
expect(component.$el.querySelector('a.commit-row-message').getAttribute('href')).toEqual( expect(component.$el.querySelector('a.commit-row-message').getAttribute('href')).toEqual(
props.commitUrl, props.commitUrl
); );
expect(component.$el.querySelector('a.commit-row-message').textContent).toContain( expect(component.$el.querySelector('a.commit-row-message').textContent).toContain(
props.title, props.title
); );
}); });
}); });
...@@ -130,7 +136,7 @@ describe('Commit component', () => { ...@@ -130,7 +136,7 @@ describe('Commit component', () => {
component = mountComponent(CommitComponent, props); component = mountComponent(CommitComponent, props);
expect(component.$el.querySelector('.commit-title span').textContent).toContain( expect(component.$el.querySelector('.commit-title span').textContent).toContain(
"Can't find HEAD commit for this branch", "Can't find HEAD commit for this branch"
); );
}); });
}); });
......
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