From e271221abe3bbfdb19c3c81271f9ae638a80d239 Mon Sep 17 00:00:00 2001 From: stavros Date: Mon, 10 Jun 2024 16:15:17 +0100 Subject: [PATCH 1/9] chux-467:feat:mobile-view --- .../ec-mobile-header/ec-mobile-header.vue | 10 ++++- .../ec-navigation/ec-navigation.vue | 41 ++++++++++++++++++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/components/ec-mobile-header/ec-mobile-header.vue b/src/components/ec-mobile-header/ec-mobile-header.vue index 8e516f66b..f746cb9e5 100644 --- a/src/components/ec-mobile-header/ec-mobile-header.vue +++ b/src/components/ec-mobile-header/ec-mobile-header.vue @@ -6,7 +6,11 @@ - + +`; + +exports[`EcNavigation > mobile navigation > should close the mobile navigation when the close menu button is clicked > before 1`] = ` +
+ +
+ +
+ + + +
+ + +
+ + +
+`; + +exports[`EcNavigation > mobile navigation > should render mobile header if "isResponsive" prop is true 1`] = ` +
+ + +
+`; + +exports[`EcNavigation > mobile navigation > should show render the mobile navigation when the mobile header menu button is clicked > after 1`] = ` +
+ +
+ +
+ + + +
+ + +
+ + +
+`; + +exports[`EcNavigation > mobile navigation > should show render the mobile navigation when the mobile header menu button is clicked > before 1`] = ` +
+ + +
+`; + exports[`EcNavigation > should apply light mode CSS classes if "isInLightMode" prop is true 1`] = `
should render branding logo and name when given 1`] = `
`; -exports[`EcNavigation > should render mobile header if "isResponsive" prop is true 1`] = ` -
- - -
-`; - exports[`EcNavigation > should render with custom attributes 1`] = `
{ expect(wrapper.findAllByDataTest('ec-navigation__block').length).toBe(5); }); - it('should render mobile header if "isResponsive" prop is true', () => { + it('should apply light mode CSS classes if "isInLightMode" prop is true', () => { const wrapper = mountNavigation({ - isResponsive: true, + isInLightMode: true, }); expect(wrapper.element).toMatchSnapshot(); }); - it('should apply light mode CSS classes if "isInLightMode" prop is true', () => { - const wrapper = mountNavigation({ - isInLightMode: true, + describe('mobile navigation', () => { + it('should render mobile header if "isResponsive" prop is true', () => { + const wrapper = mountNavigation({ + isResponsive: true, + }); + + expect(wrapper.element).toMatchSnapshot(); }); - expect(wrapper.element).toMatchSnapshot(); + it('should show render the mobile navigation when the mobile header menu button is clicked', async () => { + const wrapper = mountNavigation({ + isResponsive: true, + }); + + expect(wrapper.element).toMatchSnapshot('before'); + await wrapper.findByDataTest('ec-mobile-header__menu').trigger('click'); + expect(wrapper.element).toMatchSnapshot('after'); + }); + + it('should close the mobile navigation when the close menu button is clicked', async () => { + const wrapper = mountNavigation({ + isResponsive: true, + }); + + await wrapper.findByDataTest('ec-mobile-header__menu').trigger('click'); + expect(wrapper.element).toMatchSnapshot('before'); + + await wrapper.findByDataTest('ec-navigation__mobile-menu-close-button').trigger('click'); + expect(wrapper.element).toMatchSnapshot('after'); + }); }); }); diff --git a/src/components/ec-navigation/ec-navigation.vue b/src/components/ec-navigation/ec-navigation.vue index 4cf9ad2bf..0077b757a 100644 --- a/src/components/ec-navigation/ec-navigation.vue +++ b/src/components/ec-navigation/ec-navigation.vue @@ -34,6 +34,7 @@ > From 6ae24444a1a6eacc3b5c100d2a6074ac8fb61e09 Mon Sep 17 00:00:00 2001 From: stavros Date: Wed, 12 Jun 2024 10:48:51 +0100 Subject: [PATCH 6/9] CHUX-467:chore:export letter icon --- src/main.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.ts b/src/main.ts index a9b8f18e9..e1050ad33 100644 --- a/src/main.ts +++ b/src/main.ts @@ -49,6 +49,8 @@ export { default as EcInlineInputField } from './components/ec-inline-input-fiel export * from './components/ec-inline-input-field/types'; export { default as EcInputField } from './components/ec-input-field'; export * from './components/ec-input-field/types'; +export { default as EcLetterIcon } from './components/ec-letter-icon'; +export * from './components/ec-letter-icon/types'; export { default as EcLoading } from './components/ec-loading'; export * from './components/ec-loading/types'; export { default as EcLoadingIcon } from './components/ec-loading-icon'; From 716a7eea3fb0344fad23e5c95467dcb8141f4746 Mon Sep 17 00:00:00 2001 From: stavros Date: Wed, 12 Jun 2024 15:00:50 +0100 Subject: [PATCH 7/9] CHUX-467:chore: adjust width of images and make menu close on navigation link clicked --- src/components/ec-mobile-header/ec-mobile-header.vue | 2 +- .../ec-navigation-link/ec-navigation-link.vue | 5 +++++ src/components/ec-navigation/ec-navigation.vue | 12 ++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/ec-mobile-header/ec-mobile-header.vue b/src/components/ec-mobile-header/ec-mobile-header.vue index 5f809f145..bddbcc700 100644 --- a/src/components/ec-mobile-header/ec-mobile-header.vue +++ b/src/components/ec-mobile-header/ec-mobile-header.vue @@ -38,7 +38,7 @@ const emit = defineEmits<{ @apply tw-bg-gray-7; &__logo { - @apply tw-h-32; + @apply tw-w-88; } &__menu { diff --git a/src/components/ec-navigation-link/ec-navigation-link.vue b/src/components/ec-navigation-link/ec-navigation-link.vue index d15d49d77..075b498dc 100644 --- a/src/components/ec-navigation-link/ec-navigation-link.vue +++ b/src/components/ec-navigation-link/ec-navigation-link.vue @@ -15,6 +15,7 @@ 'ec-navigation-link--light-mode': isInLightMode, }" :to="url" + @click="emit('navigation-link-clicked')" > (); + defineOptions({ inheritAttrs: false, }); diff --git a/src/components/ec-navigation/ec-navigation.vue b/src/components/ec-navigation/ec-navigation.vue index 0077b757a..0f2ff1ed8 100644 --- a/src/components/ec-navigation/ec-navigation.vue +++ b/src/components/ec-navigation/ec-navigation.vue @@ -25,6 +25,7 @@ ...$attrs, 'data-test': $attrs['data-test'] ? `${$attrs['data-test']} ec-navigation` : 'ec-navigation', }" + @navigation-link-clicked="onNavigationLinkClicked" >