Пример #1
0
        it('makes date array by supplied dates.', function() {
            var start = new TZDate('2015/05/01'),
                end = new TZDate('2015/05/03'),
                step = dt.MILLISECONDS_PER_DAY;

            var expected = [
                new TZDate('2015/05/01'),
                new TZDate('2015/05/02'),
                new TZDate('2015/05/03')
            ];

            expect(dt.range(start, end, step)).toEqual(expected);
        });
Пример #2
0
        it('step test', function() {
            var start = new TZDate('2015/05/01 09:30:00'),
                end = new TZDate('2015/05/01 18:30:00');

            var expected = [
                new TZDate('2015/05/01 09:30:00'),
                new TZDate('2015/05/01 10:30:00'),
                new TZDate('2015/05/01 11:30:00'),
                new TZDate('2015/05/01 12:30:00'),
                new TZDate('2015/05/01 13:30:00'),
                new TZDate('2015/05/01 14:30:00'),
                new TZDate('2015/05/01 15:30:00'),
                new TZDate('2015/05/01 16:30:00'),
                new TZDate('2015/05/01 17:30:00'),
                new TZDate('2015/05/01 18:30:00')
            ];

            expect(dt.range(start, end, dt.MILLISECONDS_PER_HOUR)).toEqual(expected);
        });
Пример #3
0
    it('can calculate own render range', function() {
        var mockInst = {
            options: {
                renderStartDate: '2015-01-01',
                renderEndDate: '2015-01-05'
            },
            _cacheParentViewModel: {
                range: datetime.range(
                    datetime.start(datetime.parse('2015-01-01')),
                    datetime.end(datetime.parse('2015-01-05')),
                    datetime.MILLISECONDS_PER_DAY
                )
            }
        };
        var actual = Weekday.prototype.getRenderDateRange.call(mockInst);

        expect(actual[0]).toEqualTZDate(new TZDate(2015, 0, 1));
        expect(actual[1]).toEqualTZDate(new TZDate(2015, 0, 2));
        expect(actual[2]).toEqualTZDate(new TZDate(2015, 0, 3));
        expect(actual[3]).toEqualTZDate(new TZDate(2015, 0, 4));
        expect(actual[4]).toEqualTZDate(new TZDate(2015, 0, 5));
    });