Skip to content

feat: set date to today by click today text(fix #87) #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 12, 2021

Conversation

jajugoguma
Copy link
Contributor

Please check if the PR fulfills these requirements

  • It's submitted to right branch according to our branching model
  • It's right issue type on title
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • It does not introduce a breaking change or has description for the breaking change

Description

Make today text of title look clickable and If click it, set the date to today on DatePicker.


Thank you for your contribution to TOAST UI product. 🎉 😘 ✨

Copy link

@dongsik-yoo dongsik-yoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 완료합니다. 수고하셨습니다.

* @param {Event} ev An event object
* @private
*/
_todayClickHandler: function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

핸들러가 _on~~으로 시작해서 이것도 맞추는게 좋겠습니다.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_onClickTodayHandler 면 되겠네요

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_onClickTodayHandler으로 핸들러 명 수정 했습니다.

@@ -11,6 +11,7 @@ var CLASS_NAME_NEXT_MONTH_BTN = constants.CLASS_NAME_NEXT_MONTH_BTN;
var CLASS_NAME_NEXT_YEAR_BTN = constants.CLASS_NAME_NEXT_YEAR_BTN;
var CLASS_NAME_PREV_MONTH_BTN = constants.CLASS_NAME_PREV_MONTH_BTN;
var CLASS_NAME_PREV_YEAR_BTN = constants.CLASS_NAME_PREV_YEAR_BTN;
var CLASS_NAME_TITLE_TODAY = 'tui-calendar-title-today';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위에는 변수로 선언된 것을 가져오는데, 이 부분은 다르게 한 이유가 있을까요?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위쪽에 변수로 선언된거에는 . 가 앞에 붙어있네요. 이런거는 어떤 형태로든 통일이 되도록 만드는게 좋겠는데 말이죠.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

통일되도록 constants에서 가져오도록 변경했습니다.

header.on('today', spy);

clickBtnInHeader(CLASS_NAME_TITLE_TODAY);
expect(spy).toHaveBeenCalled();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오늘 날짜인지 데이터 비교도 테스트 해야 하지 않을까요?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today라고 할 수 있는 시점을 모킹하고 임의로 날짜를 변경해본 다음 clickBtnInHeader 를 호출하고 난 뒤 Today 모킹이 출력되는지 보아야겠네요.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위 테스트는 헤더에서 오늘 날짜 텍스트를 클릭했을 때 today 이벤트가 정상적으로 발생하는지만 검증하는 테스트였습니다.
말씀하신 것을 검증하기 위해 데이트픽커에 대해 새 테스트를 작성했습니다.

@@ -91,6 +91,12 @@
background-color: #f4f4f4
}

.tui-calendar .tui-calendar-title-today:hover {
color: #333;
background-color: #edf4fc;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

색상은 디자인 가이드에 있는 거예요?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hover 배경색이랑 동일한 것 같네요.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

데이트 픽커에서 날짜 등을 선택하기 전 hover의 배경색과 동일하게 처리해 클릭 가능함을 알리려 위 색상을 사용했습니다.
혹시 이 버튼을 위한 색상 가이드를 다시 받아야할까요?

Copy link

@adhrinae adhrinae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 완료합니다.

@@ -24,6 +24,7 @@ var TYPE_YEAR = constants.TYPE_YEAR;
var CLASS_NAME_TITLE_MONTH = 'tui-calendar-title-month';
var CLASS_NAME_TITLE_YEAR = 'tui-calendar-title-year';
var CLASS_NAME_TITLE_YEAR_TO_YEAR = 'tui-calendar-title-year-to-year';
var CLASS_NAME_TITLE_TODAY = '.tui-calendar-title-today';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위의 클래스네임은 . 가 없고 이 라인이랑 아래쪽에는 . 가 붙어있는 이유가 있나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

단순히 클래스 네임이라 생각하고 저 그룹과 묶었었는데 실제 사용은 아래의 .이 붙어있는 그룹과 같이 사용되어서 이에 따른 오해가 발생하지 않도록 위치를 조정하고 이름은 변경했습니다.

* @param {Event} ev An event object
* @private
*/
_todayClickHandler: function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_onClickTodayHandler 면 되겠네요

@@ -11,6 +11,7 @@ var CLASS_NAME_NEXT_MONTH_BTN = constants.CLASS_NAME_NEXT_MONTH_BTN;
var CLASS_NAME_NEXT_YEAR_BTN = constants.CLASS_NAME_NEXT_YEAR_BTN;
var CLASS_NAME_PREV_MONTH_BTN = constants.CLASS_NAME_PREV_MONTH_BTN;
var CLASS_NAME_PREV_YEAR_BTN = constants.CLASS_NAME_PREV_YEAR_BTN;
var CLASS_NAME_TITLE_TODAY = 'tui-calendar-title-today';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위쪽에 변수로 선언된거에는 . 가 앞에 붙어있네요. 이런거는 어떤 형태로든 통일이 되도록 만드는게 좋겠는데 말이죠.

header.on('today', spy);

clickBtnInHeader(CLASS_NAME_TITLE_TODAY);
expect(spy).toHaveBeenCalled();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today라고 할 수 있는 시점을 모킹하고 임의로 날짜를 변경해본 다음 clickBtnInHeader 를 호출하고 난 뒤 Today 모킹이 출력되는지 보아야겠네요.

Copy link
Contributor

@lja1018 lja1018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰완료합니다.

Copy link

@jwlee1108 jwlee1108 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 완료합니다.

@jajugoguma jajugoguma merged commit e7f28c9 into master Aug 12, 2021
@jajugoguma jajugoguma deleted the feat/set-date-to-today-by-click-today-text branch August 12, 2021 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants