OLD | NEW |
---|---|
1 if (!window.eventSender || !window.testRunner) { | 1 if (!window.eventSender || !window.testRunner) { |
2 alert('This test needs to be run in DRT, to get results!'); | 2 alert('This test needs to be run in DRT, to get results!'); |
3 } | 3 } |
4 | 4 |
5 var svgRoot = 0; | 5 var svgRoot = 0; |
6 | 6 |
7 // Map 'point' into absolute coordinates, usable for eventSender | 7 // Map 'point' into absolute coordinates, usable for eventSender |
8 function transformPoint(point, matrix) { | 8 function transformPoint(point, matrix) { |
9 return point.matrixTransform(matrix); | 9 return point.matrixTransform(matrix); |
10 } | 10 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 if (window.eventSender) { | 138 if (window.eventSender) { |
139 eventSender.mouseMoveTo(absStartPos.x, absStartPos.y); | 139 eventSender.mouseMoveTo(absStartPos.x, absStartPos.y); |
140 eventSender.mouseDown(); | 140 eventSender.mouseDown(); |
141 eventSender.mouseMoveTo(mouse.x, mouse.y); | 141 eventSender.mouseMoveTo(mouse.x, mouse.y); |
142 eventSender.mouseUp(); | 142 eventSender.mouseUp(); |
143 } | 143 } |
144 | 144 |
145 selection = window.getSelection(); | 145 selection = window.getSelection(); |
146 startElementId = selection.anchorNode.parentElement.id; | 146 startElementId = selection.anchorNode.parentElement.id; |
147 endElementId = selection.focusNode.parentElement.id; | 147 endElementId = selection.focusNode.parentElement.id; |
148 shouldBeEqualToString("startElementId", expected.startElementId); | 148 assert_equals(startElementId, expected.startElementId); |
fs
2016/08/22 14:10:05
In general I think it'd be preferable to have the
Shanmuga Pandi
2016/08/23 07:11:37
Acknowledged.
| |
149 shouldBe("selection.anchorOffset", expected.start); | 149 assert_equals(selection.anchorOffset, expected.start); |
150 shouldBeEqualToString("endElementId", expected.endElementId); | 150 assert_equals(endElementId, expected.endElementId); |
151 shouldBe("selection.focusOffset", expected.end); | 151 assert_equals(selection.focusOffset, expected.end); |
152 if (window.eventSender) { | 152 if (window.eventSender) { |
153 eventSender.mouseMoveTo(0,0); | 153 eventSender.mouseMoveTo(0,0); |
154 eventSender.mouseDown(); | 154 eventSender.mouseDown(); |
155 eventSender.mouseUp(); | 155 eventSender.mouseUp(); |
156 } | 156 } |
157 } | 157 } |
158 | |
159 function getEndPosition(id, offset, gap) { | |
160 var element = document.getElementById(id); | |
161 var endPos = element.getEndPositionOfChar(offset); | |
162 endPos.x += gap.x; | |
163 endPos.y += gap.y; | |
164 var absEndPos = toAbsoluteCoordinates(endPos, element); | |
165 return absEndPos; | |
166 } | |
OLD | NEW |