summaryrefslogtreecommitdiffstats
path: root/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.html
diff options
context:
space:
mode:
Diffstat (limited to 'polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.html')
-rw-r--r--polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.html b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.html
index a14d155e23..f34429b8d6 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.html
+++ b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<!--
+@license
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
@@ -328,6 +329,27 @@ limitations under the License.
assert.equal(element._getSelectedText('right'), ' other');
});
+ test('copies to end of side (issue 7895)', () => {
+ element._cachedDiffBuilder.getLineElByChild = function(child) {
+ // Return null for the end container.
+ if (child.textContent === 'ga ga') { return null; }
+ while (!child.classList.contains('content') && child.parentElement) {
+ child = child.parentElement;
+ }
+ return child.previousElementSibling;
+ };
+ element.classList.add('selected-left');
+ element.classList.remove('selected-right');
+ const selection = window.getSelection();
+ selection.removeAllRanges();
+ const range = document.createRange();
+ range.setStart(element.querySelector('div.contentText').firstChild, 3);
+ range.setEnd(
+ element.querySelectorAll('div.contentText')[4].firstChild, 2);
+ selection.addRange(range);
+ assert.equal(element._getSelectedText('left'), 'ba\nzin\nga');
+ });
+
suite('_getTextContentForRange', () => {
let selection;
let range;