OLD | NEW |
(Empty) | |
| 1 var blockCursorStartPosition; |
| 2 var blockCursor; |
| 3 var textNode; |
| 4 |
| 5 function verifyBlockCursorLeftPositionAndWidth(elementId, expected) |
| 6 { |
| 7 blockCursorStartPosition = new Array(); |
| 8 |
| 9 var element = document.getElementById(elementId); |
| 10 textNode = element.firstChild; |
| 11 debug("Verifying block cursor position and width for each position in '" + t
extNode.nodeValue + "' in a " + element.style.direction + " block"); |
| 12 |
| 13 for (var i = 0; i < textNode.length; i++) { |
| 14 evalAndLog("getSelection().collapse(textNode, "+i+")"); |
| 15 |
| 16 blockCursor = internals.selectionBounds(); |
| 17 blockCursorStartPosition.push(blockCursor.left); |
| 18 |
| 19 if (i > 0 && i < textNode.length) { |
| 20 if (expected[i-1] == ">") |
| 21 shouldBeTrue("blockCursorStartPosition["+(i-1)+"] > blockCursorS
tartPosition["+i+"]"); |
| 22 else |
| 23 shouldBeTrue("blockCursorStartPosition["+(i-1)+"] < blockCursorS
tartPosition["+i+"]"); |
| 24 } |
| 25 |
| 26 shouldBeTrue("getSelection().isCollapsed"); |
| 27 shouldBeTrue("blockCursor.width > 1"); |
| 28 shouldBe("internals.absoluteCaretBounds().width", "1"); |
| 29 } |
| 30 |
| 31 evalAndLog("getSelection().collapse(textNode, "+i+")"); |
| 32 blockCursor = internals.selectionBounds(); |
| 33 shouldBeZero("blockCursor.width"); |
| 34 shouldBe("internals.absoluteCaretBounds().width", "1"); |
| 35 debug(""); |
| 36 } |
OLD | NEW |