diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-12-15 21:49:11 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-12-15 21:49:11 +0300 |
commit | 24196763567b61e49721241f05cb1380fba1372e (patch) | |
tree | 275e6c683e4221f66c98124ff973169fdd47df6e /spec | |
parent | 627a96875ee68e37b45192af3121f09032ea4bbf (diff) | |
parent | d0edbf6da7ea858a9852be1d4824d055ece0e33f (diff) |
Merge branch '38239-update-toggle-design' into 'master'
Update feature toggle design to use icons and make it i18n friendly
Closes #38239
See merge request gitlab-org/gitlab-ce!15904
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/vue_shared/components/toggle_button_spec.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/javascripts/vue_shared/components/toggle_button_spec.js b/spec/javascripts/vue_shared/components/toggle_button_spec.js index 447d74d4e08..859995d33fa 100644 --- a/spec/javascripts/vue_shared/components/toggle_button_spec.js +++ b/spec/javascripts/vue_shared/components/toggle_button_spec.js @@ -30,9 +30,9 @@ describe('Toggle Button', () => { expect(vm.$el.querySelector('input').getAttribute('value')).toEqual('true'); }); - it('renders Enabled and Disabled text data attributes', () => { - expect(vm.$el.querySelector('button').getAttribute('data-enabled-text')).toEqual('Enabled'); - expect(vm.$el.querySelector('button').getAttribute('data-disabled-text')).toEqual('Disabled'); + it('renders input status icon', () => { + expect(vm.$el.querySelectorAll('span.toggle-icon').length).toEqual(1); + expect(vm.$el.querySelectorAll('svg.s16.toggle-icon-svg').length).toEqual(1); }); }); @@ -49,6 +49,14 @@ describe('Toggle Button', () => { expect(vm.$el.querySelector('button').classList.contains('is-checked')).toEqual(true); }); + it('sets aria-label representing toggle state', () => { + vm.value = true; + expect(vm.ariaLabel).toEqual('Toggle Status: ON'); + + vm.value = false; + expect(vm.ariaLabel).toEqual('Toggle Status: OFF'); + }); + it('emits change event when clicked', () => { vm.$el.querySelector('button').click(); |