[Webkit-unassigned] [Bug 60529] Programmatically set selection should not have direction on Mac

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 12 23:30:22 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=60529





--- Comment #11 from Ryosuke Niwa <rniwa at webkit.org>  2011-07-12 23:30:21 PST ---
(From update of attachment 100621)
View in context: https://bugs.webkit.org/attachment.cgi?id=100621&action=review

>> LayoutTests/editing/selection/programmatic-selection-on-mac-is-directionless.html:60
>> +        testFailed(description + " in " + testId);
> 
> These two should be combined.  e.g.
> if (selection.toString() == expectation)
>     testPassed(description + " in " + testId);
> else
>     testFailed(description + " in " + testId + ' expected "' + expectation + '" but got "' + selection.toString() + '"');

Oops, I misunderstood the logic here.  You can probably do:
var action = description + " in " + testId;
var actualDirection = sel.baseOffset < sel.extentOffset ? 'forward' : (sel.baseOffset > sel.extentOffset ? 'backward' : 'none');
if (expectedDirection != actualDirection)
    testFailed(action + ' expected ' + direction + ' direction but got ' + actualDirection);
else if (selection.toString() != expectedText)
    testFailed(action + expected "' + expectation + '" but got "' + selection.toString() + '"');
else
    testPassed(action);

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list