- a/LayoutTests/ChangeLog +21 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2014-01-27  Grzegorz Czajkowski  <g.czajkowski@samsung.com>
2
3
        Refactoring design-mode-spellcheck-off.html to use asynchronous spellchecking
4
        https://bugs.webkit.org/show_bug.cgi?id=127770
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Enable asynchronous spellchecking in design-mode-spellcheck-off.html.
9
10
        Due to js-test-pre.js adds some HTML elements inside the BODY, the misspelled
11
        phrase was moved into separated div element. It allows to check spelling marker
12
        on desired element instead of whole body.
13
14
        It turned out that the test does not underline "asdf" as misspelled although
15
        spellcheck attribute is on. To force spellchecking, the caret needs to be moved
16
        out of the misspelled word. To be more reliable, the test now contains two test
17
        cases in 'desingMode=on' when spellcheck attribute is off and on.
18
19
        * editing/spelling/design-mode-spellcheck-off-expected.txt:
20
        * editing/spelling/design-mode-spellcheck-off.html:
21
1
2014-01-27  Brian Burg  <bburg@apple.com>
22
2014-01-27  Brian Burg  <bburg@apple.com>
2
23
3
        Web Inspector: clean up initialization of managers and observers in InspectorTest
24
        Web Inspector: clean up initialization of managers and observers in InspectorTest
- a/LayoutTests/editing/spelling/design-mode-spellcheck-off-expected.txt -3 / +11 lines
Lines 1-4 a/LayoutTests/editing/spelling/design-mode-spellcheck-off-expected.txt_sec1
1
asdf is misspelled.
1
This tests whether WebKit does not spell check in 'designMode' when spellcheck='false'. To test manually, click arround 'asdf'. There should be no spelling marker for 'asdf' after the click.
2
To test this manually, click "asdf" above. There should be no spelling marker for "asdf" after the click.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
3
5
4
PASS
6
PASS internals.hasSpellingMarker(0, 4) became false
7
document.body.setAttribute("spellcheck", "true")
8
PASS internals.hasSpellingMarker(0, 4) became different from false
9
PASS successfullyParsed is true
10
11
TEST COMPLETE
12
asdf is misspelled.
- a/LayoutTests/editing/spelling/design-mode-spellcheck-off.html -23 / +35 lines
Lines 1-39 a/LayoutTests/editing/spelling/design-mode-spellcheck-off.html_sec1
1
<!DOCTYPE html>
1
<!DOCTYPE html>
2
<html>
2
<html>
3
<body spellcheck="false"> 
3
<head>
4
asdf is misspelled.
4
<script src="../editing.js"></script>
5
<p>To test this manually, click "asdf" above. There should be no spelling marker for "asdf" after the click.</p>
5
</head>
6
<body spellcheck="false">
7
<script src="../../resources/js-test-pre.js"></script>
8
<div id="misspelled" onmouseup="checkSpellingMarker()">asdf is misspelled.</div>
6
<script>
9
<script>
10
description("This tests whether WebKit does not spell check in 'designMode' "
11
    + "when spellcheck='false'. To test manually, click arround 'asdf'. "
12
    + "There should be no spelling marker for 'asdf' after the click.");
7
13
8
if (window.testRunner)
14
jsTestIsAsync = true;
9
    testRunner.dumpAsText();
15
16
if (window.internals) {
17
    internals.settings.setUnifiedTextCheckerEnabled(true);
18
    internals.settings.setAsynchronousSpellCheckingEnabled(true);
19
}
10
20
11
document.designMode = "on";
21
document.designMode = "on";
12
22
13
if (document.activeElement != document.body)
23
function checkSpellingMarker()
14
    document.body.appendChild(document.createTextNode('FAIL: active element before click is not body element'));
24
{
15
else if (window.testRunner && window.eventSender) {
25
    if (!window.internals)
16
    testRunner.waitUntilDone();
26
        return;
17
27
18
    document.body.addEventListener('mousedown', function() {
28
    // First, verify spelling with spellcheck attribute off.
19
        if (document.activeElement != document.body)
29
    // Move selection to the next word to notify WebKit that "asdf" has been typed/changed
20
            document.body.appendChild(document.createTextNode('FAIL: active element after click is not body element'));
30
    // to give a chance to spellcheck.
21
        else if (internals.hasSpellingMarker(0, 4))
31
    moveSelectionForwardByWordCommand();
22
            document.body.appendChild(document.createTextNode('FAIL: spell check was invoked'));
32
    shouldBecomeEqual('internals.hasSpellingMarker(0, 4)', 'false', function() {
23
        else
33
        evalAndLog('document.body.setAttribute("spellcheck", "true")');
24
            document.body.appendChild(document.createTextNode('PASS'));
34
        // Do any selection change to force spellchecking after attribute change.
25
        testRunner.notifyDone();
35
        moveSelectionForwardByLineCommand();
36
        shouldBecomeDifferent('internals.hasSpellingMarker(0, 4)', 'false', finishJSTest);
26
    });
37
    });
38
}
27
39
28
    var x = document.body.offsetLeft + 10;
40
if (window.eventSender) {
29
    var y = document.body.offsetTop + 10;
41
    var misspelledDiv = document.getElementById("misspelled");
42
    var x = misspelledDiv.offsetLeft;
43
    var y = misspelledDiv.offsetTop;
30
    eventSender.mouseMoveTo(x, y);
44
    eventSender.mouseMoveTo(x, y);
31
    eventSender.mouseDown();
45
    eventSender.mouseDown();
32
    eventSender.mouseUp();
46
    eventSender.mouseUp();
33
    setTimeout("testRunner.notifyDone();document.body.appendChild(document.createTextNode('FAIL: timeout'));", 500);
47
}
34
} else
35
    document.body.appendChild(document.createTextNode('PASS'));
36
37
</script> 
48
</script> 
49
<script src="../../resources/js-test-post.js"></script>
38
</body>
50
</body>
39
</html>
51
</html>

Return to Bug 127770