diff options
author | Phil Hughes <me@iamphill.com> | 2017-10-17 16:19:41 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-10-17 16:19:41 +0000 |
commit | 701fa3bddd14ffa03dae91849fb094bb3483ed35 (patch) | |
tree | 7b181dd3e382af9147ea098c632ba3645bd992af | |
parent | 89f5ede2a337f0957dd3f1451efb011781212f33 (diff) | |
parent | 22a120a24d2523b5fca91b5fe08a57a7be75d72e (diff) | |
download | gitlab-ce-701fa3bddd14ffa03dae91849fb094bb3483ed35.tar.gz |
Merge branch 'improve-sprite-icon-spec' into 'master'
Improve sprite icon spec
Closes #39199
See merge request gitlab-org/gitlab-ce!14914
-rw-r--r-- | spec/javascripts/lib/utils/common_utils_spec.js | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/spec/javascripts/lib/utils/common_utils_spec.js b/spec/javascripts/lib/utils/common_utils_spec.js index 6613b7dee6b..a5298be5669 100644 --- a/spec/javascripts/lib/utils/common_utils_spec.js +++ b/spec/javascripts/lib/utils/common_utils_spec.js @@ -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>'); }); }); }); |