提交 701fa3bd 编写于 作者: P Phil Hughes

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

Improve sprite icon spec

Closes #39199

See merge request gitlab-org/gitlab-ce!14914
...@@ -467,19 +467,27 @@ describe('common_utils', () => { ...@@ -467,19 +467,27 @@ describe('common_utils', () => {
commonUtils.ajaxPost(requestURL, data); commonUtils.ajaxPost(requestURL, data);
expect(ajaxSpy.calls.allArgs()[0][0].type).toEqual('POST'); expect(ajaxSpy.calls.allArgs()[0][0].type).toEqual('POST');
}); });
});
describe('gl.utils.spriteIcon', () => { describe('spriteIcon', () => {
beforeEach(() => { let beforeGon;
window.gon.sprite_icons = 'icons.svg';
});
it('should return the svg for a linked icon', () => { beforeEach(() => {
expect(gl.utils.spriteIcon('test')).toEqual('<svg ><use xlink:href="icons.svg#test" /></svg>'); window.gon = window.gon || {};
}); beforeGon = Object.assign({}, window.gon);
window.gon.sprite_icons = 'icons.svg';
});
it('should set svg className when passed', () => { afterEach(() => {
expect(gl.utils.spriteIcon('test', 'fa fa-test')).toEqual('<svg class="fa fa-test"><use xlink:href="icons.svg#test" /></svg>'); 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册