| Index: third_party/WebKit/LayoutTests/fast/forms/selection-setSelectionRange-frameselection.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/forms/selection-setSelectionRange-frameselection.html b/third_party/WebKit/LayoutTests/fast/forms/selection-setSelectionRange-frameselection.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..deee5194a60b2ee8392b1f5aae57dc738bb84573
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/fast/forms/selection-setSelectionRange-frameselection.html
|
| @@ -0,0 +1,36 @@
|
| +<!DOCTYPE html>
|
| +<body>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +<input id="notFocused" value="foo">
|
| +<input id="focused" value="a">
|
| +<script>
|
| +test(() => {
|
| + var notFocused = document.getElementById('notFocused');
|
| + var focused = document.getElementById('focused');
|
| + var selection = window.getSelection();
|
| + selection.removeAllRanges();
|
| + focused.focus();
|
| +
|
| + var originalAnchorNode = selection.anchorNode;
|
| + var originalAnchorOffset = selection.anchorOffset;
|
| + notFocused.setSelectionRange(3, 3);
|
| + assert_equals(selection.anchorNode, originalAnchorNode);
|
| + assert_equals(selection.anchorOffset, originalAnchorOffset);
|
| +}, 'setSelectionRange() should not update FrameSelection if the target element is not focused.');
|
| +
|
| +test(() => {
|
| + var notFocused = document.getElementById('notFocused');
|
| + var focused = document.getElementById('focused');
|
| + var selection = window.getSelection();
|
| + selection.removeAllRanges();
|
| + focused.focus();
|
| +
|
| + var originalAnchorNode = selection.anchorNode;
|
| + var originalAnchorOffset = selection.anchorOffset;
|
| + notFocused.setRangeText('barrr', 0, 3, 'select');
|
| + assert_equals(selection.anchorNode, originalAnchorNode);
|
| + assert_equals(selection.anchorOffset, originalAnchorOffset);
|
| +}, 'setRangeText() should not update FrameSelection if the target element is not focused.');
|
| +</script>
|
| +</body>
|
|
|