| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../resources/accessibility-helper.js"></script> |
| <script src="../../resources/js-test.js"></script> |
| </head> |
| <body> |
| |
| <form> |
| <input id="number" type="number"> |
| </form> |
| |
| <script> |
| var output = "This tests that input type='number' exposes the accessibility of it's stepper correctly\n\n"; |
| |
| if (window.accessibilityController) { |
| window.jsTestIsAsync = true; |
| |
| document.getElementById("number").focus(); |
| window.textfield = accessibilityController.accessibleElementById("number"); |
| |
| setTimeout(async function() { |
| // Verify that the click point is the same as the child. |
| output += expect("textfield.childrenCount", "1"); |
| |
| window.incrementor = textfield.childAtIndex(0); |
| |
| output += expect("incrementor.role", "'AXRole: AXIncrementor'"); |
| output += expect("incrementor.width > 0", "true"); |
| output += expect("incrementor.height > 0", "true"); |
| output += expect("incrementor.childrenCount", "2"); |
| |
| output += expect("incrementor.childAtIndex(0).role", "'AXRole: AXIncrementorArrow'"); |
| output += expect("incrementor.childAtIndex(0).subrole", "'AXSubrole: AXIncrementArrow'"); |
| output += expect("incrementor.childAtIndex(0).width > 0", "true"); |
| output += expect("incrementor.childAtIndex(0).height > 0", "true"); |
| output += expect("incrementor.childAtIndex(0).isEnabled", "true"); |
| |
| // Increment. |
| incrementor.childAtIndex(0).press(); |
| output += await expectAsync("textfield.stringValue", "'AXValue: 1'"); |
| // FIXME: This shouldn't be necessary, but we must re-get the spinbutton incrementor because we throw the old |
| // one and it's children away every time the text field clears and re-adds children. This work is tracked by: |
| // https://bugs.webkit.org/show_bug.cgi?id=262664 |
| window.incrementor = textfield.childAtIndex(0); |
| output += expect("incrementor.childAtIndex(1).role", "'AXRole: AXIncrementorArrow'"); |
| output += expect("incrementor.childAtIndex(1).subrole", "'AXSubrole: AXDecrementArrow'"); |
| output += expect("incrementor.childAtIndex(1).width > 0", "true"); |
| output += expect("incrementor.childAtIndex(1).height > 0", "true"); |
| output += expect("incrementor.childAtIndex(1).isEnabled", "true"); |
| |
| // Decrement. |
| incrementor.childAtIndex(1).press(); |
| output += await expectAsync("textfield.stringValue", "'AXValue: 0'"); |
| debug(output); |
| finishJSTest(); |
| }, 0); |
| } |
| </script> |
| </body> |
| </html> |