Skip to content

Commit a194325

Browse files
adrianheinemarijnh
authored andcommitted
Add regression test for codemirror#4078
1 parent fb78601 commit a194325

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,23 @@ testCM("measureEndOfLine", function(cm) {
11071107
eqPos(cm.coordsChar({left: endPos.left, top: endPos.top + 5}), Pos(0, 18));
11081108
}, {mode: "text/html", value: "<!-- foo barrr -->", lineWrapping: true}, ie_lt8 || opera_lt10);
11091109

1110+
testCM("measureWrappedEndOfLine", function(cm) {
1111+
if (phantom) return;
1112+
cm.setSize(null, "auto");
1113+
var inner = byClassName(cm.getWrapperElement(), "CodeMirror-lines")[0].firstChild;
1114+
var lh = inner.offsetHeight;
1115+
for (var step = 10, w = cm.charCoords(Pos(0, 7), "div").right;; w += step) {
1116+
cm.setSize(w);
1117+
if (inner.offsetHeight < 2.5 * lh) {
1118+
if (step == 10) { w -= 10; step = 1; }
1119+
else break;
1120+
}
1121+
}
1122+
var endPos = cm.charCoords(Pos(0, 12)); // Next-to-last since last would wrap (#1862)
1123+
endPos.left += w; // Add width of editor just to be sure that we are behind last character
1124+
eqPos(cm.coordsChar(endPos), Pos(0, 13));
1125+
}, {mode: "text/html", value: "0123456789abcde0123456789", lineWrapping: true}, ie_lt8 || opera_lt10);
1126+
11101127
testCM("scrollVerticallyAndHorizontally", function(cm) {
11111128
if (cm.getOption("inputStyle") != "textarea") return;
11121129
cm.setSize(100, 100);

0 commit comments

Comments
 (0)