TrainSignManage/WebFrame/bower_components/bootstrap-datepicker/tests/suites/events.js

(开头部分) 14KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

module('Events on initialization', {
    setup: function(){
        this.input = $('<input type="text" value="31-03-2011">')
            .appendTo('#qunit-fixture')
    }
});

test('When initializing the datepicker, it should trigger no change or changeDate events', function(){
    var triggered_change = 0,
        triggered_changeDate = 0;

    this.input.on({
        change: function(){
            triggered_change++;
        },
        changeDate: function(){
            triggered_changeDate++;
        }
    });

    this.input.datepicker({format: 'dd-mm-yyyy'});

    equal(triggered_change, 0);
    equal(triggered_changeDate, 0);
});

module('Events', {
    setup: function(){
        this.input = $('<input type="text" value="31-03-2011">')
                        .appendTo('#qunit-fixture')
                        .datepicker({format: "dd-mm-yyyy"})
                        .focus(); // Activate for visibility checks
        this.dp = this.input.data('datepicker');
        this.picker = this.dp.picker;
    },
    teardown: function(){
        this.picker.remove();
    }
});

test('Selecting a year from decade view triggers changeYear', function(){
    var target,
        triggered = 0;

    this.input.on('changeYear', function(){
        triggered++;
    });

    equal(this.dp.viewMode, 0);
    target = this.picker.find('.datepicker-days thead th.datepicker-switch');
    ok(target.is(':visible'), 'View switcher is visible');

    target.click();
    ok(this.picker.find('.datepicker-months').is(':visible'), 'Month picker is visible');
    equal(this.dp.viewMode, 1);
    // Not modified when switching modes
    datesEqual(this.dp.viewDate, UTCDate(2011, 2, 31));
    datesEqual(this.dp.dates[0], UTCDate(2011, 2, 31));

    target = this.picker.find('.datepicker-months thead th.datepicker-switch');
后面还有 447 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。