Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/editing/selection/selection-update-range-after-addrange.html |
| diff --git a/third_party/WebKit/LayoutTests/editing/selection/selection-update-range-after-addrange.html b/third_party/WebKit/LayoutTests/editing/selection/selection-update-range-after-addrange.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d76083b1abb3ca46cb0b27576fd6154ed5b6dd6d |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/editing/selection/selection-update-range-after-addrange.html |
| @@ -0,0 +1,23 @@ |
| +<!DOCTYPE html> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<p>abcdef</p> |
| +<script> |
| +test(() => { |
| + let selection = getSelection(); |
| + selection.removeAllRanges(); |
| + let range = document.createRange(); |
| + let text = document.querySelector('p').firstChild; |
| + range.setStart(text, 1); |
| + range.setEnd(text, 2); |
| + |
| + selection.addRange(range); |
| + assert_equals(selection.anchorNode, text); |
|
yosin_UTC9
2017/02/10 10:26:27
Could you use assesrt_selection()? It is easier to
tkent
2017/02/13 07:31:40
We can't test Range-Selection relationship behavio
|
| + assert_equals(selection.anchorOffset, 1); |
| + assert_equals(selection.focusNode, text); |
| + assert_equals(selection.focusOffset, 2); |
| + |
| + range.setStart(text, 0); |
| + assert_equals(selection.anchorOffset, 0); |
| +}, 'Mutation of Range after adding it to Selection should update Selection attributes.'); |
| +</script> |