#8647 fix vitest warnings #1467

Merged
jon merged 91 commits from 8647_fix_warnings into dev 2025-04-16 11:18:11 +00:00
3 changed files with 21 additions and 14 deletions
Showing only changes of commit a74e1102ed - Show all commits

View File

@ -99,6 +99,10 @@ const $props = defineProps({
type: Function,
default: () => {},
},
preventSubmit: {
type: Boolean,
default: true,
},
});
const emit = defineEmits(['onFetch', 'onDataSaved']);
const modelValue = computed(
@ -301,7 +305,7 @@ function onBeforeSave(formData, originalData) {
);
}
async function onKeyup(evt) {
if (evt.key === 'Enter' && !('prevent-submit' in attrs)) {
if (evt.key === 'Enter' && !$props.preventSubmit) {
const input = evt.target;
if (input.type == 'textarea' && evt.shiftKey) {
let { selectionStart, selectionEnd } = input;
@ -330,6 +334,7 @@ defineExpose({
<template>
<div class="column items-center full-width">
<QForm
v-on="$attrs"
ref="myForm"
v-if="formData"
@submit.prevent="save"

View File

@ -90,8 +90,10 @@ describe('VnLog', () => {
vm = createWrapper(VnLog, {
global: {
stubs: [],
mocks: {},
stubs: ['FetchData', 'vue-i18n'],
mocks: {
fetch: vi.fn(),
},
},
propsData: {
model: 'Claim',

View File

@ -1,16 +1,16 @@
// This file will be run before each test file, don't delete or vitest will not work.
import { vi } from 'vitest';
let count = 0;
beforeEach(() => {
vi.spyOn(console, 'warn').mockImplementation((message) => {
count++;
console.error('FALLO: ', message);
// throw new Error(`Test failed due to console.warn: ${message}`);
});
});
import { config } from '@vue/test-utils';
// afterEach(() => {
// vi.restoreAllMocks();
// beforeEach(() => {
// vi.spyOn(console, 'warn').mockImplementation((message) => {
// console.log('WARNING: ', message);
// throw new Error(`Test failed due to console.warn: ${message}`);
// });
// vi.spyOn(console, 'error').mockImplementation((message) => {
// console.log('FALLO: ', message);
// throw new Error(`Test failed due to console.warn: ${message}`);
// });
// });
vi.mock('axios');