UNPKG

quasar

Version:

Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time

48 lines (34 loc) 1.32 kB
import { mount, flushPromises } from '@vue/test-utils' import { describe, test, expect } from 'vitest' import QSpinnerPuff from './QSpinnerPuff.js' describe('[QSpinnerPuff API]', () => { describe('[Props]', () => { describe('[(prop)size]', () => { test.each([ ['String', '100px'], ['Number', 100] ])('type %s has effect', async (_, propVal) => { const expectedValue = String(propVal) const wrapper = mount(QSpinnerPuff) const target = wrapper.get('.q-spinner') expect(target.attributes('width')).not.toBe(expectedValue) expect(target.attributes('height')).not.toBe(expectedValue) await wrapper.setProps({ size: propVal }) await flushPromises() expect(target.attributes('width')).toBe(expectedValue) expect(target.attributes('height')).toBe(expectedValue) }) }) describe('[(prop)color]', () => { test('type String has effect', async () => { const propVal = 'red' const wrapper = mount(QSpinnerPuff) const target = wrapper.get('.q-spinner') expect(target.classes()).not.toContain('text-red') await wrapper.setProps({ color: propVal }) await flushPromises() expect(target.classes()).toContain('text-red') }) }) }) })