Merge pull request 'refactor: refs #8683 enhance sorting logic in VnSelect component' (!1522) from 8683-vnSelectSortByOptionLabel into dev
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
Reviewed-on: #1522 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
a6bd91c918
|
@ -152,6 +152,10 @@ const value = computed({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const computedSortBy = computed(() => {
|
||||||
|
return $props.sortBy || $props.optionLabel + ' ASC';
|
||||||
|
});
|
||||||
|
|
||||||
watch(options, (newValue) => {
|
watch(options, (newValue) => {
|
||||||
setOptions(newValue);
|
setOptions(newValue);
|
||||||
});
|
});
|
||||||
|
@ -186,7 +190,7 @@ function findKeyInOptions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setOptions(data) {
|
function setOptions(data) {
|
||||||
data = dataByOrder(data, $props.sortBy);
|
data = dataByOrder(data, computedSortBy.value);
|
||||||
myOptions.value = JSON.parse(JSON.stringify(data));
|
myOptions.value = JSON.parse(JSON.stringify(data));
|
||||||
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
||||||
emit('update:options', data);
|
emit('update:options', data);
|
||||||
|
@ -216,7 +220,8 @@ function filter(val, options) {
|
||||||
async function fetchFilter(val) {
|
async function fetchFilter(val) {
|
||||||
if (!$props.url) return;
|
if (!$props.url) return;
|
||||||
|
|
||||||
const { fields, include, sortBy, limit } = $props;
|
const { fields, include, limit } = $props;
|
||||||
|
const sortBy = computedSortBy.value;
|
||||||
const key =
|
const key =
|
||||||
optionFilterValue.value ??
|
optionFilterValue.value ??
|
||||||
(new RegExp(/\d/g).test(val)
|
(new RegExp(/\d/g).test(val)
|
||||||
|
|
|
@ -39,11 +39,11 @@ describe('UserPanel', () => {
|
||||||
cy.get(userCompany).should('have.value', 'Warehouse One').click();
|
cy.get(userCompany).should('have.value', 'Warehouse One').click();
|
||||||
|
|
||||||
//Actualizo la opción
|
//Actualizo la opción
|
||||||
cy.getOption(2);
|
cy.getOption(3);
|
||||||
|
|
||||||
//Compruebo la notificación
|
//Compruebo la notificación
|
||||||
cy.get('.q-notification').should('be.visible');
|
cy.get('.q-notification').should('be.visible');
|
||||||
cy.get(userCompany).should('have.value', 'Warehouse Two');
|
cy.get(userCompany).should('have.value', 'TestingWarehouse');
|
||||||
|
|
||||||
//Restauro el valor
|
//Restauro el valor
|
||||||
cy.get(userCompany).click();
|
cy.get(userCompany).click();
|
||||||
|
|
|
@ -20,7 +20,7 @@ describe('VnLog', () => {
|
||||||
it('should filter by entity', () => {
|
it('should filter by entity', () => {
|
||||||
cy.selectOption('.q-drawer--right .q-item > .q-select', 'Claim');
|
cy.selectOption('.q-drawer--right .q-item > .q-select', 'Claim');
|
||||||
cy.get('.q-page').click();
|
cy.get('.q-page').click();
|
||||||
cy.validateContent(chips[0], 'Claim');
|
cy.validateContent(chips[0], 'Beginning');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show claimDescriptor', () => {
|
it('should show claimDescriptor', () => {
|
||||||
|
|
Loading…
Reference in New Issue