blob: e3a8afe36c8457c957849fec8036f71e2eda75a6 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div contenteditable></div>
<input></input>
<textarea></textarea>
<script>
description("This tests setting the enterkeyhint attribute on various elements.");
elementsToTest = [document.querySelector("div[contenteditable]"), document.querySelector("input"), document.querySelector("textarea")];
for (var element of elementsToTest) {
debug(`\nTesting: ${element.tagName}\n---`);
shouldBeEqualToString("element.enterKeyHint", "");
shouldBeNull("element.getAttribute('enterKeyHint')");
shouldBeEqualToString("element.enterKeyHint = 'enter'; element.enterKeyHint", "enter");
shouldBeEqualToString("element.getAttribute('enterKeyHint')", "enter");
shouldBeEqualToString("element.setAttribute('enterkeyhint', 'enter'); element.getAttribute('enterkeyhint')", "enter");
shouldBeEqualToString("element.enterKeyHint", "enter");
shouldBeEqualToString("element.enterKeyHint = 'done'; element.enterKeyHint", "done");
shouldBeEqualToString("element.getAttribute('enterKeyHint')", "done");
shouldBeEqualToString("element.setAttribute('enterkeyhint', 'done'); element.getAttribute('enterkeyhint')", "done");
shouldBeEqualToString("element.enterKeyHint", "done");
shouldBeEqualToString("element.enterKeyHint = 'go'; element.enterKeyHint", "go");
shouldBeEqualToString("element.getAttribute('enterKeyHint')", "go");
shouldBeEqualToString("element.setAttribute('enterkeyhint', 'go'); element.getAttribute('enterkeyhint')", "go");
shouldBeEqualToString("element.enterKeyHint", "go");
shouldBeEqualToString("element.enterKeyHint = 'next'; element.enterKeyHint", "next");
shouldBeEqualToString("element.getAttribute('enterKeyHint')", "next");
shouldBeEqualToString("element.setAttribute('enterkeyhint', 'next'); element.getAttribute('enterkeyhint')", "next");
shouldBeEqualToString("element.enterKeyHint", "next");
shouldBeEqualToString("element.enterKeyHint = 'previous'; element.enterKeyHint", "previous");
shouldBeEqualToString("element.getAttribute('enterKeyHint')", "previous");
shouldBeEqualToString("element.setAttribute('enterkeyhint', 'previous'); element.getAttribute('enterkeyhint')", "previous");
shouldBeEqualToString("element.enterKeyHint", "previous");
shouldBeEqualToString("element.enterKeyHint = 'search'; element.enterKeyHint", "search");
shouldBeEqualToString("element.getAttribute('enterKeyHint')", "search");
shouldBeEqualToString("element.setAttribute('enterkeyhint', 'search'); element.getAttribute('enterkeyhint')", "search");
shouldBeEqualToString("element.enterKeyHint", "search");
shouldBeEqualToString("element.enterKeyHint = 'send'; element.enterKeyHint", "send");
shouldBeEqualToString("element.getAttribute('enterKeyHint')", "send");
shouldBeEqualToString("element.setAttribute('enterkeyhint', 'send'); element.getAttribute('enterkeyhint')", "send");
shouldBeEqualToString("element.enterKeyHint", "send");
shouldBeEqualToString("element.enterKeyHint = 'SeArch'; element.enterKeyHint", "search");
shouldBeEqualToString("element.getAttribute('enterKeyHint')", "SeArch");
shouldBeEqualToString("element.setAttribute('enterkeyhint', 'SeArch'); element.getAttribute('enterkeyhint')", "SeArch");
shouldBeEqualToString("element.enterKeyHint", "search");
shouldBeEqualToString("element.enterKeyHint = 'foo'; element.enterKeyHint", "");
shouldBeEqualToString("element.getAttribute('enterKeyHint')", "foo");
shouldBeEqualToString("element.setAttribute('enterkeyhint', 'foo'); element.getAttribute('enterkeyhint')", "foo");
shouldBeEqualToString("element.enterKeyHint", "");
}
</script>
</body>
</html>