#8647 fix vitest warnings #1467
|
@ -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"
|
||||
|
|
|
@ -90,8 +90,10 @@ describe('VnLog', () => {
|
|||
|
||||
vm = createWrapper(VnLog, {
|
||||
global: {
|
||||
stubs: [],
|
||||
mocks: {},
|
||||
stubs: ['FetchData', 'vue-i18n'],
|
||||
mocks: {
|
||||
fetch: vi.fn(),
|
||||
},
|
||||
},
|
||||
propsData: {
|
||||
model: 'Claim',
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue