Merge "Fix getTargetDiffElement for polymer 2"
This commit is contained in:
@@ -194,9 +194,13 @@
|
||||
},
|
||||
|
||||
getTargetDiffElement() {
|
||||
// Find the parent diff element of the cursor row.
|
||||
for (let diff = this.diffRow; diff; diff = diff.parentElement) {
|
||||
if (diff.tagName === 'GR-DIFF') { return diff; }
|
||||
if (!this.diffRow) return null;
|
||||
|
||||
const hostOwner = Polymer.dom(/** @type {Node} */ (this.diffRow))
|
||||
.getOwnerRoot();
|
||||
if (hostOwner && hostOwner.host &&
|
||||
hostOwner.host.tagName === 'GR-DIFF') {
|
||||
return hostOwner.host;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
@@ -249,6 +249,15 @@ limitations under the License.
|
||||
diffElement._diffChanged(mockDiffResponse.diffResponse);
|
||||
});
|
||||
|
||||
test('getTargetDiffElement', () => {
|
||||
cursorElement.initialLineNumber = 1;
|
||||
assert.isTrue(!!cursorElement.diffRow);
|
||||
assert.equal(
|
||||
cursorElement.getTargetDiffElement(),
|
||||
diffElement
|
||||
);
|
||||
});
|
||||
|
||||
test('getAddress', () => {
|
||||
// It should initialize to the first chunk: line 5 of the revision.
|
||||
assert.deepEqual(cursorElement.getAddress(),
|
||||
|
||||
Reference in New Issue
Block a user