diff --git a/testing/tests/DevExpress.ui.widgets.scheduler/integrationParts/agenda.tests.js b/testing/tests/DevExpress.ui.widgets.scheduler/integrationParts/agenda.tests.js index 4b5c589f2e93..5fcc8fead398 100644 --- a/testing/tests/DevExpress.ui.widgets.scheduler/integrationParts/agenda.tests.js +++ b/testing/tests/DevExpress.ui.widgets.scheduler/integrationParts/agenda.tests.js @@ -4,12 +4,13 @@ var $ = require("jquery"), devices = require("core/devices"), resizeCallbacks = require("core/utils/window").resizeCallbacks, fx = require("animation/fx"), - Color = require("color"); + Color = require("color"), + subscribes = require("ui/scheduler/ui.scheduler.subscribes"); require("ui/scheduler/ui.scheduler"); function getDeltaTz(schedulerTz) { - var defaultTz = new Date().getTimezoneOffset() * 60000; + var defaultTz = -10800000; return schedulerTz * 3600000 + defaultTz; } @@ -1025,26 +1026,31 @@ QUnit.test("The timeZone option should be processed correctly", function(assert) }); QUnit.test("All-day appointment should not be duplicated with custom timezone", function(assert) { - this.clock.restore(); - var timezoneDifference = getDeltaTz(5), - getDate = function(date) { - return new Date(date.getTime() - timezoneDifference); - }; - - this.createInstance({ - views: ["agenda"], - currentView: "agenda", - currentDate: new Date(2016, 4, 3), - timeZone: "Asia/Ashkhabad", - dataSource: [{ - startDate: getDate(new Date(2016, 4, 4)), - endDate: getDate(new Date(2016, 4, 5)) - }] - }); + var tzOffsetStub = sinon.stub(subscribes, "getClientTimezoneOffset").returns(-10800000); + try { + this.clock.restore(); + var timezoneDifference = getDeltaTz(5), + getDate = function(date) { + return new Date(date.getTime() - timezoneDifference); + }; + + this.createInstance({ + views: ["agenda"], + currentView: "agenda", + currentDate: new Date(2016, 4, 3), + timeZone: "Asia/Ashkhabad", + dataSource: [{ + startDate: getDate(new Date(2016, 4, 4)), + endDate: getDate(new Date(2016, 4, 5)) + }] + }); - var $appts = this.instance.element().find(".dx-scheduler-appointment"); + var $appts = this.instance.element().find(".dx-scheduler-appointment"); - assert.equal($appts.length, 1, "Appt count is OK"); + assert.equal($appts.length, 1, "Appt count is OK"); + } finally { + tzOffsetStub.restore(); + } }); QUnit.test("All-day appointment should not be duplicated with custom timezone (T437288)", function(assert) { diff --git a/testing/tests/DevExpress.ui.widgets.scheduler/integrationParts/appointments.tests.js b/testing/tests/DevExpress.ui.widgets.scheduler/integrationParts/appointments.tests.js index 7df054972063..774709503502 100644 --- a/testing/tests/DevExpress.ui.widgets.scheduler/integrationParts/appointments.tests.js +++ b/testing/tests/DevExpress.ui.widgets.scheduler/integrationParts/appointments.tests.js @@ -4126,27 +4126,32 @@ QUnit.test("Long multiday appointment should have right position on timeline wee }); QUnit.test("Appointment should have right width in workspace with timezone", function(assert) { - this.clock.restore(); - this.createInstance({ - dataSource: [], - currentDate: new Date(2016, 4, 1), - currentView: "month", - firstDayOfWeek: 1, - startDayHour: 3, - endDayHour: 24, - timeZone: "Asia/Ashkhabad" - }); + var tzOffsetStub = sinon.stub(subscribes, "getClientTimezoneOffset").returns(-10800000); + try { + this.clock.restore(); + this.createInstance({ + dataSource: [], + currentDate: new Date(2017, 4, 1), + currentView: "month", + firstDayOfWeek: 1, + startDayHour: 3, + endDayHour: 24, + timeZone: "Asia/Ashkhabad" + }); - this.instance.addAppointment({ - text: "Task 1", - startDate: new Date(2016, 4, 4), - endDate: new Date(2016, 4, 5) - }); + this.instance.addAppointment({ + text: "Task 1", + startDate: new Date(2017, 4, 4), + endDate: new Date(2017, 4, 5) + }); - var $appointment = this.instance.element().find(".dx-scheduler-work-space .dx-scheduler-appointment").eq(0), - $cell = this.instance.element().find(".dx-scheduler-work-space .dx-scheduler-date-table-cell").eq(9); + var $appointment = this.instance.element().find(".dx-scheduler-work-space .dx-scheduler-appointment").eq(0), + $cell = this.instance.element().find(".dx-scheduler-work-space .dx-scheduler-date-table-cell").eq(9); - assert.roughEqual($appointment.outerWidth(), $cell.outerWidth(), 1.001, "Task has a right width"); + assert.roughEqual($appointment.outerWidth(), $cell.outerWidth(), 1.001, "Task has a right width"); + } finally { + tzOffsetStub.restore(); + } }); QUnit.test("Appointment with zero-duration should be rendered correctly(T443143)", function(assert) { diff --git a/testing/tests/DevExpress.ui.widgets.scheduler/subscribes.tests.js b/testing/tests/DevExpress.ui.widgets.scheduler/subscribes.tests.js index b7df26b1e527..4aa875e6ef4e 100644 --- a/testing/tests/DevExpress.ui.widgets.scheduler/subscribes.tests.js +++ b/testing/tests/DevExpress.ui.widgets.scheduler/subscribes.tests.js @@ -11,10 +11,6 @@ var $ = require("jquery"), dateUtils = require("core/utils/date"), config = require("core/config"); -function getDaylightSavingsOffset(date1, date2) { - return date1.getTimezoneOffset() - date2.getTimezoneOffset(); -} - QUnit.testStart(function() { $("#qunit-fixture").html('
'); }); @@ -701,8 +697,6 @@ QUnit.test("'convertDateByTimezone' should return date according to the custom t var date = new Date(2015, 6, 3, 3), timezoneDifference = date.getTimezoneOffset() * 60000 + timezoneValue * 3600000; - timezoneDifference -= getDaylightSavingsOffset(date, new Date()) * 60000; - var convertedDate = this.instance.fire("convertDateByTimezone", date); assert.deepEqual(convertedDate, new Date(date.getTime() + timezoneDifference), "'convertDateByTimezone' works fine"); @@ -720,8 +714,6 @@ QUnit.test("'convertDateByTimezone' should return date according to the custom t var date = new Date(2015, 6, 3, 3), timezoneDifference = date.getTimezoneOffset() * 60000 + timezone.value * 3600000; - timezoneDifference -= getDaylightSavingsOffset(date, new Date()) * 60000; - var convertedDate = this.instance.fire("convertDateByTimezone", date); assert.deepEqual(convertedDate, new Date(date.getTime() + timezoneDifference), "'convertDateByTimezone' works fine");