diff options
author | Kushal Pandya <kushal@gitlab.com> | 2017-12-15 16:24:37 +0300 |
---|---|---|
committer | Kushal Pandya <kushal@gitlab.com> | 2017-12-15 19:38:04 +0300 |
commit | c796304e82f62fed5417eb91a855b6cf05ce1a10 (patch) | |
tree | f384a7c9ba668c33ff9b803cc9444191b82c657c /spec | |
parent | b11c79122d7060e1d1e859d33fddbe2121f5deb3 (diff) |
Update tests for toggle design change
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(); |