Move triggering thread creation to gr-diff-host
This is a step towards allowing code using gr-diff pick their own
comment widget. The threads are still created by
gr-diff-comment-thread-group in this commit - only the triggering is
moved. But that will change in a future CL.
Change-Id: If42b07df11422b69e7e1421c15e923d208012b47
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host_test.html b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host_test.html
index f83253e..3374686 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host_test.html
+++ b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host_test.html
@@ -776,6 +776,29 @@
});
});
+ test('_getOrCreateThread', () => {
+ const threadGroupEl =
+ document.createElement('gr-diff-comment-thread-group');
+ const commentSide = 'left';
+
+ assert.isOk(element._getOrCreateThread(threadGroupEl,
+ commentSide));
+
+ // Try to fetch a thread with a different range.
+ range = {
+ startLine: 1,
+ startChar: 1,
+ endLine: 1,
+ endChar: 3,
+ };
+
+ assert.isOk(element._getOrCreateThread(
+ threadGroupEl, commentSide, range));
+ const threadCount = Polymer.dom(threadGroupEl.root).
+ querySelectorAll('gr-diff-comment-thread').length;
+ assert.equal(threadCount, 2);
+ });
+
suite('_translateChunksToIgnore', () => {
let content;