Skip to content

Commit

Permalink
test: 2023년 -> 2024년 변경으로 인한 테스트코드 문제 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
dladncks1217 committed Jan 11, 2024
1 parent 4adf631 commit 6dac141
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 43 deletions.
20 changes: 13 additions & 7 deletions frontend/cypress/e2e/createTrip.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,17 @@ describe('여행 생성 페이지', () => {
cy.get('#date').click();

const currentMonth = String(new Date().getMonth() + 1).padStart(2, '0');
const currentYear = String(new Date().getFullYear());

cy.get(`span[aria-label="2023년 ${currentMonth}월 1일"]`).click();
cy.get(`span[aria-label="2023년 ${currentMonth}월 12일"]`).click();
cy.get(`span[aria-label="${currentYear} ${currentMonth}월 1일"]`).click();
cy.get(`span[aria-label="${currentYear} ${currentMonth}월 12일"]`).click();

cy.get('#date').click();

cy.get('#date').should('have.value', `2023.${currentMonth}.01 - 2023.${currentMonth}.12`);
cy.get('#date').should(
'have.value',
`${currentYear}.${currentMonth}.01 - ${currentYear}.${currentMonth}.12`
);
});

it('도시와 기간이 채워졌을 때만 기록하기 버튼을 누를 수 있다.', () => {
Expand All @@ -64,9 +68,10 @@ describe('여행 생성 페이지', () => {
cy.get('#date').click();

const currentMonth = String(new Date().getMonth() + 1).padStart(2, '0');
const currentYear = String(new Date().getFullYear());

cy.get(`span[aria-label="2023년 ${currentMonth}월 1일"]`).click();
cy.get(`span[aria-label="2023년 ${currentMonth}월 12일"]`).click();
cy.get(`span[aria-label="${currentYear} ${currentMonth}월 1일"]`).click();
cy.get(`span[aria-label="${currentYear} ${currentMonth}월 12일"]`).click();

cy.get('#date').click();

Expand All @@ -85,9 +90,10 @@ describe('여행 생성 페이지', () => {
cy.get('#date').click();

const currentMonth = String(new Date().getMonth() + 1).padStart(2, '0');
const currentYear = String(new Date().getFullYear());

cy.get(`span[aria-label="2023년 ${currentMonth}월 1일"]`).click();
cy.get(`span[aria-label="2023년 ${currentMonth}월 12일"]`).click();
cy.get(`span[aria-label="${currentYear} ${currentMonth}월 1일"]`).click();
cy.get(`span[aria-label="${currentYear} ${currentMonth}월 12일"]`).click();

cy.get('#date').click();

Expand Down
38 changes: 15 additions & 23 deletions frontend/src/components/trips/TutorialModal/TutorialModal.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,25 @@ import { css } from '@emotion/react';

import { Theme } from 'hang-log-design-system';

export const boxStyling = css({
display: 'flex',
flexDirection: 'column',
alignItems: 'center',

width: '450px',
height: '500px',
marginTop: '30px',

'@media screen and (max-width: 600px)': {
width: '346px',
marginBottom: Theme.spacer.spacing6,
},
});

export const modalStyling = css({
paddingTop: Theme.spacer.spacing5,

'@media screen and (max-width: 600px)': {
width: `calc(100vw - ${Theme.spacer.spacing5})`,
height: `calc(100vh - ${Theme.spacer.spacing9})`,
},
});

export const carouselStyling = css({
width: '385px',
height: '412px',
});
export const buttonStyling = (isMobile: boolean) =>
css({
width: '100%',

export const buttonStyling = css({
width: '100%',
});
marginTop: isMobile ? 0 : 48,
});

export const ItemStyling = (width: number, height: number) =>
css({
'& > svg': {
width,
height,
},
});
45 changes: 32 additions & 13 deletions frontend/src/components/trips/TutorialModal/TutorialModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import { useEffect } from 'react';

import { useRecoilValue } from 'recoil';

import { SVGCarouselModal, useOverlay } from 'hang-log-design-system';
import { Button, GeneralCarousel, Modal, useOverlay } from 'hang-log-design-system';

import {
ItemStyling,
buttonStyling,
modalStyling,
} from '@components/trips/TutorialModal/TutorialModal.style';

import { mediaQueryMobileState } from '@store/mediaQuery';

Expand All @@ -14,24 +20,37 @@ import Tutorial4SVG from '@assets/svg/tutorial4.svg';
const TutorialModal = () => {
const { isOpen: isTutorialOpen, open: openTutorial, close: closeTutorial } = useOverlay();
const isMobile = useRecoilValue(mediaQueryMobileState);
const carouselImages = [Tutorial1SVG, Tutorial2SVG, Tutorial3SVG, Tutorial4SVG];

useEffect(() => {
openTutorial();
}, [openTutorial]);

return (
<SVGCarouselModal
modalWidth={isMobile ? window.innerWidth - 32 - 48 : 385}
modalHeight={isMobile ? window.innerWidth : 412}
isOpen={isTutorialOpen}
closeModal={closeTutorial}
carouselWidth={isMobile ? window.innerWidth - 32 - 48 : 385}
carouselHeight={isMobile ? window.innerWidth : 412}
carouselImages={[Tutorial1SVG, Tutorial2SVG, Tutorial3SVG, Tutorial4SVG]}
showArrows
showDots
buttonGap={isMobile ? 0 : 48}
/>
<Modal css={modalStyling} isOpen={isTutorialOpen} closeModal={closeTutorial}>
<GeneralCarousel
showNavigationOnHover={false}
width={isMobile ? window.innerWidth - 32 - 48 : 385}
height={isMobile ? window.innerWidth : 412}
length={4}
>
{carouselImages.map((Svg, index) => (
<GeneralCarousel.Item index={index} key={crypto.randomUUID()}>
<div
css={ItemStyling(
isMobile ? window.innerWidth - 32 - 48 : 385,
isMobile ? window.innerWidth : 412
)}
>
<Svg />
</div>
</GeneralCarousel.Item>
))}
</GeneralCarousel>
<Button type="button" variant="primary" css={buttonStyling(isMobile)} onClick={closeTutorial}>
닫기
</Button>
</Modal>
);
};

Expand Down

0 comments on commit 6dac141

Please sign in to comment.