diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-11-28 09:42:24 +0000 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2017-11-28 09:42:24 +0000 |
commit | 6b0f594c00d09a875e3cf8c830ae8cfffaa97b6c (patch) | |
tree | b627a5764fb4b27a00c7b0b651aff75a1fca61db /spec/javascripts/vue_shared | |
parent | 4d89f5207cc8c2235e0e6ac9afa25b0b5689a3cf (diff) | |
parent | 539ea5ebda567e36470f6cec80f5f52d63b76517 (diff) | |
download | gitlab-ce-6b0f594c00d09a875e3cf8c830ae8cfffaa97b6c.tar.gz |
Merge branch 'icon-sizes' into 'master'
limit icon component size to valid values
See merge request gitlab-org/gitlab-ce!15618
Diffstat (limited to 'spec/javascripts/vue_shared')
-rw-r--r-- | spec/javascripts/vue_shared/components/icon_spec.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/spec/javascripts/vue_shared/components/icon_spec.js b/spec/javascripts/vue_shared/components/icon_spec.js index 104da4473ce..a22b6bd3a67 100644 --- a/spec/javascripts/vue_shared/components/icon_spec.js +++ b/spec/javascripts/vue_shared/components/icon_spec.js @@ -11,7 +11,7 @@ describe('Sprite Icon Component', function () { icon = mountComponent(IconComponent, { name: 'test', - size: 99, + size: 32, cssClasses: 'extraclasses', }); }); @@ -34,12 +34,18 @@ describe('Sprite Icon Component', function () { }); it('should properly compute iconSizeClass', function () { - expect(icon.iconSizeClass).toBe('s99'); + expect(icon.iconSizeClass).toBe('s32'); + }); + + it('forbids invalid size prop', () => { + expect(icon.$options.props.size.validator(NaN)).toBeFalsy(); + expect(icon.$options.props.size.validator(0)).toBeFalsy(); + expect(icon.$options.props.size.validator(9001)).toBeFalsy(); }); it('should properly render img css', function () { const classList = icon.$el.classList; - const containsSizeClass = classList.contains('s99'); + const containsSizeClass = classList.contains('s32'); const containsCustomClass = classList.contains('extraclasses'); expect(containsSizeClass).toBe(true); expect(containsCustomClass).toBe(true); |