diff options
author | Kushal Pandya <kushal@gitlab.com> | 2017-12-15 18:54:37 +0530 |
---|---|---|
committer | Kushal Pandya <kushal@gitlab.com> | 2017-12-15 22:08:04 +0530 |
commit | c796304e82f62fed5417eb91a855b6cf05ce1a10 (patch) | |
tree | f384a7c9ba668c33ff9b803cc9444191b82c657c | |
parent | b11c79122d7060e1d1e859d33fddbe2121f5deb3 (diff) | |
download | gitlab-ce-c796304e82f62fed5417eb91a855b6cf05ce1a10.tar.gz |
Update tests for toggle design change
-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(); |