From 05d84cfe44eebae1cf97a4bf1fe3447f2d282931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Tue, 22 Mar 2022 13:07:13 +0300 Subject: [PATCH] Create ProgressBar.spec.js --- .../progressbar/ProgressBar.spec.js | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/components/progressbar/ProgressBar.spec.js diff --git a/src/components/progressbar/ProgressBar.spec.js b/src/components/progressbar/ProgressBar.spec.js new file mode 100644 index 000000000..6825e07b9 --- /dev/null +++ b/src/components/progressbar/ProgressBar.spec.js @@ -0,0 +1,39 @@ +import { mount } from '@vue/test-utils'; +import ProgressBar from './ProgressBar.vue'; + +describe('ProgressBar.vue', () => { + let wrapper; + + beforeEach(() => { + wrapper = mount(ProgressBar, { + props: { + value: 0 + } + }); + }); + + it('should exist', () => { + expect(wrapper.find('.p-progressbar.p-component').exists()).toBe(true); + expect(wrapper.find('.p-progressbar').attributes()['aria-valuemin']).toBe('0'); + expect(wrapper.find('.p-progressbar').attributes()['aria-valuemax']).toBe('100'); + }); + + it('should value work', async () => { + await wrapper.setProps({ value: 10 }); + + expect(wrapper.find('.p-progressbar').attributes()['aria-valuenow']).toBe('10'); + expect(wrapper.find('.p-progressbar-label').text()).toBe('10%'); + }); + + it('should not show value', async () => { + await wrapper.setProps({ showValue: false }); + + expect(wrapper.find('.p-progressbar-label').exists()).toBe(false); + }); + + it('should be indeterminated', async () => { + await wrapper.setProps({ mode: 'indeterminate'}); + + expect(wrapper.find('.p-progressbar-indeterminate-container').exists()).toBe(true); + }); +}); \ No newline at end of file