From 5f12d64e7387fe6b8f749246cb644197fb4533bd Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 19 Oct 2023 09:31:50 +0200 Subject: [PATCH] ref #6248 refactor breadcrumbs --- src/components/NavBar.vue | 10 +- src/components/common/VnBreadCrumbs.vue | 100 ----------------- src/components/common/VnBreadcrumbs.vue | 82 ++++++++++++++ src/pages/Wagon/Type/Card/WagonTypeCard.vue | 26 ----- src/router/modules/wagon.js | 101 +++++++----------- .../cypress/integration/vnBreadCrumbs.spec.js | 19 ---- .../cypress/integration/vnBreadcrumbs.spec.js | 21 ++++ 7 files changed, 144 insertions(+), 215 deletions(-) delete mode 100644 src/components/common/VnBreadCrumbs.vue create mode 100644 src/components/common/VnBreadcrumbs.vue delete mode 100644 src/pages/Wagon/Type/Card/WagonTypeCard.vue delete mode 100644 test/cypress/integration/vnBreadCrumbs.spec.js create mode 100644 test/cypress/integration/vnBreadcrumbs.spec.js diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index 6102dca55..c82a26248 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -7,7 +7,7 @@ import { useStateStore } from 'stores/useStateStore'; import { useQuasar } from 'quasar'; import PinnedModules from './PinnedModules.vue'; import UserPanel from 'components/UserPanel.vue'; -import VnBreadCrumbs from './common/VnBreadCrumbs.vue'; +import VnBreadcrumbs from './common/VnBreadcrumbs.vue'; const { t } = useI18n(); const session = useSession(); @@ -58,11 +58,7 @@ const pinnedModulesRef = ref(); - - {{ appName }} - - - + @@ -114,7 +110,7 @@ const pinnedModulesRef = ref();
- + diff --git a/src/components/common/VnBreadCrumbs.vue b/src/components/common/VnBreadCrumbs.vue deleted file mode 100644 index 64c01ae28..000000000 --- a/src/components/common/VnBreadCrumbs.vue +++ /dev/null @@ -1,100 +0,0 @@ - - - diff --git a/src/components/common/VnBreadcrumbs.vue b/src/components/common/VnBreadcrumbs.vue new file mode 100644 index 000000000..792671e21 --- /dev/null +++ b/src/components/common/VnBreadcrumbs.vue @@ -0,0 +1,82 @@ + + + diff --git a/src/pages/Wagon/Type/Card/WagonTypeCard.vue b/src/pages/Wagon/Type/Card/WagonTypeCard.vue deleted file mode 100644 index a23122947..000000000 --- a/src/pages/Wagon/Type/Card/WagonTypeCard.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - - -es: - Search customer: Buscar cliente - You can search by customer id or name: Puedes buscar por id o nombre del cliente - diff --git a/src/router/modules/wagon.js b/src/router/modules/wagon.js index 5a491cf1e..3fb808778 100644 --- a/src/router/modules/wagon.js +++ b/src/router/modules/wagon.js @@ -11,11 +11,11 @@ export default { redirect: { name: 'WagonMain' }, menus: { main: ['WagonList', 'WagonTypeList'], - card: ['WagonEdit'], + card: [], }, children: [ { - path: '', + path: '/wagon', name: 'WagonMain', component: () => import('src/pages/Wagon/WagonMain.vue'), redirect: { name: 'WagonList' }, @@ -39,67 +39,7 @@ export default { component: () => import('src/pages/Wagon/WagonCreate.vue'), }, { - path: 'type', - name: 'WagonTypeMain', - meta: { - title: 'typesList', - icon: 'view_list', - }, - redirect: { name: 'WagonTypeList' }, - children: [ - { - path: 'list', - name: 'WagonTypeList', - meta: { - title: 'typesList', - icon: 'view_list', - }, - component: () => - import('src/pages/Wagon/Type/WagonTypeList.vue'), - }, - { - path: 'create', - name: 'WagonTypeCreate', - meta: { - title: 'typeCreate', - icon: 'create', - }, - component: () => - import('src/pages/Wagon/Type/WagonTypeCreate.vue'), - }, - { - path: ':id', - name: 'WagonTypeCard', - component: () => - import('src/pages/Wagon/Type/Card/WagonTypeCard.vue'), - redirect: { name: 'WagonTypeEdit' }, - children: [ - { - path: 'edit', - name: 'WagonTypeEdit', - meta: { - title: 'typeEdit', - icon: 'edit', - }, - component: () => - import( - 'src/pages/Wagon/Type/WagonTypeCreate.vue' - ), - }, - ], - }, - ], - }, - ], - }, - { - name: 'WagonCard', - path: ':id', - component: () => import('src/pages/Wagon/Card/WagonCard.vue'), - redirect: { name: 'WagonEdit' }, - children: [ - { - path: 'edit', + path: ':id/edit', name: 'WagonEdit', meta: { title: 'wagonEdit', @@ -109,5 +49,40 @@ export default { }, ], }, + { + path: '/wagon/type', + name: 'WagonTypeMain', + component: () => import('src/pages/Wagon/WagonMain.vue'), + redirect: { name: 'WagonTypeList' }, + children: [ + { + path: 'list', + name: 'WagonTypeList', + meta: { + title: 'typesList', + icon: 'view_list', + }, + component: () => import('src/pages/Wagon/Type/WagonTypeList.vue'), + }, + { + path: 'create', + name: 'WagonTypeCreate', + meta: { + title: 'typeCreate', + icon: 'create', + }, + component: () => import('src/pages/Wagon/Type/WagonTypeCreate.vue'), + }, + { + path: ':id/edit', + name: 'WagonTypeEdit', + meta: { + title: 'typeEdit', + icon: 'edit', + }, + component: () => import('src/pages/Wagon/Type/WagonTypeCreate.vue'), + }, + ], + }, ], }; diff --git a/test/cypress/integration/vnBreadCrumbs.spec.js b/test/cypress/integration/vnBreadCrumbs.spec.js deleted file mode 100644 index dd74fbfd4..000000000 --- a/test/cypress/integration/vnBreadCrumbs.spec.js +++ /dev/null @@ -1,19 +0,0 @@ -/// -describe('VnBreadCrumbs', () => { - beforeEach(() => { - cy.login('developer'); - cy.visit('/'); - }); - - it('should not be breadcrumbs', () => { - cy.get('.q-breadcrumbs').should('not.exist'); - }); - it('should get the correct breadcrumbs', () => { - cy.get('[href="#/customer"]').click(); - cy.get('.q-breadcrumbs .q-breadcrumbs--last').should('have.length', 1); - cy.get('.q-breadcrumbs .q-breadcrumbs--last').contains('List'); - cy.get('.q-infinite-scroll > :nth-child(1)').click(); - cy.get('.q-breadcrumbs .q-breadcrumbs__el').should('have.length', 2); - cy.get('.q-breadcrumbs .q-breadcrumbs__el').eq(1).contains('Summary'); - }); -}); diff --git a/test/cypress/integration/vnBreadcrumbs.spec.js b/test/cypress/integration/vnBreadcrumbs.spec.js new file mode 100644 index 000000000..3c839c1c7 --- /dev/null +++ b/test/cypress/integration/vnBreadcrumbs.spec.js @@ -0,0 +1,21 @@ +/// +describe('VnBreadcrumbs', () => { + const firstCard = '.q-infinite-scroll > :nth-child(1)'; + const lastBreadcrumb = '.q-breadcrumbs--last > .q-breadcrumbs__el'; + beforeEach(() => { + cy.login('developer'); + cy.visit('/'); + }); + + it('should not be breadcrumbs', () => { + cy.get('.q-breadcrumbs').should('not.exist'); + }); + + it('should get the correct breadcrumbs', () => { + cy.visit('#/customer/list'); + cy.get('.q-breadcrumbs__el').should('have.length', 2); + + cy.get(firstCard).click(); + cy.get(`${lastBreadcrumb} > .q-icon`).should('have.text', 'launch'); + }); +});