haikuwebkit/LayoutTests/accessibility/mac/replace-text-with-range-val...

47 lines
2.4 KiB
Plaintext
Raw Permalink Normal View History

AX: accessibilityReplaceRange:withText: doesn't post an AXValueChanged notification like when typing with kb https://bugs.webkit.org/show_bug.cgi?id=208332 <rdar://problem/58489685> Patch by Canhai Chen <canhai_chen@apple.com> on 2020-03-11 Reviewed by Chris Fleizach. Source/WebCore: When accessibilityReplaceRange:withText: is called to insert or replace text, there should be a AXValueChanged notification posted with the correct user info to notify the AX client that the text value has been changed with detailed info about the change. Post a notification in Editor::replaceSelectionWithFragment for EditAction::Insert edit type with replaced text and selection. Add a new test for text replacement value change notification in editable div, text input, and textarea, including direct text insertion and replace-and-insert. Test: accessibility/mac/replace-text-with-range-value-change-notification.html * editing/Editor.cpp: (WebCore::Editor::replaceSelectionWithFragment): * editing/ReplaceSelectionCommand.h: (WebCore::ReplaceSelectionCommand::documentFragmentPlainText const): LayoutTests: Test text replacement value change notification in editable div, text input, and textarea, including direct text insertion and replace-and-insert. * accessibility/mac/replace-text-with-range-value-change-notification-expected.txt: Added. * accessibility/mac/replace-text-with-range-value-change-notification.html: Added. Canonical link: https://commits.webkit.org/221875@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258303 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-12 01:22:09 +00:00
This tests that when we are calling the replace with range API to insert or replace text, value change notifications are posted as expected with correct user info data.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS addedNotification is true
PASS axContentEditableDiv.replaceTextInRange('Apple', 0, 0) is true
PASS axContentEditableDiv.stringValue is 'AXValue: Apple'
PASS axContentEditableDiv.replaceTextInRange('Pie', 0, 5) is true
PASS axContentEditableDiv.stringValue is 'AXValue: Pie'
PASS axText.replaceTextInRange('Banana', 0, 0) is true
PASS axText.stringValue is 'AXValue: Banana'
PASS axText.replaceTextInRange('Ice-cream', 0, 6) is true
PASS axText.stringValue is 'AXValue: Ice-cream'
PASS axTextarea.replaceTextInRange('Cat', 0, 0) is true
PASS axTextarea.stringValue is 'AXValue: Cat'
PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
PASS actualEditTypes[resultIndex] is "Insert"
PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
PASS actualChangeValues[resultIndex][0] is expectedValues[resultIndex][0]
PASS actualEditTypes[resultIndex][0] is "Delete"
PASS actualChangeValues[resultIndex][1] is expectedValues[resultIndex][1]
PASS actualEditTypes[resultIndex][1] is "Insert"
PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
PASS actualEditTypes[resultIndex] is "Insert"
PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
PASS actualChangeValues[resultIndex][0] is expectedValues[resultIndex][0]
PASS actualEditTypes[resultIndex][0] is "Delete"
PASS actualChangeValues[resultIndex][1] is expectedValues[resultIndex][1]
PASS actualEditTypes[resultIndex][1] is "Insert"
PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
PASS actualEditTypes[resultIndex] is "Insert"
PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
PASS actualChangeValues[resultIndex][0] is expectedValues[resultIndex][0]
PASS actualEditTypes[resultIndex][0] is "Delete"
PASS actualChangeValues[resultIndex][1] is expectedValues[resultIndex][1]
PASS actualEditTypes[resultIndex][1] is "Insert"
PASS axTextarea.replaceTextInRange('Dog', 0, 3) is true
PASS axTextarea.stringValue is 'AXValue: Dog'
PASS successfullyParsed is true
TEST COMPLETE