module('DATA-API'); test('DATA-API: data-provide="datepicker" on input; focus', function(){ var input = $('') .appendTo('#qunit-fixture'); input.focus(); ok(input.data('datepicker'), 'datepicker is initialized by "focus" event'); }); test('DATA-API: data-provide="datepicker" on input; click', function(){ var input = $('') .appendTo('#qunit-fixture'); input.click(); ok(input.data('datepicker'), 'datepicker is initialized by "focus" event'); }); test('DATA-API: data-provide="datepicker" on component', function(){ var html, comp; html = '
'+ ''+ '
'; comp = $(html).appendTo('#qunit-fixture'); comp.find('input').focus(); ok(comp.data('datepicker'), 'append component initialized by "focus" event on input'); comp.remove(); comp = $(html).appendTo('#qunit-fixture'); comp.find('input').click(); ok(comp.data('datepicker'), 'append component initialized by "click" event on input'); comp.remove(); comp = $(html).appendTo('#qunit-fixture'); comp.find('.add-on').focus(); ok(comp.data('datepicker'), 'append component initialized by "focus" event on add-on'); comp.remove(); comp = $(html).appendTo('#qunit-fixture'); comp.find('.add-on').click(); ok(comp.data('datepicker'), 'append component initialized by "click" event on add-on'); comp.remove(); html = '
'+ ''+ '
'; comp = $(html).prependTo('#qunit-fixture'); comp.find('input').focus(); ok(comp.data('datepicker'), 'prepend component initialized by "focus" event on input'); comp.remove(); comp = $(html).prependTo('#qunit-fixture'); comp.find('input').click(); ok(comp.data('datepicker'), 'prepend component initialized by "click" event on input'); comp.remove(); comp = $(html).prependTo('#qunit-fixture'); comp.find('.add-on').focus(); ok(comp.data('datepicker'), 'prepend component initialized by "focus" event on add-on'); comp.remove(); comp = $(html).prependTo('#qunit-fixture'); comp.find('.add-on').click(); ok(comp.data('datepicker'), 'prepend component initialized by "click" event on add-on'); comp.remove(); }); test('DATA-API: data-provide="datepicker" on button', function(){ var html, comp; html = '