diff --git a/CHANGELOG.md b/CHANGELOG.md
index d15ad787d..9f493764a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [2416.01] - 2024-04-18
+
+### Added
+
+### Fixed
+
+- (General) => Se vuelven a mostrar los parámetros en la url al aplicar un filtro
+
## [2414.01] - 2024-04-04
### Added
diff --git a/cypress.config.js b/cypress.config.js
index 1934f833e..e2046d6c4 100644
--- a/cypress.config.js
+++ b/cypress.config.js
@@ -3,6 +3,7 @@ const { defineConfig } = require('cypress');
module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:9000/',
+ experimentalStudio: true,
fixturesFolder: 'test/cypress/fixtures',
screenshotsFolder: 'test/cypress/screenshots',
supportFile: 'test/cypress/support/index.js',
diff --git a/package.json b/package.json
index a35020b66..82f21efe6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "salix-front",
- "version": "24.14.0",
+ "version": "24.16.0",
"description": "Salix frontend",
"productName": "Salix",
"author": "Verdnatura",
diff --git a/src/components/CreateNewPostcodeForm.vue b/src/components/CreateNewPostcodeForm.vue
index 47836c05b..02e84849c 100644
--- a/src/components/CreateNewPostcodeForm.vue
+++ b/src/components/CreateNewPostcodeForm.vue
@@ -28,8 +28,23 @@ const countriesOptions = ref([]);
const provincesOptions = ref([]);
const townsLocationOptions = ref([]);
-const onDataSaved = (dataSaved) => {
- emit('onDataSaved', dataSaved);
+const onDataSaved = (formData) => {
+ const newPostcode = {
+ ...formData
+ };
+ const townObject = townsLocationOptions.value.find(
+ ({id}) => id === formData.townFk
+ );
+ newPostcode.town = townObject?.name;
+ const provinceObject = provincesOptions.value.find(
+ ({id}) => id === formData.provinceFk
+ );
+ newPostcode.province = provinceObject?.name;
+ const countryObject = countriesOptions.value.find(
+ ({id}) => id === formData.countryFk
+ );
+ newPostcode.country = countryObject?.country;
+ emit('onDataSaved', newPostcode);
};
const onCityCreated = async ({ name, provinceFk }, formData) => {
@@ -73,7 +88,7 @@ const onProvinceCreated = async ({ name }, formData) => {
:title="t('New postcode')"
:subtitle="t('Please, ensure you put the correct data!')"
:form-initial-data="postcodeFormData"
- @on-data-saved="onDataSaved($event)"
+ @on-data-saved="onDataSaved"
>
diff --git a/src/components/FetchData.vue b/src/components/FetchData.vue
index 6d4e79f24..1fdd9a5f5 100644
--- a/src/components/FetchData.vue
+++ b/src/components/FetchData.vue
@@ -1,5 +1,5 @@
@@ -284,6 +285,9 @@ defineExpose({
/>
diff --git a/src/components/ui/CardSummary.vue b/src/components/ui/CardSummary.vue
index cdf19d492..1e1480293 100644
--- a/src/components/ui/CardSummary.vue
+++ b/src/components/ui/CardSummary.vue
@@ -74,7 +74,7 @@ async function fetch() {
-
+
@@ -97,7 +97,6 @@ async function fetch() {
.cardSummary {
width: 100%;
-
.summaryHeader {
text-align: center;
font-size: 20px;
@@ -132,6 +131,7 @@ async function fetch() {
padding: 7px;
font-size: 16px;
min-width: 275px;
+ box-shadow: none;
.vn-label-value {
display: flex;
diff --git a/src/components/ui/VnLinkPhone.vue b/src/components/ui/VnLinkPhone.vue
index 4445b99c9..b04ab3e5b 100644
--- a/src/components/ui/VnLinkPhone.vue
+++ b/src/components/ui/VnLinkPhone.vue
@@ -15,7 +15,6 @@ const { t } = useI18n();
color="primary"
padding="none"
:href="`sip:${props.phoneNumber}`"
- :title="t('globals.microsip')"
@click.stop
/>
diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue
index d1b2f5ccb..9c110d282 100644
--- a/src/components/ui/VnPaginate.vue
+++ b/src/components/ui/VnPaginate.vue
@@ -78,6 +78,7 @@ const arrayData = useArrayData(props.dataKey, {
userParams: props.userParams,
exprBuilder: props.exprBuilder,
});
+const hasMoreData = ref();
const store = arrayData.store;
onMounted(() => {
@@ -106,11 +107,10 @@ async function paginate() {
isLoading.value = true;
await arrayData.loadMore();
-
if (!arrayData.hasMoreData.value) {
if (store.userParamsChanged) arrayData.hasMoreData.value = true;
store.userParamsChanged = false;
- isLoading.value = false;
+ endPagination();
return;
}
@@ -120,12 +120,15 @@ async function paginate() {
pagination.value.sortBy = sortBy;
pagination.value.descending = descending;
- isLoading.value = false;
+ endPagination();
+}
+function endPagination() {
+ hasMoreData.value = arrayData.hasMoreData.value;
+ isLoading.value = false;
emit('onFetch', store.data);
emit('onPaginate');
}
-
async function onLoad(index, done) {
if (!store.data) {
return done();
@@ -188,6 +191,9 @@ async function onLoad(index, done) {
+
+
+
es:
diff --git a/src/pages/InvoiceIn/InvoiceInFilter.vue b/src/pages/InvoiceIn/InvoiceInFilter.vue
index 8f8213f1c..0e53fbed7 100644
--- a/src/pages/InvoiceIn/InvoiceInFilter.vue
+++ b/src/pages/InvoiceIn/InvoiceInFilter.vue
@@ -29,6 +29,7 @@ const suppliersRef = ref();
order="nickname"
limit="30"
@on-fetch="(data) => (suppliers = data)"
+ auto-load
/>
@@ -38,46 +39,6 @@ const suppliersRef = ref();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-import { onMounted, ref, computed, onUpdated } from 'vue';
+import { ref, computed, onUpdated } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue';
-import { getUrl } from 'src/composables/getUrl';
import { useRole } from 'src/composables/useRole';
import { dashIfEmpty } from 'src/filters';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
@@ -28,12 +27,6 @@ const entityId = computed(() => $props.id || route.params.id);
const summaryRef = ref();
const supplier = ref();
-const supplierUrl = ref();
-
-onMounted(async () => {
- await roleState.fetch();
- supplierUrl.value = (await getUrl('supplier/')) + entityId.value;
-});
async function setData(data) {
if (data) {
@@ -44,6 +37,10 @@ async function setData(data) {
const isAdministrative = computed(() => {
return roleState.hasAny(['administrative']);
});
+
+function getUrl(section) {
+ return isAdministrative.value && `#/supplier/${entityId.value}/${section}`;
+}
@@ -58,15 +55,10 @@ const isAdministrative = computed(() => {
-
- {{ t('globals.summary.basicData') }}
+
@@ -94,15 +86,10 @@ const isAdministrative = computed(() => {
/>
-
- {{ t('supplier.summary.billingData') }}
+
{
-
- {{ t('supplier.summary.fiscalData') }}
+
{
/>
-
- {{ t('supplier.summary.fiscalAddress') }}
+
diff --git a/src/pages/Worker/Card/WorkerBasicData.vue b/src/pages/Worker/Card/WorkerBasicData.vue
new file mode 100644
index 000000000..c59f4281d
--- /dev/null
+++ b/src/pages/Worker/Card/WorkerBasicData.vue
@@ -0,0 +1,168 @@
+
+
+
+ (workersOptions = data)"
+ auto-load
+ url="Workers/search"
+ />
+ (countriesOptions = data)"
+ auto-load
+ url="Countries"
+ />
+ (educationLevelsOptions = data)"
+ auto-load
+ url="EducationLevels"
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ scope.opt?.name }}
+
+ {{ scope.opt?.nickname }},
+ {{ scope.opt?.code }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+es:
+ Name: Nombre
+ Last name: Apellidos
+ Business phone: Teléfono de empresa
+ Mobile extension: Extensión móvil
+ Boss: Jefe
+ Marital status: Estado civil
+ Married: Casado/a
+ Single: Soltero/a
+ Origin country: País origen
+ Education level: Nivel educación
+ SSN: NSS
+ Locker: Taquilla
+
diff --git a/src/pages/Worker/Card/WorkerDescriptor.vue b/src/pages/Worker/Card/WorkerDescriptor.vue
index 5144b3bfa..a20ad5546 100644
--- a/src/pages/Worker/Card/WorkerDescriptor.vue
+++ b/src/pages/Worker/Card/WorkerDescriptor.vue
@@ -1,5 +1,5 @@
+
+
+
diff --git a/src/pages/Worker/Card/WorkerNotes.vue b/src/pages/Worker/Card/WorkerNotes.vue
new file mode 100644
index 000000000..6c74aefa0
--- /dev/null
+++ b/src/pages/Worker/Card/WorkerNotes.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
diff --git a/src/pages/Worker/Card/WorkerPBX.vue b/src/pages/Worker/Card/WorkerPBX.vue
new file mode 100644
index 000000000..681194061
--- /dev/null
+++ b/src/pages/Worker/Card/WorkerPBX.vue
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/router/modules/worker.js b/src/router/modules/worker.js
index 448aab79c..4af2eea50 100644
--- a/src/router/modules/worker.js
+++ b/src/router/modules/worker.js
@@ -12,7 +12,15 @@ export default {
redirect: { name: 'WorkerMain' },
menus: {
main: ['WorkerList', 'WorkerDepartment'],
- card: ['WorkerNotificationsManager', 'WorkerPda', 'WorkerLog'],
+ card: [
+ 'WorkerBasicData',
+ 'WorkerNotes',
+ 'WorkerPda',
+ 'WorkerNotificationsManager',
+ 'WorkerPBX',
+ 'WorkerLog',
+ 'WorkerDms',
+ ],
departmentCard: ['BasicData'],
},
children: [
@@ -66,6 +74,41 @@ export default {
},
component: () => import('src/pages/Worker/Card/WorkerSummary.vue'),
},
+ {
+ path: 'basic-data',
+ name: 'WorkerBasicData',
+ meta: {
+ title: 'basicData',
+ icon: 'vn:settings',
+ },
+ component: () => import('src/pages/Worker/Card/WorkerBasicData.vue'),
+ },
+ {
+ path: 'notes',
+ name: 'NotesCard',
+ redirect: { name: 'WorkerNotes' },
+ children: [
+ {
+ path: '',
+ name: 'WorkerNotes',
+ meta: {
+ title: 'notes',
+ icon: 'vn:notes',
+ },
+ component: () =>
+ import('src/pages/Worker/Card/WorkerNotes.vue'),
+ },
+ ],
+ },
+ {
+ name: 'WorkerPda',
+ path: 'pda',
+ meta: {
+ title: 'pda',
+ icon: 'phone_android',
+ },
+ component: () => import('src/pages/Worker/Card/WorkerPda.vue'),
+ },
{
name: 'WorkerNotificationsManager',
path: 'notifications',
@@ -77,13 +120,22 @@ export default {
import('src/pages/Worker/Card/WorkerNotificationsManager.vue'),
},
{
- name: 'WorkerPda',
- path: 'pda',
+ path: 'pbx',
+ name: 'WorkerPBX',
meta: {
- title: 'pda',
- icon: 'phone_android',
+ title: 'pbx',
+ icon: 'vn:pbx',
},
- component: () => import('src/pages/Worker/Card/WorkerPda.vue'),
+ component: () => import('src/pages/Worker/Card/WorkerPBX.vue'),
+ },
+ {
+ name: 'WorkerDms',
+ path: 'dms',
+ meta: {
+ title: 'dms',
+ icon: 'cloud_upload',
+ },
+ component: () => import('src/pages/Worker/Card/WorkerDms.vue'),
},
{
name: 'WorkerLog',
diff --git a/test/cypress/integration/VnLocation.spec.js b/test/cypress/integration/VnLocation.spec.js
index 5892e3ad5..3a90afce9 100644
--- a/test/cypress/integration/VnLocation.spec.js
+++ b/test/cypress/integration/VnLocation.spec.js
@@ -8,41 +8,41 @@ describe('VnLocation', () => {
cy.visit('/#/worker/create');
cy.waitForElement('.q-card');
});
-
- it('Show all options', function() {
- cy.get(inputLocation).click();
- cy.get(locationOptions).should('have.length',5);
+ it('Show all options', function() {
+ cy.get(inputLocation).click();
+ cy.get(locationOptions).should('have.length.at.least',5);
});
-
- it('input filter location as "al"', function() {
+ it('input filter location as "al"', function() {
cy.get(inputLocation).click();
cy.get(inputLocation).clear();
cy.get(inputLocation).type('al');
- cy.get(locationOptions).should('have.length',3);
+ cy.get(locationOptions).should('have.length.at.least',3);
});
it('input filter location as "ecuador"', function() {
cy.get(inputLocation).click();
cy.get(inputLocation).clear();
cy.get(inputLocation).type('ecuador');
- cy.get(locationOptions).should('have.length',1);
+ cy.get(locationOptions).should('have.length.at.least',1);
cy.get(`${locationOptions}:nth-child(1)`).click();
cy.get(':nth-child(3) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .q-icon').click();
-
});
});
describe('Fiscal-data',()=>{
- const inputLocation = ':nth-child(6) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control';
-
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/supplier/567/fiscal-data', {timeout: 2000});
cy.waitForElement('.q-card');
});
-
- it('Show locations options', function() {
- cy.get(inputLocation).click();
- cy.get(locationOptions).should('have.length', 5);
+ it('Create postCode', function() {
+ cy.get(':nth-child(6) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(3) > .q-icon').click();
+ cy.get(' .q-card > h1').should('have.text', 'New postcode');
+ cy.get('.q-card > :nth-child(4) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(1) > input').clear('12');
+ cy.get('.q-card > :nth-child(4) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(1) > input').type('1234453');
+ cy.selectOption('.q-dialog__inner > .column > #formModel > .q-card > :nth-child(4) > :nth-child(2) > .q-field > .q-field__inner > .q-field__control ', 'Valencia');
+ cy.selectOption('.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control ', 'Province one');
+ cy.selectOption('.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > :nth-child(2) > .q-field > .q-field__inner > .q-field__control ', 'España');
+ cy.get('.q-mt-lg > .q-btn--standard').click();
});
});
})
diff --git a/test/cypress/integration/entry/entryDms.spec.js b/test/cypress/integration/entry/entryDms.spec.js
index 79a9c5162..5f9fae3dd 100644
--- a/test/cypress/integration/entry/entryDms.spec.js
+++ b/test/cypress/integration/entry/entryDms.spec.js
@@ -5,37 +5,40 @@ describe('WagonTypeCreate', () => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/entry/${entryId}/dms`);
-
});
it('should create edit and remove new dms', () => {
cy.addRow();
- cy.get('.icon-attach').click()
+ cy.get('.icon-attach').click();
cy.get('.q-file').selectFile('test/cypress/fixtures/image.jpg', {
force: true,
});
- cy.get("tbody > tr").then((value) => {
+ cy.get('tbody > tr').then((value) => {
+ const u = undefined;
+
//Create and check if exist new row
let newFileTd = Cypress.$(value).length;
cy.get('.q-btn--standard > .q-btn__content > .block').click();
expect(value).to.have.length(newFileTd++);
- const newRowSelector = `tbody > :nth-child(${newFileTd})`
+ const newRowSelector = `tbody > :nth-child(${newFileTd})`;
cy.waitForElement(newRowSelector);
+ cy.validateRow(newRowSelector, [u, u, u, u, 'ENTRADA ID 1']);
//Edit new dms
- const u = undefined;
- cy.validateRow(newRowSelector, [u,u,u,u,'ENTRADA ID 1'])
- cy.get(`tbody :nth-child(${newFileTd}) > .text-right > .flex > :nth-child(2) > .q-btn > .q-btn__content > .q-icon`).click();
- })
- // cy.log('newFileTd', newFileTd)
+ const newDescription = 'entry id 1 modified';
+ const textAreaSelector =
+ '.q-textarea > .q-field__inner > .q-field__control > .q-field__control-container';
+ cy.get(
+ `tbody :nth-child(${newFileTd}) > .text-right > .no-wrap > :nth-child(2) > .q-btn > .q-btn__content > .q-icon`
+ ).click();
- // //Create and check if exist new row
- // cy.log('newFileTd:', newFileTd);
- // cy.get(`tbody :nth-child(${newFileTd}) > .text-right > .flex > :nth-child(2) > .q-btn > .q-btn__content > .q-icon`).click()
+ cy.get(textAreaSelector).clear();
+ cy.get(textAreaSelector).type(newDescription);
+ cy.saveCard();
+ cy.reload();
- // cy.get(`tbody :nth-child(${newFileTd}) > :nth-child(5) > .q-tr > :nth-child(1) > span`).then((value) => {
- // cy.log(value)
- // });
+ cy.validateRow(newRowSelector, [u, u, u, u, newDescription]);
+ });
});
});
diff --git a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
index 811374b98..2f045f32c 100644
--- a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
@@ -37,6 +37,7 @@ describe('InvoiceInVat', () => {
it('should throw an error if there are fields undefined', () => {
cy.get(inputBtns).eq(0).click();
+ cy.get(':nth-child(1) > .q-td.q-table--col-auto-width > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .default-icon').click();
cy.get(dialogBtns).eq(2).click();
cy.get('.q-notification__message').should('have.text', "The code can't be empty");
});
@@ -44,7 +45,7 @@ describe('InvoiceInVat', () => {
it('should correctly handle expense addition', () => {
cy.get(inputBtns).eq(0).click();
- cy.get(dialogInputs).eq(0).click();
+ cy.get(':nth-child(1) > .q-td.q-table--col-auto-width > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .default-icon').click();
cy.get(dialogInputs).eq(0).type(randomInt);
cy.get(dialogInputs).eq(1).click();
cy.get(dialogInputs).eq(1).type('This is a dummy expense');
diff --git a/test/cypress/integration/vnSearchBar.spec.js b/test/cypress/integration/vnSearchBar.spec.js
index 3db789773..f1f3a9e82 100644
--- a/test/cypress/integration/vnSearchBar.spec.js
+++ b/test/cypress/integration/vnSearchBar.spec.js
@@ -36,7 +36,7 @@ describe('VnSearchBar', () => {
const checkCardListAndUrl = (expectedLength) => {
cy.get(cardList).then(($cardList) => {
expect($cardList.find('.q-card').length).to.equal(expectedLength);
- cy.url().then((currentUrl) => expect(currentUrl).to.equal(url));
+ cy.url().then((currentUrl) => expect(currentUrl).to.contain(url));
});
};
});
diff --git a/test/cypress/integration/worker/workerList.spec.js b/test/cypress/integration/worker/workerList.spec.js
index c950f9fed..38e7ea6d0 100644
--- a/test/cypress/integration/worker/workerList.spec.js
+++ b/test/cypress/integration/worker/workerList.spec.js
@@ -8,9 +8,9 @@ describe('WorkerList', () => {
});
it('should load workers', () => {
- cy.get(workerFieldNames).eq(0).should('have.text', 'JessicaJones');
- cy.get(workerFieldNames).eq(1).should('have.text', 'BruceBanner');
- cy.get(workerFieldNames).eq(2).should('have.text', 'CharlesXavier');
+ cy.get(workerFieldNames).eq(0).should('have.text', 'jessicajones');
+ cy.get(workerFieldNames).eq(1).should('have.text', 'brucebanner');
+ cy.get(workerFieldNames).eq(2).should('have.text', 'charlesxavier');
});
it('should open the worker summary', () => {
diff --git a/test/cypress/integration/worker/workerNotificationsManager.spec.js b/test/cypress/integration/worker/workerNotificationsManager.spec.js
index 175933277..ac452c4ff 100644
--- a/test/cypress/integration/worker/workerNotificationsManager.spec.js
+++ b/test/cypress/integration/worker/workerNotificationsManager.spec.js
@@ -60,7 +60,6 @@ describe('WorkerNotificationsManager', () => {
it('should active a notification if you are their boss', () => {
cy.login('salesBoss');
cy.visit(`/#/worker/${salesPersonId}/notifications`);
- cy.waitForElement(activeList);
cy.waitForElement(availableList);
cy.get(activeList)
diff --git a/test/cypress/integration/worker/workerSummary.spec.js b/test/cypress/integration/worker/workerSummary.spec.js
index 7228b4b31..3d70fdf96 100644
--- a/test/cypress/integration/worker/workerSummary.spec.js
+++ b/test/cypress/integration/worker/workerSummary.spec.js
@@ -6,7 +6,8 @@ describe('WorkerSummary', () => {
});
it('should load worker summary', () => {
- cy.get('.summaryHeader > div').should('have.text', '19 - salesBoss salesBoss');
+ cy.waitForElement('.summaryHeader');
+ cy.get('.summaryHeader > div').should('have.text', '19 - salesboss salesboss');
cy.get(':nth-child(1) > :nth-child(2) > .value > span').should(
'have.text',
'salesBossNick'
diff --git a/test/vitest/__tests__/components/common/VnLog.spec.js b/test/vitest/__tests__/components/common/VnLog.spec.js
index b654bff9b..53d2732a0 100644
--- a/test/vitest/__tests__/components/common/VnLog.spec.js
+++ b/test/vitest/__tests__/components/common/VnLog.spec.js
@@ -38,10 +38,10 @@ describe('VnLog', () => {
action: 'update',
changedModel: 'Claim',
oldInstance: {
- hasToPickUp: false,
+ pickup: null,
},
newInstance: {
- hasToPickUp: true,
+ pickup: 'agency',
},
creationDate: '2023-09-18T12:25:34.000Z',
changedModelId: '1',
diff --git a/test/vitest/__tests__/composables/useArrayData.spec.js b/test/vitest/__tests__/composables/useArrayData.spec.js
new file mode 100644
index 000000000..ae0ca7368
--- /dev/null
+++ b/test/vitest/__tests__/composables/useArrayData.spec.js
@@ -0,0 +1,31 @@
+import { describe, expect, it, beforeAll } from 'vitest';
+import { axios } from 'app/test/vitest/helper';
+import { useArrayData } from 'composables/useArrayData';
+
+describe('useArrayData', () => {
+ let arrayData;
+ beforeAll(() => {
+ axios.get.mockResolvedValue({ data: [] });
+ arrayData = useArrayData('InvoiceIn', { url: 'invoice-in/list' });
+ Object.defineProperty(window.location, 'href', {
+ writable: true,
+ value: 'localhost:9000/invoice-in/list',
+ });
+
+ // Mock the window.history.pushState method within useArrayData
+ window.history.pushState = (data, title, url) => (window.location.href = url);
+
+ // Mock the URL constructor within useArrayData
+ global.URL = class URL {
+ constructor(url) {
+ this.hash = url.split('localhost:9000/')[1];
+ }
+ };
+ });
+
+ it('should add the params to the url', async () => {
+ arrayData.store.userParams = { supplierFk: 2 };
+ arrayData.updateStateParams();
+ expect(window.location.href).contain('params=%7B%22supplierFk%22%3A2%7D');
+ });
+});