4 <script src=
"../../../resources/js-test.js"></script>
5 <script src=
"../resources/common.js"></script>
9 description('Check stepping-up and -down for week input fields from renderer.');
10 if (!window
.eventSender
)
11 debug('This test requires eventSender.');
13 var input
= document
.createElement('input');
15 document
.body
.appendChild(input
);
17 function setInputAttributes(value
, min
, max
) {
23 function stepUp(value
, min
, max
) {
24 setInputAttributes(value
, min
, max
);
25 eventSender
.keyDown('upArrow');
29 function stepDown(value
, min
, max
) {
30 setInputAttributes(value
, min
, max
);
31 eventSender
.keyDown('downArrow');
36 debug('Function arguments are (value, min, max).');
38 shouldBeEqualToString('stepUp("2000-W05", "2000-W05", "2000-W40")', '2000-W06');
39 shouldBeEqualToString('stepDown("2000-W05", "2000-W05", "2000-W40")', '2000-W40');
40 shouldBeEqualToString('stepUp("2000-W05", "2000-W02", "2000-W05")', '2000-W02');
41 shouldBeEqualToString('stepDown("2000-W05", "2000-W02", "2000-W05")', '2000-W04');
42 shouldBeEqualToString('stepUp("2000-W05", "2000-W08", "2000-W10")', '2000-W08');
43 shouldBeEqualToString('stepDown("2000-W05", "2000-W08", "2000-W10")', '2000-W10');
44 shouldBeEqualToString('stepUp("2000-W05", "2000-W03", "2000-W03")', '2000-W03');
45 shouldBeEqualToString('stepDown("2000-W05", "2000-W03", "2000-W03")', '2000-W03');
46 shouldBeEqualToString('stepUp("2000-W05", "2000-W03", "2001-W05")', '2000-W06');
47 shouldBeEqualToString('stepDown("2000-W05", "2000-W05", "2001-W08")', '2000-W04');
50 eventSender
.keyDown('rightArrow');
51 shouldBeEqualToString('stepUp("2000-W01", "2000-W01", "2009-W52")', '2001-W01');
52 shouldBeEqualToString('stepDown("2000-W01", "2000-W01", "2009-W52")', '2009-W01');
53 shouldBeEqualToString('stepUp("2000-W01", "1990-W01", "2000-W52")', '1990-W01');
54 shouldBeEqualToString('stepDown("2000-W01", "1990-W01", "2000-W52")', '1999-W01');
55 shouldBeEqualToString('stepUp("275760-W01", "1990-W01", null)', '1990-W01');
56 shouldBeEqualToString('stepDown("1990-W01", "1990-W01", null)', '275760-W01');
57 shouldBeEqualToString('stepUp("2000-W01", null, "2000-W52")', '0001-W01');
58 shouldBeEqualToString('stepDown("0001-W01", null, "2000-W52")', '2000-W01');
59 shouldBeEqualToString('stepUp("1990-W01", "2000-W01", "2009-W52")', '2000-W01');
60 shouldBeEqualToString('stepDown("1990-W01", "2000-W01", "2009-W52")', '2009-W01');
61 shouldBeEqualToString('stepUp("2020-W01", "2000-W01", "2000-W52")', '2000-W01');
62 shouldBeEqualToString('stepDown("2020-W01", "2000-W01", "2000-W52")', '2000-W01');