0
0
Fork 0

test: #7260 add dataCy

This commit is contained in:
Javier Segarra 2024-12-02 23:02:35 +01:00
parent 4f93d472ac
commit 0ddc8f225c
4 changed files with 17 additions and 25 deletions

View File

@ -85,12 +85,14 @@ const closeForm = () => {
hide-selected
option-label="label"
v-model="selectedField"
data-cy="field-to-edit"
/>
<component
:is="inputs[selectedField?.component || 'input']"
v-bind="selectedField?.attrs || {}"
v-model="newValue"
:label="t('Value')"
data-cy="value-to-edit"
style="width: 200px"
/>
</VnRow>

View File

@ -6,7 +6,6 @@ import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import { toDateHourMin } from 'src/filters';
import { useState } from 'src/composables/useState';
import VnPaginate from 'components/ui/VnPaginate.vue';
import VnUserLink from 'components/ui/VnUserLink.vue';
@ -26,7 +25,6 @@ const $props = defineProps({
});
const { t } = useI18n();
const state = useState();
const quasar = useQuasar();
const newNote = reactive({ text: null, observationTypeFk: null });
const observationTypes = ref([]);

View File

@ -240,31 +240,23 @@ const validations = ({ row }) => {
return isValid;
};
const upsertPrice = async (props, resetMinPrice = false) => {
try {
const isValid = validations({ ...props });
if (!isValid) {
return;
}
const { row } = props;
const changes = tableRef.value.CrudModelRef.getChanges();
if (changes?.updates?.length > 0) {
if (resetMinPrice) row.hasMinPrice = 0;
}
if (!changes.updates && !changes.creates) return;
const data = await upsertFixedPrice(row);
tableRef.value.CrudModelRef.formData[props.rowIndex] = data;
} catch (err) {
console.error('Error editing price', err);
const isValid = validations({ ...props });
if (!isValid) {
return;
}
const { row } = props;
const changes = tableRef.value.CrudModelRef.getChanges();
if (changes?.updates?.length > 0) {
if (resetMinPrice) row.hasMinPrice = 0;
}
if (!changes.updates && !changes.creates) return;
const data = await upsertFixedPrice(row);
tableRef.value.CrudModelRef.formData[props.rowIndex] = data;
};
async function upsertFixedPrice(row) {
try {
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
return data;
} catch (err) {
console.error('Error editing price', err);
}
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
return data;
}
function checkLastVisibleRow() {

View File

@ -46,8 +46,8 @@ describe('Handle Items FixedPrice', () => {
it('Massive edit', function () {
cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
cy.get('#subToolbar > .q-btn--standard').click();
cy.selectOption('.vn-row > :nth-child(2)', 'Min price');
cy.get('.vn-row > :nth-child(3)').type('1');
cy.selectOption("[data-cy='field-to-edit']", 'Min price');
cy.dataCy('value-to-edit').find('input').type('1');
cy.get('.countLines').should('have.text', ' 1 ');
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get('.q-notification__message').should('have.text', 'Data saved');