0
0
Fork 0

refactor: refs #7014 refactor ZoneCard, deleted ZoneMain & created basic tests for functionality

This commit is contained in:
Jon Elias 2024-07-23 10:38:45 +02:00
parent e76d8bf269
commit 67275e435e
8 changed files with 56 additions and 5 deletions

View File

@ -2,9 +2,9 @@
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { computed } from 'vue'; import { computed } from 'vue';
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import ZoneDescriptor from './ZoneDescriptor.vue'; import ZoneDescriptor from './ZoneDescriptor.vue';
import ZoneSearchbar from './ZoneSearchbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -33,5 +33,9 @@ const searchBarDataKeys = {
:search-make-fetch="searchbarMakeFetch" :search-make-fetch="searchbarMakeFetch"
:searchbar-label="t('list.searchZone')" :searchbar-label="t('list.searchZone')"
:searchbar-info="t('list.searchInfo')" :searchbar-info="t('list.searchInfo')"
/> >
<template #searchbar>
<ZoneSearchbar />
</template>
</VnCard>
</template> </template>

View File

@ -1,7 +1,6 @@
<script setup> <script setup>
import VnSectionMain from 'components/common/VnSectionMain.vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
const { t } = useI18n(); const { t } = useI18n();
@ -47,5 +46,4 @@ const exprBuilder = (param, value) => {
:info="t('list.searchInfo')" :info="t('list.searchInfo')"
custom-route-redirect-name="ZoneSummary" custom-route-redirect-name="ZoneSummary"
/> />
<VnSectionMain />
</template> </template>

View File

@ -3,6 +3,7 @@ import { ref } from 'vue';
import ZoneDeliveryPanel from './ZoneDeliveryPanel.vue'; import ZoneDeliveryPanel from './ZoneDeliveryPanel.vue';
import ZoneCalendarGrid from './ZoneCalendarGrid.vue'; import ZoneCalendarGrid from './ZoneCalendarGrid.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
const firstDay = ref(null); const firstDay = ref(null);
const lastDay = ref(null); const lastDay = ref(null);
@ -10,6 +11,7 @@ const events = ref([]);
</script> </script>
<template> <template>
<ZoneSearchbar />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<ZoneDeliveryPanel /> <ZoneDeliveryPanel />

View File

@ -15,6 +15,7 @@ import { useStateStore } from 'stores/useStateStore';
import axios from 'axios'; import axios from 'axios';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import ZoneFilterPanel from './ZoneFilterPanel.vue'; import ZoneFilterPanel from './ZoneFilterPanel.vue';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
@ -87,6 +88,7 @@ onMounted(() => (stateStore.rightDrawer = true));
</script> </script>
<template> <template>
<ZoneSearchbar />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<ZoneFilterPanel data-key="ZoneList" :expr-builder="exprBuilder" /> <ZoneFilterPanel data-key="ZoneList" :expr-builder="exprBuilder" />

View File

@ -7,6 +7,7 @@ import FetchData from 'components/FetchData.vue';
import { toDateFormat } from 'src/filters/date.js'; import { toDateFormat } from 'src/filters/date.js';
import { useWeekdayStore } from 'src/stores/useWeekdayStore'; import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const weekdayStore = useWeekdayStore(); const weekdayStore = useWeekdayStore();
@ -52,6 +53,7 @@ onMounted(() => weekdayStore.initStore());
@on-fetch="(data) => (details = data)" @on-fetch="(data) => (details = data)"
auto-load auto-load
/> />
<ZoneSearchbar />
<VnSubToolbar /> <VnSubToolbar />
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QCard class="full-width q-pa-md"> <QCard class="full-width q-pa-md">

View File

@ -0,0 +1,17 @@
describe('ZoneDeliveryDays', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/delivery-days`);
cy.waitForElement('.q-page', 6000);
});
it('should query for the day', () => {
cy.get('.q-form > .q-btn > .q-btn__content').click();
cy.waitForElement('.q-notification__message', 6000);
cy.get('.q-notification__message').should(
'have.text',
'No service for the specified zone'
);
});
});

View File

@ -0,0 +1,16 @@
describe('ZoneList', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/zone/list`);
cy.waitForElement('.q-page', 6000);
});
it('should open the details', () => {
cy.get(':nth-child(1) > .text-right > .material-symbols-outlined').click();
});
it('should redirect to summary', () => {
cy.waitForElement('.q-page');
cy.get('tbody > :nth-child(1)').click();
});
});

View File

@ -0,0 +1,10 @@
describe('ZoneUpcomingDeliveries', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/upcoming-deliveries`);
cy.waitForElement('.q-page', 6000);
});
it('should show the page', () => {});
});