diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_html.js b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_html.js index a8ee85cd09..55abd38212 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_html.js +++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_html.js @@ -298,13 +298,13 @@ export const htmlTemplate = html` .newlineWarning.hidden { display: none; } - .lineNumButton.COVERED { + .lineNum.COVERED .lineNumButton { background-color: var(--coverage-covered, #e0f2f1); } - .lineNumButton.NOT_COVERED { + .lineNum.NOT_COVERED .lineNumButton { background-color: var(--coverage-not-covered, #ffd1a4); } - .lineNumButton.PARTIALLY_COVERED { + .lineNum.PARTIALLY_COVERED .lineNumButton { background: linear-gradient( to right bottom, var(--coverage-not-covered, #ffd1a4) 0%, @@ -337,12 +337,12 @@ export const htmlTemplate = html` .contentText, .selected-left:not(.selected-comment) .unified - .left.lineNumButton + .left.lineNum ~ .content:not(.both) .contentText, .selected-right:not(.selected-comment) .unified - .right.lineNumButton + .right.lineNum ~ .content .contentText, .selected-left.selected-comment .side-by-side .left + .content .message, diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html index f7769f505f..35abd04bf0 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html @@ -1013,6 +1013,46 @@ suite('gr-diff tests', () => { assertDiffTableWithContent(); }); + suite('selection test', () => { + test('user-select set correctly on side-by-side view', () => { + const content = [{ + a: ['all work and no play make andybons a dull boy'], + b: ['elgoog elgoog elgoog'], + }, { + ab: [ + 'Non eram nescius, Brute, cum, quae summis ingeniis ', + 'exquisitaque doctrina philosophi Graeco sermone tractavissent', + ], + }]; + setupSampleDiff({content}); + flushAsynchronousOperations(); + const diffLine = element.shadowRoot.querySelectorAll('.contentText')[2]; + assert.equal(getComputedStyle(diffLine).userSelect, 'none'); + // click to mark it as selected + MockInteractions.tap(diffLine); + assert.equal(getComputedStyle(diffLine).userSelect, 'text'); + }); + + test('user-select set correctly on unified view', () => { + const content = [{ + a: ['all work and no play make andybons a dull boy'], + b: ['elgoog elgoog elgoog'], + }, { + ab: [ + 'Non eram nescius, Brute, cum, quae summis ingeniis ', + 'exquisitaque doctrina philosophi Graeco sermone tractavissent', + ], + }]; + setupSampleDiff({content}); + element.viewMode = 'UNIFIED_DIFF'; + flushAsynchronousOperations(); + const diffLine = element.shadowRoot.querySelectorAll('.contentText')[2]; + assert.equal(getComputedStyle(diffLine).userSelect, 'none'); + MockInteractions.tap(diffLine); + assert.equal(getComputedStyle(diffLine).userSelect, 'text'); + }); + }); + suite('whitespace changes only message', () => { test('show the message if ignore_whitespace is criteria matches', () => { setupSampleDiff({content: [{skip: 100}]});