| Index: third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html
|
| diff --git a/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html
|
| index eed65a460e3aa03f2b9fcb8161ac7d9d92f1e458..15030cd7f71a5e2d46dbb768de8ec7ba9d46fa90 100644
|
| --- a/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html
|
| +++ b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html
|
| @@ -1,61 +1,46 @@
|
| -<!DOCTYPE html>
|
| -<html>
|
| -<head>
|
| -<script src="../editing.js"></script>
|
| -<script src="resources/util.js"></script>
|
| -<script src="../../resources/js-test.js"></script>
|
| -</head>
|
| -<body>
|
| -<div id="container">
|
| - <div id="test_editable" contentEditable>zz zz zz.</div>
|
| - <textarea id="test_textarea">zz zz zz.</textarea>
|
| - <input type="text" id="test_textfield" value="zz zz zz."></input>
|
| -</div>
|
| -<script>
|
| -description("Spell checking should be triggered on focus of an editable. "
|
| - + "To test manually, set focus on above elements. The test succeed if "
|
| - + "misspellings are marked.");
|
| -
|
| -jsTestIsAsync = true;
|
| -if (window.testRunner)
|
| - testRunner.setMockSpellCheckerEnabled(true);
|
| -
|
| -function findFirstTextNodeOf(id) {
|
| - return findFirstTextNode(document.getElementById(id));
|
| -}
|
| -
|
| -var expectedNumberOfMarkers = "0";
|
| -function checkMarkersFor(elementID, doFocus, continuation) {
|
| - var element = document.getElementById(elementID);
|
| - if (doFocus)
|
| - element.focus();
|
| - shouldBecomeEqual('internals.markerCountForNode(findFirstTextNodeOf("' + elementID + '"), "spelling")', expectedNumberOfMarkers, continuation);
|
| -}
|
| +<!doctype html>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +<script src="../assert_selection.js"></script>
|
| +<script src="spellcheck_test.js"></script>
|
|
|
| -function verifySpellingMarkers(doFocus, doneCallback) {
|
| - checkMarkersFor('test_editable', doFocus, function () {
|
| - checkMarkersFor('test_textarea', doFocus, function () {
|
| - checkMarkersFor('test_textfield', doFocus, function () {
|
| - doneCallback && doneCallback();
|
| - // After focusing the editable elements, check whether they have spelling markers.
|
| - expectedNumberOfMarkers = "3";
|
| - verifySpellingMarkers(true, finishJSTest);
|
| - });
|
| - });
|
| +<script>
|
| +spellcheck_test(
|
| + '<div contenteditable>zz zz zz.</div>',
|
| + '',
|
| + '<div contenteditable>zz zz zz.</div>',
|
| + {
|
| + title: 'Misspelled text in editable DIV is not marked before focused.',
|
| + callback: sample => spellcheck_test(
|
| + sample,
|
| + document => document.querySelector('div').focus(),
|
| + '<div contenteditable>#zz# #zz# #zz#.</div>',
|
| + 'Spellchecking in editable DIV triggered on focus.')
|
| });
|
| -}
|
|
|
| -function test() {
|
| - if (!window.internals) {
|
| - debug("Automatic testing impossible. Test manually.");
|
| - return;
|
| - }
|
| +spellcheck_test(
|
| + '<textarea>zz zz zz.</textarea>',
|
| + '',
|
| + '<textarea>zz zz zz.</textarea>',
|
| + {
|
| + title: 'Misspelled text in TEXTAREA is not marked before focused.',
|
| + callback: sample => spellcheck_test(
|
| + sample,
|
| + document => document.querySelector('textarea').focus(),
|
| + '<textarea>#zz# #zz# #zz#.</textarea>',
|
| + 'Spellchecking in TEXTAREA triggered on focus.')
|
| + });
|
|
|
| - // Check whether non-focused elements do not have spelling markers, then
|
| - // verify them when they get focused.
|
| - verifySpellingMarkers(false);
|
| -}
|
| -test();
|
| +spellcheck_test(
|
| + '<input value="zz zz zz.">',
|
| + '',
|
| + '<input value="zz zz zz.">',
|
| + {
|
| + title: 'Misspelled text in INPUT is not marked before focused.',
|
| + callback: sample => spellcheck_test(
|
| + sample,
|
| + document => document.querySelector('input').focus(),
|
| + '<input value="#zz# #zz# #zz#.">',
|
| + 'Spellchecking in INPUT triggered on focus.')
|
| + });
|
| </script>
|
| -</body>
|
| -</html>
|
|
|