diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index 6eda03891..32a8db16f 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -152,6 +152,10 @@ const value = computed({ }, }); +const computedSortBy = computed(() => { + return $props.sortBy || $props.optionLabel + ' ASC'; +}); + watch(options, (newValue) => { setOptions(newValue); }); @@ -186,7 +190,7 @@ function findKeyInOptions() { } function setOptions(data) { - data = dataByOrder(data, $props.sortBy); + data = dataByOrder(data, computedSortBy.value); myOptions.value = JSON.parse(JSON.stringify(data)); myOptionsOriginal.value = JSON.parse(JSON.stringify(data)); emit('update:options', data); @@ -216,7 +220,8 @@ function filter(val, options) { async function fetchFilter(val) { if (!$props.url) return; - const { fields, include, sortBy, limit } = $props; + const { fields, include, limit } = $props; + const sortBy = computedSortBy.value; const key = optionFilterValue.value ?? (new RegExp(/\d/g).test(val) diff --git a/test/cypress/integration/vnComponent/UserPanel.spec.js b/test/cypress/integration/vnComponent/UserPanel.spec.js index 25724e873..8722fe37e 100644 --- a/test/cypress/integration/vnComponent/UserPanel.spec.js +++ b/test/cypress/integration/vnComponent/UserPanel.spec.js @@ -39,11 +39,11 @@ describe('UserPanel', () => { cy.get(userCompany).should('have.value', 'Warehouse One').click(); //Actualizo la opciĆ³n - cy.getOption(2); + cy.getOption(3); //Compruebo la notificaciĆ³n 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 cy.get(userCompany).click(); diff --git a/test/cypress/integration/vnComponent/VnLog.spec.js b/test/cypress/integration/vnComponent/VnLog.spec.js index ae0013150..8ca32b681 100644 --- a/test/cypress/integration/vnComponent/VnLog.spec.js +++ b/test/cypress/integration/vnComponent/VnLog.spec.js @@ -20,7 +20,7 @@ describe('VnLog', () => { it('should filter by entity', () => { cy.selectOption('.q-drawer--right .q-item > .q-select', 'Claim'); cy.get('.q-page').click(); - cy.validateContent(chips[0], 'Claim'); + cy.validateContent(chips[0], 'Beginning'); }); it('should show claimDescriptor', () => {