54
47
right: parent.right
57
maximumDate: new Date(2013, 6, 10)
58
minimumDate: new Date(2013, 2, 10)
59
selectedDate: new Date(2013, 4, 10)
51
selectedDate: new Date()
59
calendar.selectedDate = new Date(2013, 4, 10);
60
calendar.maximumDate = undefined;
61
calendar.minimumDate = undefined;
66
64
function test_collapsed() {
67
calendar.collapsed = true
68
compare(calendar.interactive, false, "Calendar should not be interactive")
69
var collapsedHeight = calendar.height
70
calendar.collapsed = false
71
verify(calendar.height > collapsedHeight * 4 && calendar.height < collapsedHeight * 6, "Height did not expand properly")
72
compare(calendar.interactive, true, "Calendar should be interactive")
65
calendar.collapsed = true;
66
compare(calendar.interactive, false, "Calendar should not be interactive");
67
var collapsedHeight = calendar.height;
68
calendar.collapsed = false;
69
verify(calendar.height > collapsedHeight * 4 && calendar.height < collapsedHeight * 6, "Height did not expand properly");
70
compare(calendar.interactive, true, "Calendar should be interactive");
75
function test_currentDate_data() {
73
function test_selectedDate_data() {
75
{ date: new Date(2010, 4, 10) },
77
{ date: new Date(2020, 10, 31)},
82
function test_currentDate(data) {
83
calendar.currentDate = data.date
84
compare(calendar.currentItem.monthStart.getMonth(), data.date.getMonth(), "currentItem did not change")
81
function test_selectedDate(data) {
82
calendar.selectedDate = data.date;
83
compare(calendar.currentItem.monthStart.getYear(), data.date.getYear(), "Current year does no correspond to set date");
84
compare(calendar.currentItem.monthStart.getMonth(), data.date.getMonth(), "Current month does no correspond to set date");
87
87
function test_firstDayOfWeek_data() {
89
{tag: 'Thursday', firstDayOfWeek: 5, item1: 6},
90
{tag: 'Sunday', firstDayOfWeek: 0, item1: 1},
89
{tag: 'Thursday', firstDayOfWeek: 5},
90
{tag: 'Sunday', firstDayOfWeek: 0},
94
94
function test_firstDayOfWeek(data) {
95
var dayItem1 = UtilsJS.findChild(calendar, "dayItem1")
97
calendar.firstDayOfWeek = data.firstDayOfWeek
98
compare(dayItem1.dayStart.getDay(), data.item1, "Cannot set firstDayOfWeek")
101
function test_maximumDate_data() {
103
{date: date6, count: 5},
104
{date: date5, count: 4},
108
function test_maximumDate(data) {
109
calendar.maximumDate = data.date
110
compare(calendar.count, data.count, "The number of months should have changed")
113
function test_minimumDate_data() {
115
{date: date1, count: 4},
116
{date: date2, count: 3},
120
function test_minimumDate(data) {
121
calendar.minimumDate = data.date
122
compare(calendar.count, data.count, "The number of months should have changed")
125
function test_selectedDate_data() {
132
function test_selectedDate(data) {
133
calendar.selectedDate = data.date
134
compare(calendar.currentItem.monthStart.getMonth(), data.date.getMonth(), "currentItem did not change")
95
calendar.firstDayOfWeek = data.firstDayOfWeek;
97
for (var i = 0; i < (6*7); i++) {
98
var dayColumn = UtilsJS.findChild(calendar, "dayItem" + i);
101
compare(dayColumn.dayStart.getDay(), (data.firstDayOfWeek + i)%7, "Day column does not match expected for firstDayOfWeek");
105
function test_minMaxDate_data() {
107
{tag: "undefined", date: new Date(), minDate: undefined, maxDate: undefined, count: 5}, // max out at +-2
108
{tag: "Min=-0", date: new Date(), minDate: new Date(), maxDate: undefined, count: 3},
109
{tag: "Min=-1", date: new Date(), minDate: new Date().addMonths(-1), maxDate: undefined, count: 4},
110
{tag: "Min=-22", date: new Date(), minDate: new Date().addMonths(-22), maxDate: undefined, count: 5}, // max out at +-2
112
{tag: "Max=+0", date: new Date(), minDate: undefined, maxDate: new Date(), count: 3},
113
{tag: "Max=+1", date: new Date(), minDate: undefined, maxDate: new Date().addMonths(1), count: 4},
114
{tag: "Max=+22", date: new Date(), minDate: undefined, maxDate: new Date().addMonths(22), count: 5}, // max out at +-2
116
{tag: "Min=-0,Max=+0", date: new Date(), minDate: new Date(), maxDate: new Date(), count: 1},
117
{tag: "Min=-1,Max=+1", date: new Date(), minDate: new Date().addMonths(-1), maxDate: new Date().addMonths(1), count: 3},
118
{tag: "Min=-22,Max=+1", date: new Date(), minDate: new Date().addMonths(-22), maxDate: new Date().addMonths(1), count: 4}, // max out at +-2
119
{tag: "Min=-1,Max=+22", date: new Date(), minDate: new Date().addMonths(-1), maxDate: new Date().addMonths(22), count: 4}, // max out at +-2
120
{tag: "Min=-22,Max=+22", date: new Date(), minDate: new Date().addMonths(-22), maxDate: new Date().addMonths(22), count: 5}, // max out at +-2
124
function test_minMaxDate(data) {
125
calendar.selectedDate = data.date;
126
calendar.minimumDate = data.minDate;
127
calendar.maximumDate = data.maxDate;
128
compare(calendar.count, data.count, "The number of months should have changed");