Skip to content

Commit

Permalink
fix: Preserve previous birthdate on GK edit
Browse files Browse the repository at this point in the history
  • Loading branch information
kumy committed May 25, 2024
1 parent 7874771 commit 4b1d684
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ${FIELD_RESULT_FORMAT} = %Y-%m-%dT%H:%M:%S+00:00
*** Test Cases ***

Not in the future
${date} = Get Current Date increment=3days result_format=${FIELD_RESULT_FORMAT}
# ${date} = Get Current Date increment=3days result_format=${FIELD_RESULT_FORMAT}
Sign In ${USER_1.name} Fast
Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Execute Javascript $("#datetimepicker").data("DateTimePicker").date(moment.utc().add(7, 'days').format('L'));
Expand All @@ -29,7 +29,7 @@ Not in the future

Ensure date is parsed with right TZ format
# GH Issue #1015
${date} = Get Current Date increment=3days result_format=${FIELD_RESULT_FORMAT}
# ${date} = Get Current Date increment=3days result_format=${FIELD_RESULT_FORMAT}
Sign In ${USER_1.name} Fast

Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Expand Down Expand Up @@ -59,6 +59,25 @@ Ensure date is parsed with right TZ format
Input validation has success ${GEOKRET_CREATE_BORN_ON_DATETIME_INPUT}


Edit GeoKret should keep the previous date
Sign In ${USER_1.name} Fast

# birthdate is 2020-08-12 00:00:00+00 from test setup
Go To Url ${PAGE_GEOKRETY_EDIT_URL}
${datetime} = Get DateTime
Should Be Equal ${datetime} 2020-08-12T00:00:00Z
Input Text ${GEOKRET_CREATE_BORN_ON_DATETIME_INPUT} 12/29/2023 01:00 AM
Simulate Event ${GEOKRET_CREATE_BORN_ON_DATETIME_INPUT} blur
Input validation has success ${GEOKRET_CREATE_BORN_ON_DATETIME_INPUT}
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Location Should Be ${PAGE_GEOKRETY_1_DETAILS_URL}
Element Attribute Should Be ${GEOKRET_DETAILS_CREATED_ON_DATETIME}/span data-datetime 2023-12-28T22:00:00+00:00

Go To Url ${PAGE_GEOKRETY_EDIT_URL}
${datetime} = Get DateTime
Should Be Equal ${datetime} 2023-12-28T22:00:00Z


New move before GK birth
Sign In ${USER_1.name} Fast

Expand Down Expand Up @@ -244,6 +263,13 @@ Set DateTime
Execute Javascript $("#datetimepicker").data("DateTimePicker").date(moment("${date}T${time}${timezone}"));
Simulate Event ${MOVE_ADDITIONAL_DATA_DATE_TIME_INPUT} blur

Get DateTime
Execute Javascript $("#datetimepicker").data("DateTimePicker").date();
${result} = Execute Async JavaScript
... var callback = arguments[arguments.length - 1];
... callback($("#datetimepicker").data("DateTimePicker").date().utc().format());
RETURN ${result}

Click Button And Check Panel Validation Has Success
[Arguments] ${button} ${current_panel} ${next_panel}
Panel validation has success ${current_panel}
Expand Down
3 changes: 1 addition & 2 deletions website/app-templates/smarty/pages/geokret_create.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ $("#datetimepicker").datetimepicker({
showTodayButton: true,
locale: moment.locale()
});
// bind datetimepicker
$("#born_on_datetime_localized").click(function() {
$("#datetimepicker").data("DateTimePicker").show();
});
// Initialize date time
$("#datetimepicker").data("DateTimePicker").date(moment.utc("{$geokret->born_on_datetime->format('Y-m-d H:i:s')}").local());
$("#datetimepicker").data("DateTimePicker").date(moment.utc("{$geokret->born_on_datetime->format('c')}"));
$("#born_on_datetime").val($("#datetimepicker").data("DateTimePicker").viewDate().format());
$("#born_on_datetime_localized").on("focusout", function(e) {
$("#born_on_datetime").val($("#datetimepicker").data("DateTimePicker").viewDate().format());
Expand Down

0 comments on commit 4b1d684

Please sign in to comment.