dir-not-changed-text-input-typing.html (1040B)
1 <!doctype html> 2 <title>:dir() not changed by typing in a text input</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/resources/testdriver.js"></script> 6 <script src="/resources/testdriver-vendor.js"></script> 7 8 <div dir="rtl"> 9 <input type="text"> 10 <textarea></textarea> 11 </div> 12 13 <script> 14 15 promise_test(async () => { 16 const input = document.querySelector("div[dir=rtl] > input"); 17 const textarea = document.querySelector("div[dir=rtl] > textarea"); 18 19 assert_true(input.matches(":dir(rtl)"), "input is RTL before text entered"); 20 assert_true(textarea.matches(":dir(rtl)"), "input is RTL before text entered"); 21 22 await test_driver.send_keys(input, "a"); 23 await test_driver.send_keys(textarea, "a"); 24 25 assert_true(input.matches(":dir(rtl)"), "input is RTL after text entered"); 26 assert_true(textarea.matches(":dir(rtl)"), "input is RTL after text entered"); 27 }, "entering LTR text doesn't change directionality of a text input without dir=auto"); 28 29 </script>