2017-01-27 15:33:08 -08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<!--
|
|
|
|
Copyright (C) 2017 The Android Open Source Project
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
|
|
|
<title>gr-diff-comment-thread-group</title>
|
|
|
|
|
|
|
|
<script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
|
|
|
|
<script src="../../../bower_components/web-component-tester/browser.js"></script>
|
2017-06-02 13:08:19 -04:00
|
|
|
<link rel="import" href="../../../test/common-test-setup.html"/>
|
2017-01-27 15:33:08 -08:00
|
|
|
<script src="../../../scripts/util.js"></script>
|
|
|
|
|
|
|
|
<link rel="import" href="gr-diff-comment-thread-group.html">
|
|
|
|
|
2017-03-28 17:02:44 -07:00
|
|
|
<script>void(0);</script>
|
|
|
|
|
2017-01-27 15:33:08 -08:00
|
|
|
<test-fixture id="basic">
|
|
|
|
<template>
|
|
|
|
<gr-diff-comment-thread-group></gr-diff-comment-thread-group>
|
|
|
|
</template>
|
|
|
|
</test-fixture>
|
|
|
|
|
|
|
|
<script>
|
2017-05-16 14:01:18 -07:00
|
|
|
suite('gr-diff-comment-thread-group tests', () => {
|
|
|
|
let element;
|
|
|
|
let sandbox;
|
2017-01-27 15:33:08 -08:00
|
|
|
|
2017-05-16 14:01:18 -07:00
|
|
|
setup(() => {
|
2017-01-27 15:33:08 -08:00
|
|
|
sandbox = sinon.sandbox.create();
|
|
|
|
stub('gr-rest-api-interface', {
|
2017-05-16 14:01:18 -07:00
|
|
|
getLoggedIn() { return Promise.resolve(false); },
|
2017-01-27 15:33:08 -08:00
|
|
|
});
|
|
|
|
element = fixture('basic');
|
|
|
|
});
|
|
|
|
|
2017-05-16 14:01:18 -07:00
|
|
|
teardown(() => {
|
2017-01-27 15:33:08 -08:00
|
|
|
sandbox.restore();
|
|
|
|
});
|
|
|
|
|
Correct logic for matching a new comment to its thread in a group
When a new comment is being added to a line, Gerrit checks to see if
there is an existing thread on the same line (and same range, if any) so
that the comment can be appended to it if so. Otherwise, a new thread is
created.
However, following I4f7804ac02, the logic to identify the appropriate
thread by range was refactored to not use range location strings, but
use range objects instead. Problematically, there were two flaws in this
code:
1) The range object references were compared rather than their values.
2) Only new threads were being rendered with their corresponding ranges
whereas existing threads were not.
As a result, if the user attempted to add a line comment on a line with
an existing ranged comment, the ranged comment's thread would be
identified as the destination (because the new comment has no range and
the existing thread's range was not being set). Appending the range-less
comment to a ranged thread resulted in incoherent data and the draft
would be unsavable.
With this change, the logic uses value equality to match ranges and the
`gr-diff-comment-thread-group#_getThreads` method is updated to set the
range on existing threads.
Bug: Issue 8410
Change-Id: If34e0d46a5c1af81bec82125217088fb574a2f61
2018-02-21 12:47:26 -08:00
|
|
|
test('_getThreads', () => {
|
2017-02-09 07:34:23 -08:00
|
|
|
element.patchForNewThreads = 3;
|
2017-05-16 14:01:18 -07:00
|
|
|
const comments = [
|
2017-01-27 15:33:08 -08:00
|
|
|
{
|
|
|
|
id: 'sallys_confession',
|
|
|
|
message: 'i like you, jack',
|
|
|
|
updated: '2015-12-23 15:00:20.396000000',
|
2017-01-30 12:03:13 -08:00
|
|
|
__commentSide: 'left',
|
2017-01-27 15:33:08 -08:00
|
|
|
}, {
|
|
|
|
id: 'jacks_reply',
|
|
|
|
message: 'i like you, too',
|
2018-02-05 18:10:01 -08:00
|
|
|
updated: '2015-12-24 15:01:20.396000000',
|
2017-01-30 12:03:13 -08:00
|
|
|
__commentSide: 'left',
|
2018-02-05 18:10:01 -08:00
|
|
|
in_reply_to: 'sallys_confession',
|
2017-01-27 15:33:08 -08:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2017-05-16 14:01:18 -07:00
|
|
|
let expectedThreadGroups = [
|
2017-01-27 15:33:08 -08:00
|
|
|
{
|
|
|
|
start_datetime: '2015-12-23 15:00:20.396000000',
|
2017-01-30 12:03:13 -08:00
|
|
|
commentSide: 'left',
|
2017-01-27 15:33:08 -08:00
|
|
|
comments: [{
|
2017-05-16 14:01:18 -07:00
|
|
|
id: 'sallys_confession',
|
|
|
|
message: 'i like you, jack',
|
|
|
|
updated: '2015-12-23 15:00:20.396000000',
|
|
|
|
__commentSide: 'left',
|
|
|
|
}, {
|
|
|
|
id: 'jacks_reply',
|
|
|
|
message: 'i like you, too',
|
2018-02-05 18:10:01 -08:00
|
|
|
updated: '2015-12-24 15:01:20.396000000',
|
2017-05-16 14:01:18 -07:00
|
|
|
__commentSide: 'left',
|
2018-02-05 18:10:01 -08:00
|
|
|
in_reply_to: 'sallys_confession',
|
2017-05-16 14:01:18 -07:00
|
|
|
}],
|
2018-02-08 09:50:48 -08:00
|
|
|
rootId: 'sallys_confession',
|
2017-05-16 14:01:18 -07:00
|
|
|
patchNum: 3,
|
2017-01-27 15:33:08 -08:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
Correct logic for matching a new comment to its thread in a group
When a new comment is being added to a line, Gerrit checks to see if
there is an existing thread on the same line (and same range, if any) so
that the comment can be appended to it if so. Otherwise, a new thread is
created.
However, following I4f7804ac02, the logic to identify the appropriate
thread by range was refactored to not use range location strings, but
use range objects instead. Problematically, there were two flaws in this
code:
1) The range object references were compared rather than their values.
2) Only new threads were being rendered with their corresponding ranges
whereas existing threads were not.
As a result, if the user attempted to add a line comment on a line with
an existing ranged comment, the ranged comment's thread would be
identified as the destination (because the new comment has no range and
the existing thread's range was not being set). Appending the range-less
comment to a ranged thread resulted in incoherent data and the draft
would be unsavable.
With this change, the logic uses value equality to match ranges and the
`gr-diff-comment-thread-group#_getThreads` method is updated to set the
range on existing threads.
Bug: Issue 8410
Change-Id: If34e0d46a5c1af81bec82125217088fb574a2f61
2018-02-21 12:47:26 -08:00
|
|
|
assert.deepEqual(element._getThreads(comments), expectedThreadGroups);
|
2017-01-27 15:33:08 -08:00
|
|
|
|
2017-02-09 07:34:23 -08:00
|
|
|
// Patch num should get inherited from comment rather
|
2017-01-27 15:33:08 -08:00
|
|
|
comments.push({
|
2017-05-16 14:01:18 -07:00
|
|
|
id: 'betsys_confession',
|
|
|
|
message: 'i like you, jack',
|
|
|
|
updated: '2015-12-24 15:00:10.396000000',
|
|
|
|
range: {
|
|
|
|
start_line: 1,
|
|
|
|
start_character: 1,
|
|
|
|
end_line: 1,
|
|
|
|
end_character: 2,
|
|
|
|
},
|
|
|
|
__commentSide: 'left',
|
|
|
|
});
|
2017-01-27 15:33:08 -08:00
|
|
|
|
|
|
|
expectedThreadGroups = [
|
|
|
|
{
|
|
|
|
start_datetime: '2015-12-23 15:00:20.396000000',
|
2017-01-30 12:03:13 -08:00
|
|
|
commentSide: 'left',
|
2017-01-27 15:33:08 -08:00
|
|
|
comments: [{
|
2017-05-16 14:01:18 -07:00
|
|
|
id: 'sallys_confession',
|
|
|
|
message: 'i like you, jack',
|
|
|
|
updated: '2015-12-23 15:00:20.396000000',
|
|
|
|
__commentSide: 'left',
|
|
|
|
}, {
|
|
|
|
id: 'jacks_reply',
|
2018-02-05 18:10:01 -08:00
|
|
|
in_reply_to: 'sallys_confession',
|
2017-05-16 14:01:18 -07:00
|
|
|
message: 'i like you, too',
|
2018-02-05 18:10:01 -08:00
|
|
|
updated: '2015-12-24 15:01:20.396000000',
|
2017-05-16 14:01:18 -07:00
|
|
|
__commentSide: 'left',
|
|
|
|
}],
|
2017-02-09 07:34:23 -08:00
|
|
|
patchNum: 3,
|
2018-02-08 09:50:48 -08:00
|
|
|
rootId: 'sallys_confession',
|
2017-01-27 15:33:08 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
start_datetime: '2015-12-24 15:00:10.396000000',
|
2017-01-30 12:03:13 -08:00
|
|
|
commentSide: 'left',
|
2017-01-27 15:33:08 -08:00
|
|
|
comments: [{
|
|
|
|
id: 'betsys_confession',
|
|
|
|
message: 'i like you, jack',
|
|
|
|
updated: '2015-12-24 15:00:10.396000000',
|
|
|
|
range: {
|
|
|
|
start_line: 1,
|
|
|
|
start_character: 1,
|
|
|
|
end_line: 1,
|
|
|
|
end_character: 2,
|
|
|
|
},
|
2017-01-30 12:03:13 -08:00
|
|
|
__commentSide: 'left',
|
2017-01-27 15:33:08 -08:00
|
|
|
}],
|
2017-02-09 07:34:23 -08:00
|
|
|
patchNum: 3,
|
2018-02-08 09:50:48 -08:00
|
|
|
rootId: 'betsys_confession',
|
Correct logic for matching a new comment to its thread in a group
When a new comment is being added to a line, Gerrit checks to see if
there is an existing thread on the same line (and same range, if any) so
that the comment can be appended to it if so. Otherwise, a new thread is
created.
However, following I4f7804ac02, the logic to identify the appropriate
thread by range was refactored to not use range location strings, but
use range objects instead. Problematically, there were two flaws in this
code:
1) The range object references were compared rather than their values.
2) Only new threads were being rendered with their corresponding ranges
whereas existing threads were not.
As a result, if the user attempted to add a line comment on a line with
an existing ranged comment, the ranged comment's thread would be
identified as the destination (because the new comment has no range and
the existing thread's range was not being set). Appending the range-less
comment to a ranged thread resulted in incoherent data and the draft
would be unsavable.
With this change, the logic uses value equality to match ranges and the
`gr-diff-comment-thread-group#_getThreads` method is updated to set the
range on existing threads.
Bug: Issue 8410
Change-Id: If34e0d46a5c1af81bec82125217088fb574a2f61
2018-02-21 12:47:26 -08:00
|
|
|
range: {
|
|
|
|
start_line: 1,
|
|
|
|
start_character: 1,
|
|
|
|
end_line: 1,
|
|
|
|
end_character: 2,
|
|
|
|
},
|
2017-01-27 15:33:08 -08:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
Correct logic for matching a new comment to its thread in a group
When a new comment is being added to a line, Gerrit checks to see if
there is an existing thread on the same line (and same range, if any) so
that the comment can be appended to it if so. Otherwise, a new thread is
created.
However, following I4f7804ac02, the logic to identify the appropriate
thread by range was refactored to not use range location strings, but
use range objects instead. Problematically, there were two flaws in this
code:
1) The range object references were compared rather than their values.
2) Only new threads were being rendered with their corresponding ranges
whereas existing threads were not.
As a result, if the user attempted to add a line comment on a line with
an existing ranged comment, the ranged comment's thread would be
identified as the destination (because the new comment has no range and
the existing thread's range was not being set). Appending the range-less
comment to a ranged thread resulted in incoherent data and the draft
would be unsavable.
With this change, the logic uses value equality to match ranges and the
`gr-diff-comment-thread-group#_getThreads` method is updated to set the
range on existing threads.
Bug: Issue 8410
Change-Id: If34e0d46a5c1af81bec82125217088fb574a2f61
2018-02-21 12:47:26 -08:00
|
|
|
assert.deepEqual(element._getThreads(comments), expectedThreadGroups);
|
2017-01-27 15:33:08 -08:00
|
|
|
});
|
|
|
|
|
2018-02-05 18:10:01 -08:00
|
|
|
test('multiple comments at same location but not threaded', () => {
|
|
|
|
element.patchForNewThreads = 3;
|
|
|
|
const comments = [
|
|
|
|
{
|
|
|
|
id: 'sallys_confession',
|
|
|
|
message: 'i like you, jack',
|
|
|
|
updated: '2015-12-23 15:00:20.396000000',
|
|
|
|
__commentSide: 'left',
|
|
|
|
}, {
|
|
|
|
id: 'jacks_reply',
|
|
|
|
message: 'i like you, too',
|
|
|
|
updated: '2015-12-24 15:01:20.396000000',
|
|
|
|
__commentSide: 'left',
|
|
|
|
},
|
|
|
|
];
|
Correct logic for matching a new comment to its thread in a group
When a new comment is being added to a line, Gerrit checks to see if
there is an existing thread on the same line (and same range, if any) so
that the comment can be appended to it if so. Otherwise, a new thread is
created.
However, following I4f7804ac02, the logic to identify the appropriate
thread by range was refactored to not use range location strings, but
use range objects instead. Problematically, there were two flaws in this
code:
1) The range object references were compared rather than their values.
2) Only new threads were being rendered with their corresponding ranges
whereas existing threads were not.
As a result, if the user attempted to add a line comment on a line with
an existing ranged comment, the ranged comment's thread would be
identified as the destination (because the new comment has no range and
the existing thread's range was not being set). Appending the range-less
comment to a ranged thread resulted in incoherent data and the draft
would be unsavable.
With this change, the logic uses value equality to match ranges and the
`gr-diff-comment-thread-group#_getThreads` method is updated to set the
range on existing threads.
Bug: Issue 8410
Change-Id: If34e0d46a5c1af81bec82125217088fb574a2f61
2018-02-21 12:47:26 -08:00
|
|
|
assert.equal(element._getThreads(comments).length, 2);
|
2018-02-05 18:10:01 -08:00
|
|
|
});
|
|
|
|
|
2017-05-16 14:01:18 -07:00
|
|
|
test('_sortByDate', () => {
|
|
|
|
let threadGroups = [
|
2017-01-27 15:33:08 -08:00
|
|
|
{
|
|
|
|
start_datetime: '2015-12-23 15:00:20.396000000',
|
|
|
|
comments: [],
|
|
|
|
locationRange: 'line',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
start_datetime: '2015-12-22 15:00:10.396000000',
|
|
|
|
comments: [],
|
|
|
|
locationRange: 'range-1-1-1-2',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2017-05-16 14:01:18 -07:00
|
|
|
let expectedResult = [
|
2017-01-27 15:33:08 -08:00
|
|
|
{
|
|
|
|
start_datetime: '2015-12-22 15:00:10.396000000',
|
|
|
|
comments: [],
|
|
|
|
locationRange: 'range-1-1-1-2',
|
2017-05-16 14:01:18 -07:00
|
|
|
}, {
|
2017-01-27 15:33:08 -08:00
|
|
|
start_datetime: '2015-12-23 15:00:20.396000000',
|
|
|
|
comments: [],
|
|
|
|
locationRange: 'line',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
assert.deepEqual(element._sortByDate(threadGroups), expectedResult);
|
Move reply buttons to comment thread
Move all buttons that generate a reply of some sort (done, ack, reply,
quote) to the comment thread instead of the comment [1].
When there is a draft for a particular comment thread, all reply buttons
are hidden [2]. For example, if you click reply, you cannot click done
on the same thread, unless you remove the draft.
Each thread can have up to 1 draft. It's also worth noting that if a
thread has a draft, and the user clicks on the line or 'c' at the same
range, the existing draft will switch to 'editing' form.
[1] With the exception of "please fix" for robot comments.
[2] In this case, The please fix button will be disabled when other
reply buttons are hidden.
Feature: Issue 5410
Change-Id: Id847ee0cba0d0ce4e5b6476f58141866d41ffdad
2017-02-09 16:07:32 -08:00
|
|
|
|
|
|
|
// When a comment doesn't have a date, the one without the date should be
|
|
|
|
// last.
|
2017-05-16 14:01:18 -07:00
|
|
|
threadGroups = [
|
Move reply buttons to comment thread
Move all buttons that generate a reply of some sort (done, ack, reply,
quote) to the comment thread instead of the comment [1].
When there is a draft for a particular comment thread, all reply buttons
are hidden [2]. For example, if you click reply, you cannot click done
on the same thread, unless you remove the draft.
Each thread can have up to 1 draft. It's also worth noting that if a
thread has a draft, and the user clicks on the line or 'c' at the same
range, the existing draft will switch to 'editing' form.
[1] With the exception of "please fix" for robot comments.
[2] In this case, The please fix button will be disabled when other
reply buttons are hidden.
Feature: Issue 5410
Change-Id: Id847ee0cba0d0ce4e5b6476f58141866d41ffdad
2017-02-09 16:07:32 -08:00
|
|
|
{
|
|
|
|
start_datetime: '2015-12-23 15:00:20.396000000',
|
|
|
|
comments: [],
|
|
|
|
locationRange: 'line',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
comments: [],
|
|
|
|
locationRange: 'range-1-1-1-2',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2017-05-16 14:01:18 -07:00
|
|
|
expectedResult = [
|
Move reply buttons to comment thread
Move all buttons that generate a reply of some sort (done, ack, reply,
quote) to the comment thread instead of the comment [1].
When there is a draft for a particular comment thread, all reply buttons
are hidden [2]. For example, if you click reply, you cannot click done
on the same thread, unless you remove the draft.
Each thread can have up to 1 draft. It's also worth noting that if a
thread has a draft, and the user clicks on the line or 'c' at the same
range, the existing draft will switch to 'editing' form.
[1] With the exception of "please fix" for robot comments.
[2] In this case, The please fix button will be disabled when other
reply buttons are hidden.
Feature: Issue 5410
Change-Id: Id847ee0cba0d0ce4e5b6476f58141866d41ffdad
2017-02-09 16:07:32 -08:00
|
|
|
{
|
|
|
|
start_datetime: '2015-12-23 15:00:20.396000000',
|
|
|
|
comments: [],
|
|
|
|
locationRange: 'line',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
comments: [],
|
|
|
|
locationRange: 'range-1-1-1-2',
|
|
|
|
},
|
|
|
|
];
|
2017-05-16 14:01:18 -07:00
|
|
|
|
|
|
|
assert.deepEqual(element._sortByDate(threadGroups), expectedResult);
|
2017-01-27 15:33:08 -08:00
|
|
|
});
|
|
|
|
|
2017-05-16 14:01:18 -07:00
|
|
|
test('_calculateLocationRange', () => {
|
|
|
|
const comment = {__commentSide: 'left'};
|
|
|
|
const range = {
|
2017-01-27 15:33:08 -08:00
|
|
|
start_line: 1,
|
|
|
|
start_character: 2,
|
|
|
|
end_line: 3,
|
|
|
|
end_character: 4,
|
|
|
|
};
|
2017-01-30 12:03:13 -08:00
|
|
|
assert.equal(
|
2017-05-16 14:01:18 -07:00
|
|
|
element._calculateLocationRange(range, comment),
|
|
|
|
'range-1-2-3-4-left');
|
2017-01-27 15:33:08 -08:00
|
|
|
});
|
|
|
|
|
2017-05-16 14:01:18 -07:00
|
|
|
test('thread groups are updated when comments change', () => {
|
|
|
|
const commentsChangedStub = sandbox.stub(element, '_commentsChanged');
|
2017-01-27 15:33:08 -08:00
|
|
|
element.comments = [];
|
|
|
|
element.comments.push({
|
|
|
|
id: 'sallys_confession',
|
|
|
|
message: 'i like you, jack',
|
|
|
|
updated: '2015-12-23 15:00:20.396000000',
|
|
|
|
});
|
|
|
|
assert(commentsChangedStub.called);
|
|
|
|
});
|
|
|
|
|
2017-05-16 14:01:18 -07:00
|
|
|
test('addNewThread', () => {
|
|
|
|
const locationRange = 'range-1-2-3-4';
|
2017-02-09 07:34:23 -08:00
|
|
|
element._threads = [{locationRange: 'line'}];
|
2017-01-27 15:33:08 -08:00
|
|
|
element.addNewThread(locationRange);
|
2017-02-09 07:34:23 -08:00
|
|
|
assert(element._threads.length, 2);
|
|
|
|
});
|
|
|
|
|
2017-05-16 14:01:18 -07:00
|
|
|
test('_getPatchNum', () => {
|
2017-02-09 07:34:23 -08:00
|
|
|
element.patchForNewThreads = 3;
|
2017-05-16 14:01:18 -07:00
|
|
|
const comment = {
|
2017-02-09 07:34:23 -08:00
|
|
|
id: 'sallys_confession',
|
|
|
|
message: 'i like you, jack',
|
|
|
|
updated: '2015-12-23 15:00:20.396000000',
|
|
|
|
};
|
|
|
|
assert.equal(element._getPatchNum(comment), 3);
|
|
|
|
comment.patchNum = 4;
|
|
|
|
assert.equal(element._getPatchNum(comment), 4);
|
2017-01-27 15:33:08 -08:00
|
|
|
});
|
|
|
|
|
2017-05-16 14:01:18 -07:00
|
|
|
test('removeThread', () => {
|
|
|
|
const locationRange = 'range-1-2-3-4';
|
2017-02-09 07:34:23 -08:00
|
|
|
element._threads = [
|
2017-01-27 15:33:08 -08:00
|
|
|
{locationRange: 'range-1-2-3-4', comments: []},
|
2017-05-16 14:01:18 -07:00
|
|
|
{locationRange: 'line', comments: []},
|
2017-01-27 15:33:08 -08:00
|
|
|
];
|
|
|
|
flushAsynchronousOperations();
|
|
|
|
element.removeThread(locationRange);
|
|
|
|
flushAsynchronousOperations();
|
2017-02-09 07:34:23 -08:00
|
|
|
assert(element._threads.length, 1);
|
2017-01-27 15:33:08 -08:00
|
|
|
});
|
Correct logic for matching a new comment to its thread in a group
When a new comment is being added to a line, Gerrit checks to see if
there is an existing thread on the same line (and same range, if any) so
that the comment can be appended to it if so. Otherwise, a new thread is
created.
However, following I4f7804ac02, the logic to identify the appropriate
thread by range was refactored to not use range location strings, but
use range objects instead. Problematically, there were two flaws in this
code:
1) The range object references were compared rather than their values.
2) Only new threads were being rendered with their corresponding ranges
whereas existing threads were not.
As a result, if the user attempted to add a line comment on a line with
an existing ranged comment, the ranged comment's thread would be
identified as the destination (because the new comment has no range and
the existing thread's range was not being set). Appending the range-less
comment to a ranged thread resulted in incoherent data and the draft
would be unsavable.
With this change, the logic uses value equality to match ranges and the
`gr-diff-comment-thread-group#_getThreads` method is updated to set the
range on existing threads.
Bug: Issue 8410
Change-Id: If34e0d46a5c1af81bec82125217088fb574a2f61
2018-02-21 12:47:26 -08:00
|
|
|
|
|
|
|
test('_rangesEqual', () => {
|
|
|
|
const range1 =
|
|
|
|
{startLine: 123, startChar: 345, endLine: 234, endChar: 456};
|
|
|
|
const range2 =
|
|
|
|
{startLine: 1, startChar: 2, endLine: 3, endChar: 4};
|
|
|
|
|
|
|
|
assert.isTrue(element._rangesEqual(null, null));
|
|
|
|
assert.isTrue(element._rangesEqual(null, undefined));
|
|
|
|
assert.isTrue(element._rangesEqual(undefined, null));
|
|
|
|
assert.isTrue(element._rangesEqual(undefined, undefined));
|
|
|
|
|
|
|
|
assert.isFalse(element._rangesEqual(range1, null));
|
|
|
|
assert.isFalse(element._rangesEqual(null, range1));
|
|
|
|
assert.isFalse(element._rangesEqual(range1, range2));
|
|
|
|
|
|
|
|
assert.isTrue(element._rangesEqual(range1, Object.assign({}, range1)));
|
|
|
|
});
|
2017-01-27 15:33:08 -08:00
|
|
|
});
|
|
|
|
</script>
|