0
0
Fork 0

Merge pull request 'refs #6863 fix: VnSelect + url, VnLocation' (!194) from 6863-hotFix_vnSelectFilter into test

Reviewed-on: verdnatura/salix-front#194
Reviewed-by: JAVIER SEGARRA MARTINEZ <jsegarra@verdnatura.es>
This commit is contained in:
Alex Moreno 2024-02-19 10:23:53 +00:00
commit 74ba3519fa
3 changed files with 15 additions and 19 deletions

View File

@ -50,7 +50,10 @@ const value = computed({
return $props.modelValue;
},
set(value) {
emit('update:modelValue', value);
emit(
'update:modelValue',
postcodesOptions.value.find((p) => p.code === value)
);
},
});
@ -101,16 +104,11 @@ function handleFetch(data) {
:label="t('Location')"
:placeholder="t('Search by postalcode, town, province or country')"
@input-value="locationFilter"
:default-filter="true"
:default-filter="false"
:input-debounce="300"
:class="{ required: $attrs.required }"
v-bind="$attrs"
emit-value
map-options
use-input
clearable
hide-selected
fill-input
>
<template #form>
<CreateNewPostcode @on-data-saved="locationFilter()" />

View File

@ -111,15 +111,15 @@ async function fetchFilter(val) {
return dataRef.value.fetch({ fields, where, order: sortBy, limit });
}
function filterHandler(val, update) {
async function filterHandler(val, update) {
if (!$props.defaultFilter) return update();
let newOptions;
if ($props.url) {
newOptions = await fetchFilter(val);
} else newOptions = filter(val, myOptionsOriginal.value);
update(
async () => {
if (!$props.defaultFilter) return;
// if ($props.url) {
// myOptions.value = await fetchFilter(val);
// return;
// }
myOptions.value = filter(val, myOptionsOriginal.value);
() => {
myOptions.value = newOptions;
},
(ref) => {
if (val !== '' && ref.options.length > 0) {

View File

@ -1,6 +1,6 @@
/// <reference types="cypress" />
describe('InvoiceInBasicData', () => {
const selects = '.q-form .q-select';
const selects = ':nth-child(1) > :nth-child(1) > .q-field';
const appendBtns = 'label button';
const dialogAppendBtns = '.q-dialog label button';
const dialogInputs = '.q-dialog input';
@ -12,9 +12,7 @@ describe('InvoiceInBasicData', () => {
});
it('should edit the provideer and supplier ref', () => {
cy.get(selects).eq(0).click();
cy.get(selects).eq(0).type('Bros');
cy.get(selects).eq(0).type('{enter}');
cy.selectOption(selects, 'Bros');
cy.get('[title="Reset"]').click();
cy.get(appendBtns).eq(0).click();