Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix step validation test for <input type="month">
Per https://html.spec.whatwg.org/multipage/#month-state-(type=month):attr-input-step and https://html.spec.whatwg.org/multipage/#month-state-(type=month):concept-input-value-string-number and https://html.spec.whatwg.org/multipage/#the-step-attribute , an <input type="month"> suffers from a step mismatch when the difference (in months) between the selected month and January 1970 is not an integral multiple of the step value. Old broken test: <input> validity expectation: Invalid step = 2 value = 2001-March "months since Jan 1970" = (2001-1970)*(12 months/year) + (January - March) = 31*12 + 2 = 374 374 % 2 = 0 ➡️️ Valid Valid ≠ Invalid ❌ Fail! Corrected test: <input> validity expectation: Invalid step = 3 value = 2001-February "months since Jan 1970" = (2001-1970)*(12 months/year) + (January - February) = 31*12 + 1 = 373 373 % 3 = 1 ➡️️ Invalid Invalid == Invalid ✅ Pass.
- Loading branch information