| | 97 | // Inline |
| | 98 | var inl = init('#inl'); |
| | 99 | ok(inl.is('.hasDatepicker'), 'Inline - marker class set'); |
| | 100 | ok(inl.html() != '', 'Inline - datepicker present'); |
| | 101 | ok($.data(inl[0], PROP_NAME), 'Inline - instance present'); |
| | 102 | ok(inl.next().length == 0 || inl.next().is('p'), 'Inline - button absent'); |
| | 103 | inl.datepicker('destroy'); |
| | 104 | inl = $('#inl'); |
| | 105 | ok(!inl.is('.hasDatepicker'), 'Inline - marker class cleared'); |
| | 106 | ok(inl.html() == '', 'Inline - datepicker absent'); |
| | 107 | ok(!$.data(inl[0], PROP_NAME), 'Inline - instance absent'); |
| | 108 | ok(inl.next().length == 0 || inl.next().is('p'), 'Inline - button absent'); |
| | 291 | // Inline |
| | 292 | var inl = init('#inl'); |
| | 293 | dp = inl.children(); |
| | 294 | ok(dp.is('.ui-datepicker-inline'), 'Structure inline - main div'); |
| | 295 | ok(!dp.is('.ui-datepicker-rtl'), 'Structure inline - not right-to-left'); |
| | 296 | ok(!dp.is('.ui-datepicker-multi'), 'Structure inline - not multi-month'); |
| | 297 | equals(dp.children().length, 3, 'Structure inline - child count'); |
| | 298 | var links = dp.children(':first'); |
| | 299 | ok(links.is('div.ui-datepicker-links'), 'Structure inline - links division'); |
| | 300 | equals(links.children().length, 3, 'Structure inline - links child count'); |
| | 301 | var month = dp.children(':eq(1)'); |
| | 302 | ok(month.is('div.ui-datepicker-one-month') && month.is('div.ui-datepicker-new-row'), |
| | 303 | 'Structure inline - month division'); |
| | 304 | var header = month.children(':first'); |
| | 305 | ok(header.is('div.ui-datepicker-header'), 'Structure inline - month header division'); |
| | 306 | equals(header.children().length, 2, 'Structure inline - month header child count'); |
| | 307 | var table = month.children(':eq(1)'); |
| | 308 | ok(table.is('table.ui-datepicker'), 'Structure inline - month table'); |
| | 309 | ok(table.children(':first').is('thead'), 'Structure inline - month table thead'); |
| | 310 | ok(table.children(':eq(1)').is('tbody'), 'Structure inline - month table body'); |
| | 311 | ok(dp.children('.ui-datepicker-status').length == 0, 'Structure inline - status'); |
| | 312 | inl.datepicker('destroy'); |
| | 313 | // Inline multi-month |
| | 314 | inl = init('#inl', {numberOfMonths: 2}); |
| | 315 | dp = inl.children(); |
| | 316 | ok(dp.is('.ui-datepicker-inline'), 'Structure inline multi - main div'); |
| | 317 | ok(dp.is('.ui-datepicker-multi'), 'Structure inline multi - not multi-month'); |
| | 318 | equals(dp.children().length, 4, 'Structure inline multi - child count'); |
| | 319 | var links = dp.children(':first'); |
| | 320 | ok(links.is('div.ui-datepicker-links'), 'Structure inline multi - links division'); |
| | 321 | equals(links.children().length, 3, 'Structure inline multi - links child count'); |
| | 322 | var month = dp.children(':eq(1)'); |
| | 323 | ok(month.is('div.ui-datepicker-one-month') && month.is('div.ui-datepicker-new-row'), |
| | 324 | 'Structure inline multi - first month division'); |
| | 325 | month = dp.children(':eq(2)'); |
| | 326 | ok(month.is('div.ui-datepicker-one-month') && !month.is('div.ui-datepicker-new-row'), |
| | 327 | 'Structure inline multi - second month division'); |
| | 328 | inl.datepicker('destroy'); |
| | 424 | // Inline |
| | 425 | var inl = init('#inl', {showStatus: true, hideIfNoPrevNext: true, |
| | 426 | minDate: new Date(2008, 2 - 1, 4), maxDate: new Date(2008, 2 - 1, 14)}); |
| | 427 | dp = inl.children(); |
| | 428 | ok(dp.is('.ui-datepicker-inline'), 'Structure inline - main div'); |
| | 429 | ok(!dp.is('.ui-datepicker-rtl'), 'Structure inline - not right-to-left'); |
| | 430 | ok(!dp.is('.ui-datepicker-multi'), 'Structure inline - not multi-month'); |
| | 431 | equals(dp.children().length, 5, 'Structure inline - child count'); |
| | 432 | var links = dp.children(':first'); |
| | 433 | ok(links.is('div.ui-datepicker-links'), 'Structure inline - links division'); |
| | 434 | equals(links.children().children().length, 0, 'Structure inline - links child count'); |
| | 435 | var month = dp.children(':eq(1)'); |
| | 436 | ok(month.is('div.ui-datepicker-one-month') && month.is('div.ui-datepicker-new-row'), |
| | 437 | 'Structure inline - month division'); |
| | 438 | ok(dp.children(':last').prev().is('div.ui-datepicker-status'), |
| | 439 | 'Structure inline - status'); |
| | 440 | inl.datepicker('destroy'); |
| | 677 | // Inline |
| | 678 | var inl = init('#inl'); |
| | 679 | var dp = $('.ui-datepicker-inline', inl); |
| | 680 | var date = new Date(); |
| | 681 | inl.datepicker('setDate', date); |
| | 682 | $('.ui-datepicker tbody a:contains(10)', dp).simulate('click', {}); |
| | 683 | date.setDate(10); |
| | 684 | equalsDate(inl.datepicker('getDate'), date, 'Mouse click inline'); |
| | 685 | inl.datepicker('setDate', new Date(2008, 2 - 1, 4)); |
| | 686 | $('.ui-datepicker tbody a:contains(12)', dp).simulate('click', {}); |
| | 687 | equalsDate(inl.datepicker('getDate'), new Date(2008, 2 - 1, 12), |
| | 688 | 'Mouse click inline - preset'); |
| | 689 | $('.ui-datepicker-current a', dp).simulate('click', {}); |
| | 690 | $('.ui-datepicker tbody a:contains(14)', dp).simulate('click', {}); |
| | 691 | date.setDate(14); |
| | 692 | equalsDate(inl.datepicker('getDate'), date, 'Mouse click inline - current'); |
| | 693 | inl.datepicker('setDate', new Date(2008, 2 - 1, 4)); |
| | 694 | $('.ui-datepicker-prev a', dp).simulate('click', {}); |
| | 695 | $('.ui-datepicker tbody a:contains(16)', dp).simulate('click', {}); |
| | 696 | equalsDate(inl.datepicker('getDate'), new Date(2008, 1 - 1, 16), |
| | 697 | 'Mouse click inline - previous'); |
| | 698 | inl.datepicker('setDate', new Date(2008, 2 - 1, 4)); |
| | 699 | $('.ui-datepicker-next a', dp).simulate('click', {}); |
| | 700 | $('.ui-datepicker tbody a:contains(18)', dp).simulate('click', {}); |
| | 701 | equalsDate(inl.datepicker('getDate'), new Date(2008, 3 - 1, 18), |
| | 702 | 'Mouse click inline - next'); |
| | 936 | // Inline |
| | 937 | var inl = init('#inl'); |
| | 938 | var date1 = new Date(2008, 6 - 1, 4); |
| | 939 | var date2 = new Date(); |
| | 940 | equalsDate(inl.datepicker('getDate'), date2, 'Set date inline - default'); |
| | 941 | inl.datepicker('setDate', date1); |
| | 942 | equalsDate(inl.datepicker('getDate'), date1, 'Set date inline - 2008-06-04'); |
| | 943 | date1 = new Date(); |
| | 944 | date1.setDate(date1.getDate() + 7); |
| | 945 | inl.datepicker('setDate', +7); |
| | 946 | equalsDate(inl.datepicker('getDate'), date1, 'Set date inline - +7'); |
| | 947 | date2.setFullYear(date2.getFullYear() + 2); |
| | 948 | inl.datepicker('setDate', '+2y'); |
| | 949 | equalsDate(inl.datepicker('getDate'), date2, 'Set date inline - +2y'); |
| | 950 | inl.datepicker('setDate', date1, date2); |
| | 951 | equalsDate(inl.datepicker('getDate'), date1, 'Set date inline - two dates'); |
| | 952 | inl.datepicker('setDate'); |
| | 953 | ok(inl.datepicker('getDate') == null, 'Set date inline - null'); |
| | 1045 | // Inline |
| | 1046 | var inl = init('#inl', {rangeSelect: true}); |
| | 1047 | var dp = $('.ui-datepicker-inline', inl); |
| | 1048 | date1 = new Date(); |
| | 1049 | date1.setDate(12); |
| | 1050 | date2 = new Date(); |
| | 1051 | date2.setDate(19); |
| | 1052 | $('.ui-datepicker tbody a:contains(12)', dp).simulate('click', {}); |
| | 1053 | $('.ui-datepicker tbody a:contains(12)', dp).simulate('click', {}); |
| | 1054 | equalsDateArray(inl.datepicker('getDate'), [date1, date1], |
| | 1055 | 'Range inline - same day'); |
| | 1056 | $('.ui-datepicker tbody a:contains(12)', dp).simulate('click', {}); |
| | 1057 | $('.ui-datepicker tbody a:contains(10)', dp).simulate('click', {}); // Doesn't select |
| | 1058 | equalsDateArray(inl.datepicker('getDate'), [date1, date1], |
| | 1059 | 'Range inline - prev'); |
| | 1060 | $('.ui-datepicker tbody a:contains(12)', dp).simulate('click', {}); // Selects |
| | 1061 | inl.datepicker('setDate', date1); |
| | 1062 | $('.ui-datepicker tbody a:contains(12)', dp).simulate('click', {}); |
| | 1063 | $('.ui-datepicker tbody a:contains(19)', dp).simulate('click', {}); |
| | 1064 | equalsDateArray(inl.datepicker('getDate'), [date1, date2], |
| | 1065 | 'Range inline - next'); |