| 12345678910111213141516171819202122232425262728293031 |
- import {createStore, initLocalVue, mountComposition} from '~/tests/unit/Helpers'
- import { form } from '~/tests/unit/fixture/state/profile'
- import {useForm} from "~/composables/form/useForm";
- import { AnyStore } from '~/types/interfaces'
- let store: AnyStore
- let useFormMount:any
- beforeAll(() => {
- store = createStore()
- store.registerModule('form', form)
- initLocalVue({store: store})
- const component = mountComposition(() => {
- useFormMount = useForm(store)
- });
- })
- describe('markFormAsDirty()', () => {
- it('should commit the form state dirty to true', async () => {
- useFormMount.markAsDirty()
- expect(store.state.form.dirty).toBeTruthy()
- })
- })
- describe('markAsNotDirty()', () => {
- it('should commit the form state dirty to false', async () => {
- useFormMount.markAsNotDirty()
- expect(store.state.form.dirty).toBeFalsy()
- })
- })
|