Skip to content

Commit 796c387

Browse files
committed
Iterate in checkMonthAndYear
1 parent d632db5 commit 796c387

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

test/core.test.jsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -629,17 +629,18 @@ describe("Date Picker", function() {
629629
TestUtils.Simulate.change(inputElement);
630630
TestUtils.Simulate.focus(inputElement);
631631
const weekElements = document.querySelectorAll("table tbody tr");
632-
weekElements.forEach(weekElement => {
633-
const dayElements = weekElement.querySelectorAll("td");
634-
dayElements.forEach((dayElement, index) => {
632+
for(let i = 0; i < weekElements.length; i++) {
633+
const dayElements = weekElements[i].querySelectorAll("td");
634+
for(let j = 0; j < dayElements.length; j++) {
635+
const dayElement = dayElements[j];
635636
if(dayElement.innerHTML === '') {
636637
return;
637638
}
638639
TestUtils.Simulate.click(dayElement);
639640
let date = new Date(hiddenInputElement.value);
640-
assert.equal(date.getDay(), index);
641-
});
642-
});
641+
assert.equal(date.getDay(), j);
642+
}
643+
}
643644
}
644645
const today = new Date();
645646
for(let year = today.getFullYear() - 2; year < today.getFullYear() + 2; year++) {
@@ -677,17 +678,18 @@ describe("Date Picker", function() {
677678
TestUtils.Simulate.change(inputElement);
678679
TestUtils.Simulate.focus(inputElement);
679680
const weekElements = document.querySelectorAll("table tbody tr");
680-
weekElements.forEach(weekElement => {
681-
const dayElements = weekElement.querySelectorAll("td");
682-
dayElements.forEach((dayElement, index) => {
681+
for(let i = 0; i < weekElements.length; i++) {
682+
const dayElements = weekElements[i].querySelectorAll("td");
683+
for(let j = 0; j < dayElements.length; j++) {
684+
const dayElement = dayElements[j];
683685
if(dayElement.innerHTML === '') {
684686
return;
685687
}
686688
TestUtils.Simulate.click(dayElement);
687689
let date = new Date(hiddenInputElement.value);
688-
assert.equal(date.getDay(), index === 6 ? 0 : index + 1);
689-
});
690-
});
690+
assert.equal(date.getDay(), j === 6 ? 0 : j + 1);
691+
}
692+
}
691693
}
692694
const today = new Date();
693695
for(let year = today.getFullYear() - 2; year < today.getFullYear() + 2; year++) {

0 commit comments

Comments
 (0)