Skip to content

Commit 14552cf

Browse files
authored
fix(ui5-date-picker): remove timezone test (#4829)
- The DateFormat's parse method wasn't expected to call getDate on the already correctly parsed JavaScript Date object. The result is declared invalid and replaced with null when the day doen't match the one from the string. The timezone test is removed as we don't have a way to mock the JS Date. Fixes: 4443
1 parent 3fc5814 commit 14552cf

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

packages/main/test/pages/DatePicker_test_page.html

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@
4040

4141

4242
<label id='lbl'>0</label>
43-
<label for="inputTimezone">Timezone:</label>
44-
<input id="inputTimezone" type="number"/>
45-
<button id="btnApplyTimezone" onclick="stubTimezone();">Apply</button>
46-
<button id="btnRestoreTimezone" onclick="restore();">Restore</button>
4743
<button id="downThere" class="datepicker_test_page2auto"></button>
4844
<label id='lblTomorrow'>0</label>
4945
<label id='lblTomorrowDate'></label>
@@ -76,21 +72,6 @@ <h3>Test accessibleName and accessibleNameRef</h3>
7672
</section>
7773

7874
<script>
79-
var originalGetDate = Date.prototype.getDate;
80-
81-
function stubTimezone() {
82-
var timezone = parseInt(document.querySelector("#inputTimezone").value, 10);
83-
Date.prototype.getDate = function() {
84-
var stubedDate = new Date(this.getTime() + timezone * 60 * 60 * 1000);
85-
return stubedDate.getUTCDate();
86-
};
87-
}
88-
89-
function restore() {
90-
Date.prototype.getDate = originalGetDate;
91-
document.querySelector("#inputTimezone").value = "";
92-
};
93-
9475
var counter = 0;
9576
var counterTomorrow = 0;
9677
function increaseCounter() {

packages/main/test/specs/DatePicker.spec.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -215,27 +215,6 @@ describe("Date Picker Tests", () => {
215215
await valueHelpIcon.click();
216216
});
217217

218-
// it("Calendar selection works on different timezones", async () => {
219-
// datepicker.id = "#dp7";
220-
221-
// await browser.$("#inputTimezone").setValue(-6); //CST
222-
// await browser.$("#btnApplyTimezone").click();
223-
224-
// const valueHelpIcon = await datepicker.getValueHelpIcon();
225-
// await valueHelpIcon.click();
226-
227-
// let calendarDate_4_Jan_2019 = await datepicker.getPickerDate(1546560000); //Jan 4, 2019
228-
// await calendarDate_4_Jan_2019.click();
229-
230-
// const innerInput = await datepicker.getInnerInput();
231-
// assert.strictEqual(await innerInput.getProperty("value"), "Jan 4, 2019", "dp value is correct");
232-
// //restore timezone
233-
// await browser.$('#btnRestoreTimezone').click();
234-
235-
// // test needs to end with an assert, otherwise the next test seems to start before the click is finished and it hangs from time to time
236-
// assert.equal(await browser.$("#inputTimezone").getValue(), "", "timezone is reset");
237-
// });
238-
239218
it("respect first day of the week - monday", async () => {
240219
await browser.url(`http://localhost:${PORT}/test-resources/pages/DatePicker_test_page.html?sap-ui-language=bg`);
241220
datepicker.id = "#dp7_1";

0 commit comments

Comments
 (0)