mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 1125523 - Updated tests to specify JS version and upgraded all uses of var to let, r=margaret
This commit is contained in:
parent
cd68187d3f
commit
1c1f940fd9
@ -4,7 +4,7 @@
|
||||
<meta name="viewport" content="initial-scale=1.0"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="application/javascript">
|
||||
<script type="application/javascript;version=1.8">
|
||||
|
||||
// Used to create handle movement events for SelectionHandler.
|
||||
const ANCHOR = "ANCHOR";
|
||||
@ -60,20 +60,20 @@ function startTests() {
|
||||
*/
|
||||
function testLTR_selectAll() {
|
||||
// Select entire LTR Input element.
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("LTRInput");
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("LTRInput");
|
||||
element.value = LTR_INPUT_TEXT_VALUE;
|
||||
sh.startSelection(element);
|
||||
|
||||
var selection = sh._getSelection();
|
||||
let selection = sh._getSelection();
|
||||
|
||||
var anchorNode = selection.anchorNode;
|
||||
var anchorOffset = selection.anchorOffset;
|
||||
var focusNode = selection.focusNode;
|
||||
var focusOffset = selection.focusOffset;
|
||||
let anchorNode = selection.anchorNode;
|
||||
let anchorOffset = selection.anchorOffset;
|
||||
let focusNode = selection.focusNode;
|
||||
let focusOffset = selection.focusOffset;
|
||||
|
||||
var anchorPt = new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y);
|
||||
var focusPt = new Point(sh._cache.focusPt.x, sh._cache.focusPt.y);
|
||||
let anchorPt = new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y);
|
||||
let focusPt = new Point(sh._cache.focusPt.x, sh._cache.focusPt.y);
|
||||
|
||||
return Promise.all([
|
||||
ok(sh.isSelectionActive(),
|
||||
@ -129,20 +129,20 @@ function testLTR_selectAll() {
|
||||
*/
|
||||
function testRTL_selectAll() {
|
||||
// Select entire RTL Input element.
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("RTLInput");
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("RTLInput");
|
||||
element.value = RTL_INPUT_TEXT_VALUE;
|
||||
sh.startSelection(element);
|
||||
|
||||
var selection = sh._getSelection();
|
||||
let selection = sh._getSelection();
|
||||
|
||||
var anchorNode = selection.anchorNode;
|
||||
var anchorOffset = selection.anchorOffset;
|
||||
var focusNode = selection.focusNode;
|
||||
var focusOffset = selection.focusOffset;
|
||||
let anchorNode = selection.anchorNode;
|
||||
let anchorOffset = selection.anchorOffset;
|
||||
let focusNode = selection.focusNode;
|
||||
let focusOffset = selection.focusOffset;
|
||||
|
||||
var anchorPt = new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y);
|
||||
var focusPt = new Point(sh._cache.focusPt.x, sh._cache.focusPt.y);
|
||||
let anchorPt = new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y);
|
||||
let focusPt = new Point(sh._cache.focusPt.x, sh._cache.focusPt.y);
|
||||
|
||||
return Promise.all([
|
||||
ok(sh.isSelectionActive(),
|
||||
@ -192,16 +192,16 @@ function testRTL_selectAll() {
|
||||
*/
|
||||
function testLTR_dragFocusHandleToSelf() {
|
||||
// Select entire LTR Input element.
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("LTRInput");
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("LTRInput");
|
||||
element.value = LTR_INPUT_TEXT_VALUE;
|
||||
sh.startSelection(element);
|
||||
|
||||
// Note initial Selection handle points.
|
||||
var initialSelection =
|
||||
let initialSelection =
|
||||
{ anchorPt : new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y),
|
||||
focusPt : new Point(sh._cache.focusPt.x, sh._cache.focusPt.y) };
|
||||
var initialSelectionText = sh._getSelectedText();
|
||||
let initialSelectionText = sh._getSelectedText();
|
||||
|
||||
// Drag focus handle and note results.
|
||||
sh.observe(null, "TextSelection:Move",
|
||||
@ -214,10 +214,10 @@ function testLTR_dragFocusHandleToSelf() {
|
||||
JSON.stringify({ handleType : FOCUS })
|
||||
);
|
||||
|
||||
var focusDraggedSelection =
|
||||
let focusDraggedSelection =
|
||||
{ anchorPt : new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y),
|
||||
focusPt : new Point(sh._cache.focusPt.x, sh._cache.focusPt.y) };
|
||||
var focusDragSelectionText = sh._getSelectedText();
|
||||
let focusDragSelectionText = sh._getSelectedText();
|
||||
|
||||
// Complete test, and report.
|
||||
sh.observe(null, "TextSelection:End", {});
|
||||
@ -250,16 +250,16 @@ function testLTR_dragFocusHandleToSelf() {
|
||||
*/
|
||||
function testLTR_dragAnchorHandleToSelf() {
|
||||
// Select entire LTR Input element.
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("LTRInput");
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("LTRInput");
|
||||
element.value = LTR_INPUT_TEXT_VALUE;
|
||||
sh.startSelection(element);
|
||||
|
||||
// Note initial Selection handle points.
|
||||
var initialSelection =
|
||||
let initialSelection =
|
||||
{ anchorPt : new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y),
|
||||
focusPt : new Point(sh._cache.focusPt.x, sh._cache.focusPt.y) };
|
||||
var initialSelectionText = sh._getSelectedText();
|
||||
let initialSelectionText = sh._getSelectedText();
|
||||
|
||||
// Drag anchor handle and note results.
|
||||
// Note, due to edge case with border boundaries, we actually
|
||||
@ -273,10 +273,10 @@ function testLTR_dragAnchorHandleToSelf() {
|
||||
sh.observe(null, "TextSelection:Position",
|
||||
JSON.stringify({ handleType : ANCHOR })
|
||||
);
|
||||
var anchorDraggedSelection =
|
||||
let anchorDraggedSelection =
|
||||
{ anchorPt : new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y),
|
||||
focusPt : new Point(sh._cache.focusPt.x, sh._cache.focusPt.y) };
|
||||
var anchorDragSelectionText = sh._getSelectedText();
|
||||
let anchorDragSelectionText = sh._getSelectedText();
|
||||
|
||||
// Complete test, and report.
|
||||
sh.observe(null, "TextSelection:End", {});
|
||||
@ -309,16 +309,16 @@ function testLTR_dragAnchorHandleToSelf() {
|
||||
*/
|
||||
function testRTL_dragFocusHandleToSelf() {
|
||||
// Select entire RTL Input element.
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("RTLInput");
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("RTLInput");
|
||||
element.value = RTL_INPUT_TEXT_VALUE;
|
||||
sh.startSelection(element);
|
||||
|
||||
// Note initial Selection handle points.
|
||||
var initialSelection =
|
||||
let initialSelection =
|
||||
{ anchorPt : new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y),
|
||||
focusPt : new Point(sh._cache.focusPt.x, sh._cache.focusPt.y) };
|
||||
var initialSelectionText = sh._getSelectedText();
|
||||
let initialSelectionText = sh._getSelectedText();
|
||||
|
||||
// Drag focus handle and note results.
|
||||
sh.observe(null, "TextSelection:Move",
|
||||
@ -331,10 +331,10 @@ function testRTL_dragFocusHandleToSelf() {
|
||||
JSON.stringify({ handleType : FOCUS })
|
||||
);
|
||||
|
||||
var focusDraggedSelection =
|
||||
let focusDraggedSelection =
|
||||
{ anchorPt : new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y),
|
||||
focusPt : new Point(sh._cache.focusPt.x, sh._cache.focusPt.y) };
|
||||
var focusDragSelectionText = sh._getSelectedText();
|
||||
let focusDragSelectionText = sh._getSelectedText();
|
||||
|
||||
// Complete test, and report.
|
||||
sh.observe(null, "TextSelection:End", {});
|
||||
@ -367,16 +367,16 @@ function testRTL_dragFocusHandleToSelf() {
|
||||
*/
|
||||
function testRTL_dragAnchorHandleToSelf() {
|
||||
// Select entire RTL Input element.
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("RTLInput");
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("RTLInput");
|
||||
element.value = RTL_INPUT_TEXT_VALUE;
|
||||
sh.startSelection(element);
|
||||
|
||||
// Note initial Selection handle points.
|
||||
var initialSelection =
|
||||
let initialSelection =
|
||||
{ anchorPt : new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y),
|
||||
focusPt : new Point(sh._cache.focusPt.x, sh._cache.focusPt.y) };
|
||||
var initialSelectionText = sh._getSelectedText();
|
||||
let initialSelectionText = sh._getSelectedText();
|
||||
|
||||
// Drag anchor handle and note results.
|
||||
// Note, due to edge case with border boundaries, we actually
|
||||
@ -390,10 +390,10 @@ function testRTL_dragAnchorHandleToSelf() {
|
||||
sh.observe(null, "TextSelection:Position",
|
||||
JSON.stringify({ handleType : ANCHOR })
|
||||
);
|
||||
var anchorDraggedSelection =
|
||||
let anchorDraggedSelection =
|
||||
{ anchorPt : new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y),
|
||||
focusPt : new Point(sh._cache.focusPt.x, sh._cache.focusPt.y) };
|
||||
var anchorDragSelectionText = sh._getSelectedText();
|
||||
let anchorDragSelectionText = sh._getSelectedText();
|
||||
|
||||
// Complete test, and report.
|
||||
sh.observe(null, "TextSelection:End", {});
|
||||
|
@ -4,7 +4,7 @@
|
||||
<meta name="viewport" content="initial-scale=1.0"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="application/javascript">
|
||||
<script type="application/javascript;version=1.8">
|
||||
|
||||
const DIV_POINT_TEXT = "Under";
|
||||
const INPUT_TEXT = "Text for select all in an <input>";
|
||||
@ -44,9 +44,9 @@ function startTests() {
|
||||
*
|
||||
*/
|
||||
function testSelectAllDivs() {
|
||||
var sh = getSelectionHandler();
|
||||
var selDiv = document.getElementById("selDiv");
|
||||
var nonSelDiv = document.getElementById("nonSelDiv");
|
||||
let sh = getSelectionHandler();
|
||||
let selDiv = document.getElementById("selDiv");
|
||||
let nonSelDiv = document.getElementById("nonSelDiv");
|
||||
|
||||
// Check the initial state of the selection handler, and selectable/non-selectable <div>s.
|
||||
return Promise.all([
|
||||
@ -56,8 +56,8 @@ function testSelectAllDivs() {
|
||||
|
||||
]).then(function() {
|
||||
// Select all on a non-editable text node selects all the text in the page.
|
||||
var startSelectionResult = sh.startSelection(selDiv);
|
||||
var selection = sh._getSelection();
|
||||
let startSelectionResult = sh.startSelection(selDiv);
|
||||
let selection = sh._getSelection();
|
||||
|
||||
return Promise.all([
|
||||
is(startSelectionResult, sh.ERROR_NONE,
|
||||
@ -78,17 +78,17 @@ function testSelectAllDivs() {
|
||||
*
|
||||
*/
|
||||
function testSelectDivAtPoint() {
|
||||
var sh = getSelectionHandler();
|
||||
var selDiv = document.getElementById("selDiv");
|
||||
let sh = getSelectionHandler();
|
||||
let selDiv = document.getElementById("selDiv");
|
||||
|
||||
// Select word at point in <div>
|
||||
var rect = selDiv.getBoundingClientRect();
|
||||
var startSelectionResult = sh.startSelection(selDiv, {
|
||||
let rect = selDiv.getBoundingClientRect();
|
||||
let startSelectionResult = sh.startSelection(selDiv, {
|
||||
mode: sh.SELECT_AT_POINT,
|
||||
x: rect.left + 1,
|
||||
y: rect.top + 1
|
||||
});
|
||||
var selection = sh._getSelection();
|
||||
let selection = sh._getSelection();
|
||||
|
||||
// Check the state of the selection handler after selecting at a point.
|
||||
return Promise.all([
|
||||
@ -114,8 +114,8 @@ function testSelectDivAtPoint() {
|
||||
*
|
||||
*/
|
||||
function testSelectInput() {
|
||||
var sh = getSelectionHandler();
|
||||
var inputNode = document.getElementById("inputNode");
|
||||
let sh = getSelectionHandler();
|
||||
let inputNode = document.getElementById("inputNode");
|
||||
inputNode.value = INPUT_TEXT;
|
||||
|
||||
// Test that calling startSelection with an input selects all the text in the input.
|
||||
@ -125,8 +125,8 @@ function testSelectInput() {
|
||||
|
||||
]).then(function() {
|
||||
// Check the state of the selection handler after calling startSelection on it.
|
||||
var startSelectionResult = sh.startSelection(inputNode);
|
||||
var selection = sh._getSelection();
|
||||
let startSelectionResult = sh.startSelection(inputNode);
|
||||
let selection = sh._getSelection();
|
||||
|
||||
return Promise.all([
|
||||
is(startSelectionResult, sh.ERROR_NONE,
|
||||
@ -145,13 +145,13 @@ function testSelectInput() {
|
||||
*/
|
||||
|
||||
function testSelectTextarea() {
|
||||
var sh = getSelectionHandler();
|
||||
var textareaNode = document.getElementById("textareaNode");
|
||||
let sh = getSelectionHandler();
|
||||
let textareaNode = document.getElementById("textareaNode");
|
||||
textareaNode.value = TEXTAREA_TEXT;
|
||||
|
||||
// Change (still-active) selection from previous <input> field to <textarea>
|
||||
var startSelectionResult = sh.startSelection(textareaNode);
|
||||
var selection = sh._getSelection();
|
||||
let startSelectionResult = sh.startSelection(textareaNode);
|
||||
let selection = sh._getSelection();
|
||||
|
||||
return Promise.all([
|
||||
ok(sh.isSelectionActive(), "Selection should be active at start of testSelectTextarea"),
|
||||
@ -177,8 +177,8 @@ function testSelectTextarea() {
|
||||
*
|
||||
*/
|
||||
function testReadonlyInput() {
|
||||
var sh = getSelectionHandler();
|
||||
var readOnlyNode = document.getElementById("readOnlyTextInput");
|
||||
let sh = getSelectionHandler();
|
||||
let readOnlyNode = document.getElementById("readOnlyTextInput");
|
||||
readOnlyNode.value = READONLY_INPUT_TEXT;
|
||||
|
||||
return Promise.all([
|
||||
@ -199,8 +199,8 @@ function testReadonlyInput() {
|
||||
*
|
||||
*/
|
||||
function testCloseSelection() {
|
||||
var sh = getSelectionHandler();
|
||||
var inputNode = document.getElementById("inputNode");
|
||||
let sh = getSelectionHandler();
|
||||
let inputNode = document.getElementById("inputNode");
|
||||
inputNode.value = INPUT_TEXT;
|
||||
|
||||
// Check the initial state of the selection handler.
|
||||
@ -239,7 +239,7 @@ function testCloseSelection() {
|
||||
*
|
||||
*/
|
||||
function testStartSelectionFail() {
|
||||
var sh = getSelectionHandler();
|
||||
let sh = getSelectionHandler();
|
||||
|
||||
return Promise.all([
|
||||
ok(!sh.isSelectionActive(),
|
||||
@ -247,9 +247,9 @@ function testStartSelectionFail() {
|
||||
|
||||
]).then(function() {
|
||||
// We cannot perform an invalid selection request.
|
||||
var element = document.getElementById("inputNode");
|
||||
var rect = element.getBoundingClientRect();
|
||||
var startSelectionResult = sh.startSelection(element, {
|
||||
let element = document.getElementById("inputNode");
|
||||
let rect = element.getBoundingClientRect();
|
||||
let startSelectionResult = sh.startSelection(element, {
|
||||
mode: "fooMode",
|
||||
x: rect.left + 1,
|
||||
y: rect.top + 1
|
||||
@ -263,8 +263,8 @@ function testStartSelectionFail() {
|
||||
|
||||
}).then(function() {
|
||||
// Select all on a Button should fail.
|
||||
var element = document.getElementById("inputButton");
|
||||
var startSelectionResult = sh.startSelection(element);
|
||||
let element = document.getElementById("inputButton");
|
||||
let startSelectionResult = sh.startSelection(element);
|
||||
|
||||
return Promise.all([
|
||||
is(startSelectionResult, sh.START_ERROR_NONTEXT_INPUT,
|
||||
@ -274,9 +274,9 @@ function testStartSelectionFail() {
|
||||
|
||||
}).then(function() {
|
||||
// We cannot Select Word where no point exists.
|
||||
var element = document.getElementById("inputNode");
|
||||
var rect = element.getBoundingClientRect();
|
||||
var startSelectionResult = sh.startSelection(element, {
|
||||
let element = document.getElementById("inputNode");
|
||||
let rect = element.getBoundingClientRect();
|
||||
let startSelectionResult = sh.startSelection(element, {
|
||||
mode: sh.SELECT_AT_POINT,
|
||||
x: -1000,
|
||||
y: -1000
|
||||
@ -296,15 +296,15 @@ function testStartSelectionFail() {
|
||||
*
|
||||
*/
|
||||
function testAttachCaret() {
|
||||
var sh = getSelectionHandler();
|
||||
let sh = getSelectionHandler();
|
||||
|
||||
return Promise.all([
|
||||
ok(!sh.isSelectionActive(), "Selection should not be active at start of testAttachCaret"),
|
||||
|
||||
]).then(function() {
|
||||
var element = document.getElementById("inputNode");
|
||||
let element = document.getElementById("inputNode");
|
||||
element.value = INPUT_TEXT;
|
||||
var attachCaretResult = sh.attachCaret(element);
|
||||
let attachCaretResult = sh.attachCaret(element);
|
||||
|
||||
return Promise.all([
|
||||
is(attachCaretResult, sh.ERROR_NONE,
|
||||
@ -326,7 +326,7 @@ function testAttachCaret() {
|
||||
*
|
||||
*/
|
||||
function testAttachCaretFail() {
|
||||
var sh = getSelectionHandler();
|
||||
let sh = getSelectionHandler();
|
||||
|
||||
return Promise.all([
|
||||
is(sh._activeType, sh.TYPE_NONE,
|
||||
@ -334,9 +334,9 @@ function testAttachCaretFail() {
|
||||
|
||||
]).then(function() {
|
||||
// We cannot attach Caret into disabled input.
|
||||
var element = document.getElementById("inputDisabled");
|
||||
let element = document.getElementById("inputDisabled");
|
||||
element.value = INPUT_TEXT;
|
||||
var attachCaretResult = sh.attachCaret(element);
|
||||
let attachCaretResult = sh.attachCaret(element);
|
||||
|
||||
return Promise.all([
|
||||
is(attachCaretResult, sh.ATTACH_ERROR_INCOMPATIBLE,
|
||||
|
@ -4,7 +4,7 @@
|
||||
<meta name="viewport" content="initial-scale=1.0"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="application/javascript">
|
||||
<script type="application/javascript;version=1.8">
|
||||
|
||||
// Used to create handle movement events for SelectionHandler.
|
||||
const ANCHOR = "ANCHOR";
|
||||
@ -25,7 +25,7 @@ Cu.import('resource://gre/modules/Geometry.jsm');
|
||||
|
||||
// Distance between text selection lines. Reality tested, and also
|
||||
// Used to perform multi-line selection selections.
|
||||
var selectionLineHeight = 0;
|
||||
let selectionLineHeight = 0;
|
||||
|
||||
/* =================================================================================
|
||||
*
|
||||
@ -60,8 +60,8 @@ function startTests() {
|
||||
*/
|
||||
function testLTR_selectionPoints() {
|
||||
// Select entire LTRTextArea.
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("LTRTextarea");
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("LTRTextarea");
|
||||
sh.startSelection(element);
|
||||
|
||||
return Promise.all([
|
||||
@ -71,14 +71,14 @@ function testLTR_selectionPoints() {
|
||||
]).then(function() {
|
||||
// setSelectionRange() (in editable elements), gets us a single-line selection of
|
||||
// midpoint character +- EST_SEL_TEXT_BOUND_CHARS chars on either side.
|
||||
var midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
let midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
element.setSelectionRange(midpointSelCharOffset - EST_SEL_TEXT_BOUND_CHARS,
|
||||
midpointSelCharOffset + EST_SEL_TEXT_BOUND_CHARS);
|
||||
|
||||
// Grab values that are cleared by closing selection.
|
||||
var selection = { anchorPt : new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y),
|
||||
let selection = { anchorPt : new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y),
|
||||
focusPt : new Point(sh._cache.focusPt.x, sh._cache.focusPt.y) };
|
||||
var midpointSelText = sh._getSelectedText();
|
||||
let midpointSelText = sh._getSelectedText();
|
||||
|
||||
// Close selection and complete test.
|
||||
sh.observe(null, "TextSelection:End", {});
|
||||
@ -104,8 +104,8 @@ function testLTR_selectionPoints() {
|
||||
*/
|
||||
function testRTL_selectionPoints() {
|
||||
// Select entire RTLTextArea.
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("RTLTextarea");
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("RTLTextarea");
|
||||
sh.startSelection(element);
|
||||
|
||||
return Promise.all([
|
||||
@ -115,14 +115,14 @@ function testRTL_selectionPoints() {
|
||||
]).then(function() {
|
||||
// setSelectionRange() (in editable elements), gets us a single-line selection of
|
||||
// midpoint character +- EST_SEL_TEXT_BOUND_CHARS chars on either side.
|
||||
var midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
let midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
element.setSelectionRange(midpointSelCharOffset - EST_SEL_TEXT_BOUND_CHARS,
|
||||
midpointSelCharOffset + EST_SEL_TEXT_BOUND_CHARS);
|
||||
|
||||
// Grab values that are cleared by closing selection.
|
||||
var selection = { anchorPt : new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y),
|
||||
let selection = { anchorPt : new Point(sh._cache.anchorPt.x, sh._cache.anchorPt.y),
|
||||
focusPt : new Point(sh._cache.focusPt.x, sh._cache.focusPt.y) };
|
||||
var midpointSelText = sh._getSelectedText();
|
||||
let midpointSelText = sh._getSelectedText();
|
||||
|
||||
// Close selection and complete test.
|
||||
sh.observe(null, "TextSelection:End", {});
|
||||
@ -150,14 +150,14 @@ function testRTL_selectionPoints() {
|
||||
* The result is used later to ensure more-precise handle up/down movements.
|
||||
*/
|
||||
function test_selectionLineHeight() {
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("LTRTextarea");
|
||||
var initialSelection = null;
|
||||
var changedSelection = null;
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("LTRTextarea");
|
||||
let initialSelection = null;
|
||||
let changedSelection = null;
|
||||
|
||||
// Select entire textarea, refine selection to midpoint string.
|
||||
sh.startSelection(element);
|
||||
var midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
let midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
element.setSelectionRange(midpointSelCharOffset - EST_SEL_TEXT_BOUND_CHARS,
|
||||
midpointSelCharOffset + EST_SEL_TEXT_BOUND_CHARS);
|
||||
|
||||
@ -210,14 +210,14 @@ function test_selectionLineHeight() {
|
||||
* This tests what happens during focus handle down movements.
|
||||
*/
|
||||
function testLTR_moveFocusHandleDown() {
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("LTRTextarea");
|
||||
var initialSelection = null;
|
||||
var changedSelection = null;
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("LTRTextarea");
|
||||
let initialSelection = null;
|
||||
let changedSelection = null;
|
||||
|
||||
// Select entire textarea, refine selection to midpoint string.
|
||||
sh.startSelection(element);
|
||||
var midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
let midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
element.setSelectionRange(midpointSelCharOffset - EST_SEL_TEXT_BOUND_CHARS,
|
||||
midpointSelCharOffset + EST_SEL_TEXT_BOUND_CHARS);
|
||||
|
||||
@ -275,14 +275,14 @@ function testLTR_moveFocusHandleDown() {
|
||||
*/
|
||||
|
||||
function testLTR_moveFocusHandleUp() {
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("LTRTextarea");
|
||||
var initialSelection = null;
|
||||
var changedSelection = null;
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("LTRTextarea");
|
||||
let initialSelection = null;
|
||||
let changedSelection = null;
|
||||
|
||||
// Select entire textarea, refine selection to midpoint string.
|
||||
sh.startSelection(element);
|
||||
var midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
let midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
element.setSelectionRange(midpointSelCharOffset - EST_SEL_TEXT_BOUND_CHARS,
|
||||
midpointSelCharOffset + EST_SEL_TEXT_BOUND_CHARS);
|
||||
|
||||
@ -343,14 +343,14 @@ function testLTR_moveFocusHandleUp() {
|
||||
* This tests what happens during anchor handle up movements.
|
||||
*/
|
||||
function testLTR_moveAnchorHandleUp() {
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("LTRTextarea");
|
||||
var initialSelection = null;
|
||||
var changedSelection = null;
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("LTRTextarea");
|
||||
let initialSelection = null;
|
||||
let changedSelection = null;
|
||||
|
||||
// Select entire textarea, refine selection to midpoint string.
|
||||
sh.startSelection(element);
|
||||
var midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
let midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
element.setSelectionRange(midpointSelCharOffset - EST_SEL_TEXT_BOUND_CHARS,
|
||||
midpointSelCharOffset + EST_SEL_TEXT_BOUND_CHARS);
|
||||
|
||||
@ -407,14 +407,14 @@ function testLTR_moveAnchorHandleUp() {
|
||||
* This tests what happens during anchor handle down movements.
|
||||
*/
|
||||
function testLTR_moveAnchorHandleDown() {
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("LTRTextarea");
|
||||
var initialSelection = null;
|
||||
var changedSelection = null;
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("LTRTextarea");
|
||||
let initialSelection = null;
|
||||
let changedSelection = null;
|
||||
|
||||
// Select entire textarea, refine selection to midpoint string.
|
||||
sh.startSelection(element);
|
||||
var midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
let midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
element.setSelectionRange(midpointSelCharOffset - EST_SEL_TEXT_BOUND_CHARS,
|
||||
midpointSelCharOffset + EST_SEL_TEXT_BOUND_CHARS);
|
||||
|
||||
@ -475,14 +475,14 @@ function testLTR_moveAnchorHandleDown() {
|
||||
* This tests what happens during focus handle down movements.
|
||||
*/
|
||||
function testRTL_moveFocusHandleDown() {
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("RTLTextarea");
|
||||
var initialSelection = null;
|
||||
var changedSelection = null;
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("RTLTextarea");
|
||||
let initialSelection = null;
|
||||
let changedSelection = null;
|
||||
|
||||
// Select entire textarea, refine selection to midpoint string.
|
||||
sh.startSelection(element);
|
||||
var midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
let midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
element.setSelectionRange(midpointSelCharOffset - EST_SEL_TEXT_BOUND_CHARS,
|
||||
midpointSelCharOffset + EST_SEL_TEXT_BOUND_CHARS);
|
||||
|
||||
@ -539,14 +539,14 @@ function testRTL_moveFocusHandleDown() {
|
||||
* This tests what happens during focus handle up movements.
|
||||
*/
|
||||
function testRTL_moveFocusHandleUp() {
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("RTLTextarea");
|
||||
var initialSelection = null;
|
||||
var changedSelection = null;
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("RTLTextarea");
|
||||
let initialSelection = null;
|
||||
let changedSelection = null;
|
||||
|
||||
// Select entire textarea, refine selection to midpoint string.
|
||||
sh.startSelection(element);
|
||||
var midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
let midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
element.setSelectionRange(midpointSelCharOffset - EST_SEL_TEXT_BOUND_CHARS,
|
||||
midpointSelCharOffset + EST_SEL_TEXT_BOUND_CHARS);
|
||||
|
||||
@ -607,14 +607,14 @@ function testRTL_moveFocusHandleUp() {
|
||||
* This tests what happens during anchor handle up movements.
|
||||
*/
|
||||
function testRTL_moveAnchorHandleUp() {
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("RTLTextarea");
|
||||
var initialSelection = null;
|
||||
var changedSelection = null;
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("RTLTextarea");
|
||||
let initialSelection = null;
|
||||
let changedSelection = null;
|
||||
|
||||
// Select entire textarea, refine selection to midpoint string.
|
||||
sh.startSelection(element);
|
||||
var midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
let midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
element.setSelectionRange(midpointSelCharOffset - EST_SEL_TEXT_BOUND_CHARS,
|
||||
midpointSelCharOffset + EST_SEL_TEXT_BOUND_CHARS);
|
||||
|
||||
@ -671,14 +671,14 @@ function testRTL_moveAnchorHandleUp() {
|
||||
* This tests what happens during anchor handle down movements.
|
||||
*/
|
||||
function testRTL_moveAnchorHandleDown() {
|
||||
var sh = getSelectionHandler();
|
||||
var element = document.getElementById("RTLTextarea");
|
||||
var initialSelection = null;
|
||||
var changedSelection = null;
|
||||
let sh = getSelectionHandler();
|
||||
let element = document.getElementById("RTLTextarea");
|
||||
let initialSelection = null;
|
||||
let changedSelection = null;
|
||||
|
||||
// Select entire textarea, refine selection to midpoint string.
|
||||
sh.startSelection(element);
|
||||
var midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
let midpointSelCharOffset = (element.selectionStart + element.selectionEnd) / 2;
|
||||
element.setSelectionRange(midpointSelCharOffset - EST_SEL_TEXT_BOUND_CHARS,
|
||||
midpointSelCharOffset + EST_SEL_TEXT_BOUND_CHARS);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user