зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1649217 - Part 4: Update caret move event tests to support isSelectionCollapsed. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D81914
This commit is contained in:
Родитель
970939c823
Коммит
65ed33dc4e
|
@ -1659,12 +1659,12 @@ function moveToLineEnd(aID, aCaretOffset) {
|
||||||
aID,
|
aID,
|
||||||
"VK_RIGHT",
|
"VK_RIGHT",
|
||||||
{ metaKey: true },
|
{ metaKey: true },
|
||||||
new caretMoveChecker(aCaretOffset, aID)
|
new caretMoveChecker(aCaretOffset, true, aID)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.__proto__ = new synthEndKey(
|
this.__proto__ = new synthEndKey(
|
||||||
aID,
|
aID,
|
||||||
new caretMoveChecker(aCaretOffset, aID)
|
new caretMoveChecker(aCaretOffset, true, aID)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1679,7 +1679,7 @@ function moveToLineEnd(aID, aCaretOffset) {
|
||||||
function moveToPrevLineEnd(aID, aCaretOffset) {
|
function moveToPrevLineEnd(aID, aCaretOffset) {
|
||||||
this.__proto__ = new synthAction(
|
this.__proto__ = new synthAction(
|
||||||
aID,
|
aID,
|
||||||
new caretMoveChecker(aCaretOffset, aID)
|
new caretMoveChecker(aCaretOffset, true, aID)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.invoke = function moveToPrevLineEnd_invoke() {
|
this.invoke = function moveToPrevLineEnd_invoke() {
|
||||||
|
@ -1706,12 +1706,12 @@ function moveToLineStart(aID, aCaretOffset) {
|
||||||
aID,
|
aID,
|
||||||
"VK_LEFT",
|
"VK_LEFT",
|
||||||
{ metaKey: true },
|
{ metaKey: true },
|
||||||
new caretMoveChecker(aCaretOffset, aID)
|
new caretMoveChecker(aCaretOffset, true, aID)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.__proto__ = new synthHomeKey(
|
this.__proto__ = new synthHomeKey(
|
||||||
aID,
|
aID,
|
||||||
new caretMoveChecker(aCaretOffset, aID)
|
new caretMoveChecker(aCaretOffset, true, aID)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1729,14 +1729,14 @@ function moveToTextStart(aID) {
|
||||||
aID,
|
aID,
|
||||||
"VK_UP",
|
"VK_UP",
|
||||||
{ metaKey: true },
|
{ metaKey: true },
|
||||||
new caretMoveChecker(0, aID)
|
new caretMoveChecker(0, true, aID)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.__proto__ = new synthKey(
|
this.__proto__ = new synthKey(
|
||||||
aID,
|
aID,
|
||||||
"VK_HOME",
|
"VK_HOME",
|
||||||
{ ctrlKey: true },
|
{ ctrlKey: true },
|
||||||
new caretMoveChecker(0, aID)
|
new caretMoveChecker(0, true, aID)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1792,7 +1792,7 @@ function moveCaretToDOMPoint(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.eventSeq = [new caretMoveChecker(aExpectedOffset, this.target)];
|
this.eventSeq = [new caretMoveChecker(aExpectedOffset, true, this.target)];
|
||||||
|
|
||||||
if (this.focus) {
|
if (this.focus) {
|
||||||
this.eventSeq.push(new asyncInvokerChecker(EVENT_FOCUS, this.focus));
|
this.eventSeq.push(new asyncInvokerChecker(EVENT_FOCUS, this.focus));
|
||||||
|
@ -1815,7 +1815,7 @@ function setCaretOffset(aID, aOffset, aFocusTargetID) {
|
||||||
return "Set caretOffset on " + prettyName(aID) + " at " + this.offset;
|
return "Set caretOffset on " + prettyName(aID) + " at " + this.offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.eventSeq = [new caretMoveChecker(this.offset, this.target)];
|
this.eventSeq = [new caretMoveChecker(this.offset, true, this.target)];
|
||||||
|
|
||||||
if (this.focus) {
|
if (this.focus) {
|
||||||
this.eventSeq.push(new asyncInvokerChecker(EVENT_FOCUS, this.focus));
|
this.eventSeq.push(new asyncInvokerChecker(EVENT_FOCUS, this.focus));
|
||||||
|
@ -2013,6 +2013,7 @@ function textChangeChecker(
|
||||||
*/
|
*/
|
||||||
function caretMoveChecker(
|
function caretMoveChecker(
|
||||||
aCaretOffset,
|
aCaretOffset,
|
||||||
|
aIsSelectionCollapsed,
|
||||||
aTargetOrFunc,
|
aTargetOrFunc,
|
||||||
aTargetFuncArg,
|
aTargetFuncArg,
|
||||||
aIsAsync
|
aIsAsync
|
||||||
|
@ -2025,17 +2026,24 @@ function caretMoveChecker(
|
||||||
);
|
);
|
||||||
|
|
||||||
this.check = function caretMoveChecker_check(aEvent) {
|
this.check = function caretMoveChecker_check(aEvent) {
|
||||||
|
let evt = aEvent.QueryInterface(nsIAccessibleCaretMoveEvent);
|
||||||
is(
|
is(
|
||||||
aEvent.QueryInterface(nsIAccessibleCaretMoveEvent).caretOffset,
|
evt.caretOffset,
|
||||||
aCaretOffset,
|
aCaretOffset,
|
||||||
"Wrong caret offset for " + prettyName(aEvent.accessible)
|
"Wrong caret offset for " + prettyName(aEvent.accessible)
|
||||||
);
|
);
|
||||||
|
is(
|
||||||
|
evt.isSelectionCollapsed,
|
||||||
|
aIsSelectionCollapsed,
|
||||||
|
"wrong collapsed value for " + prettyName(aEvent.accessible)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function asyncCaretMoveChecker(aCaretOffset, aTargetOrFunc, aTargetFuncArg) {
|
function asyncCaretMoveChecker(aCaretOffset, aTargetOrFunc, aTargetFuncArg) {
|
||||||
this.__proto__ = new caretMoveChecker(
|
this.__proto__ = new caretMoveChecker(
|
||||||
aCaretOffset,
|
aCaretOffset,
|
||||||
|
true, // Caret is collapsed
|
||||||
aTargetOrFunc,
|
aTargetOrFunc,
|
||||||
aTargetFuncArg,
|
aTargetFuncArg,
|
||||||
true
|
true
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
/**
|
/**
|
||||||
* Click checker.
|
* Click checker.
|
||||||
*/
|
*/
|
||||||
function clickChecker(aCaretOffset, aID, aExtraNodeOrID, aExtraCaretOffset) {
|
function clickChecker(aCaretOffset, aIsSelectionCollapsed, aID, aExtraNodeOrID, aExtraCaretOffset) {
|
||||||
this.__proto__ = new caretMoveChecker(aCaretOffset, aID);
|
this.__proto__ = new caretMoveChecker(aCaretOffset, aIsSelectionCollapsed, aID);
|
||||||
|
|
||||||
this.extraNode = getNode(aExtraNodeOrID);
|
this.extraNode = getNode(aExtraNodeOrID);
|
||||||
|
|
||||||
|
@ -46,43 +46,43 @@
|
||||||
gQueue = new eventQueue();
|
gQueue = new eventQueue();
|
||||||
|
|
||||||
var id = "textbox";
|
var id = "textbox";
|
||||||
gQueue.push(new synthFocus(id, new caretMoveChecker(5, id)));
|
gQueue.push(new synthFocus(id, new caretMoveChecker(5, true, id)));
|
||||||
gQueue.push(new synthSelectAll(id, new caretMoveChecker(5, id)));
|
gQueue.push(new synthSelectAll(id, new caretMoveChecker(5, false, id)));
|
||||||
gQueue.push(new synthClick(id, new caretMoveChecker(0, id)));
|
gQueue.push(new synthClick(id, new caretMoveChecker(0, true, id)));
|
||||||
gQueue.push(new synthRightKey(id, new caretMoveChecker(1, id)));
|
gQueue.push(new synthRightKey(id, new caretMoveChecker(1, true, id)));
|
||||||
|
|
||||||
if (!MAC) {
|
if (!MAC) {
|
||||||
gQueue.push(new synthSelectAll(id, new caretMoveChecker(5, id)));
|
gQueue.push(new synthSelectAll(id, new caretMoveChecker(5, false, id)));
|
||||||
gQueue.push(new synthHomeKey(id, new caretMoveChecker(0, id)));
|
gQueue.push(new synthHomeKey(id, new caretMoveChecker(0, true, id)));
|
||||||
gQueue.push(new synthRightKey(id, new caretMoveChecker(1, id)));
|
gQueue.push(new synthRightKey(id, new caretMoveChecker(1, true, id)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
todo(false, "Make these tests pass on OSX (bug 650294)");
|
todo(false, "Make these tests pass on OSX (bug 650294)");
|
||||||
}
|
}
|
||||||
|
|
||||||
id = "textarea";
|
id = "textarea";
|
||||||
gQueue.push(new synthClick(id, new caretMoveChecker(0, id)));
|
gQueue.push(new synthClick(id, new caretMoveChecker(0, true, id)));
|
||||||
gQueue.push(new synthRightKey(id, new caretMoveChecker(1, id)));
|
gQueue.push(new synthRightKey(id, new caretMoveChecker(1, true, id)));
|
||||||
gQueue.push(new synthDownKey(id, new caretMoveChecker(12, id)));
|
gQueue.push(new synthDownKey(id, new caretMoveChecker(12, true, id)));
|
||||||
|
|
||||||
id = "textarea_wrapped";
|
id = "textarea_wrapped";
|
||||||
gQueue.push(new setCaretOffset(id, 4, id));
|
gQueue.push(new setCaretOffset(id, 4, id));
|
||||||
gQueue.push(new synthLeftKey(id, new caretMoveChecker(4, id)));
|
gQueue.push(new synthLeftKey(id, new caretMoveChecker(4, true, id)));
|
||||||
|
|
||||||
id = "p";
|
id = "p";
|
||||||
gQueue.push(new synthClick(id, new caretMoveChecker(0, id)));
|
gQueue.push(new synthClick(id, new caretMoveChecker(0, true, id)));
|
||||||
gQueue.push(new synthRightKey(id, new caretMoveChecker(1, id)));
|
gQueue.push(new synthRightKey(id, new caretMoveChecker(1, true, id)));
|
||||||
gQueue.push(new synthDownKey(id, new caretMoveChecker(6, id)));
|
gQueue.push(new synthDownKey(id, new caretMoveChecker(6, true, id)));
|
||||||
|
|
||||||
id = "p1_in_div";
|
id = "p1_in_div";
|
||||||
gQueue.push(new synthClick(id, new clickChecker(0, id, "p2_in_div", -1)));
|
gQueue.push(new synthClick(id, new clickChecker(0, true, id, "p2_in_div", -1)));
|
||||||
|
|
||||||
id = "p";
|
id = "p";
|
||||||
gQueue.push(new synthShiftTab(id, new caretMoveChecker(0, id)));
|
gQueue.push(new synthShiftTab(id, new caretMoveChecker(0, true, id)));
|
||||||
id = "textarea";
|
id = "textarea";
|
||||||
gQueue.push(new synthShiftTab(id, new caretMoveChecker(12, id)));
|
gQueue.push(new synthShiftTab(id, new caretMoveChecker(12, true, id)));
|
||||||
id = "p";
|
id = "p";
|
||||||
gQueue.push(new synthTab(id, new caretMoveChecker(0, id)));
|
gQueue.push(new synthTab(id, new caretMoveChecker(0, true, id)));
|
||||||
|
|
||||||
// Set caret after a child of span element, i.e. after 'text' text.
|
// Set caret after a child of span element, i.e. after 'text' text.
|
||||||
gQueue.push(new moveCaretToDOMPoint("test1", getNode("test1_span"), 1,
|
gQueue.push(new moveCaretToDOMPoint("test1", getNode("test1_span"), 1,
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
function getOnclickSeq(aID) {
|
function getOnclickSeq(aID) {
|
||||||
return [
|
return [
|
||||||
new caretMoveChecker(0, aID),
|
new caretMoveChecker(0, true, aID),
|
||||||
new unexpectedInvokerChecker(EVENT_TEXT_SELECTION_CHANGED, aID),
|
new unexpectedInvokerChecker(EVENT_TEXT_SELECTION_CHANGED, aID),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
{ shiftKey: true }));
|
{ shiftKey: true }));
|
||||||
gQueue.push(new synthLeftKey("ta1",
|
gQueue.push(new synthLeftKey("ta1",
|
||||||
[new textSelectionChecker("ta1", 0, 0, "ta1", 0, "ta1", 0),
|
[new textSelectionChecker("ta1", 0, 0, "ta1", 0, "ta1", 0),
|
||||||
new caretMoveChecker(0, "ta1")]));
|
new caretMoveChecker(0, true, "ta1")]));
|
||||||
|
|
||||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,7 +318,7 @@
|
||||||
function tmpl_moveTo(aID, aInvokerFunc, aWholeText, aCharIter) {
|
function tmpl_moveTo(aID, aInvokerFunc, aWholeText, aCharIter) {
|
||||||
this.offset = aCharIter.offset;
|
this.offset = aCharIter.offset;
|
||||||
|
|
||||||
var checker = new caretMoveChecker(this.offset, aID);
|
var checker = new caretMoveChecker(this.offset, true, aID);
|
||||||
this.__proto__ = new (aInvokerFunc)(aID, checker);
|
this.__proto__ = new (aInvokerFunc)(aID, checker);
|
||||||
|
|
||||||
this.finalCheck = function genericMoveTo_finalCheck() {
|
this.finalCheck = function genericMoveTo_finalCheck() {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче