Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html

Issue 2450403004: Convert editing/spelling/spellcheck-editable-on-focus.html with spellcheck_test (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698