Commit 701fa3bd authored by Phil Hughes's avatar Phil Hughes

Merge branch 'improve-sprite-icon-spec' into 'master'

Improve sprite icon spec

Closes #39199

See merge request gitlab-org/gitlab-ce!14914
parents 89f5ede2 22a120a2
......@@ -467,19 +467,27 @@ describe('common_utils', () => {
commonUtils.ajaxPost(requestURL, data);
expect(ajaxSpy.calls.allArgs()[0][0].type).toEqual('POST');
});
});
describe('gl.utils.spriteIcon', () => {
beforeEach(() => {
window.gon.sprite_icons = 'icons.svg';
});
describe('spriteIcon', () => {
let beforeGon;
it('should return the svg for a linked icon', () => {
expect(gl.utils.spriteIcon('test')).toEqual('<svg ><use xlink:href="icons.svg#test" /></svg>');
});
beforeEach(() => {
window.gon = window.gon || {};
beforeGon = Object.assign({}, window.gon);
window.gon.sprite_icons = 'icons.svg';
});
it('should set svg className when passed', () => {
expect(gl.utils.spriteIcon('test', 'fa fa-test')).toEqual('<svg class="fa fa-test"><use xlink:href="icons.svg#test" /></svg>');
});
afterEach(() => {
window.gon = beforeGon;
});
it('should return the svg for a linked icon', () => {
expect(commonUtils.spriteIcon('test')).toEqual('<svg ><use xlink:href="icons.svg#test" /></svg>');
});
it('should set svg className when passed', () => {
expect(commonUtils.spriteIcon('test', 'fa fa-test')).toEqual('<svg class="fa fa-test"><use xlink:href="icons.svg#test" /></svg>');
});
});
});
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