Skip to content

Commit

Permalink
Iterate in checkMonthAndYear
Browse files Browse the repository at this point in the history
  • Loading branch information
wehriam committed Nov 19, 2016
1 parent d632db5 commit 796c387
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions test/core.test.jsx
Expand Up @@ -629,17 +629,18 @@ describe("Date Picker", function() {
TestUtils.Simulate.change(inputElement);
TestUtils.Simulate.focus(inputElement);
const weekElements = document.querySelectorAll("table tbody tr");
weekElements.forEach(weekElement => {
const dayElements = weekElement.querySelectorAll("td");
dayElements.forEach((dayElement, index) => {
for(let i = 0; i < weekElements.length; i++) {
const dayElements = weekElements[i].querySelectorAll("td");
for(let j = 0; j < dayElements.length; j++) {
const dayElement = dayElements[j];
if(dayElement.innerHTML === '') {
return;
}
TestUtils.Simulate.click(dayElement);
let date = new Date(hiddenInputElement.value);
assert.equal(date.getDay(), index);
});
});
assert.equal(date.getDay(), j);
}
}
}
const today = new Date();
for(let year = today.getFullYear() - 2; year < today.getFullYear() + 2; year++) {
Expand Down Expand Up @@ -677,17 +678,18 @@ describe("Date Picker", function() {
TestUtils.Simulate.change(inputElement);
TestUtils.Simulate.focus(inputElement);
const weekElements = document.querySelectorAll("table tbody tr");
weekElements.forEach(weekElement => {
const dayElements = weekElement.querySelectorAll("td");
dayElements.forEach((dayElement, index) => {
for(let i = 0; i < weekElements.length; i++) {
const dayElements = weekElements[i].querySelectorAll("td");
for(let j = 0; j < dayElements.length; j++) {
const dayElement = dayElements[j];
if(dayElement.innerHTML === '') {
return;
}
TestUtils.Simulate.click(dayElement);
let date = new Date(hiddenInputElement.value);
assert.equal(date.getDay(), index === 6 ? 0 : index + 1);
});
});
assert.equal(date.getDay(), j === 6 ? 0 : j + 1);
}
}
}
const today = new Date();
for(let year = today.getFullYear() - 2; year < today.getFullYear() + 2; year++) {
Expand Down

0 comments on commit 796c387

Please sign in to comment.