Fix reporting messages tags count

Report interaction accepts only type object for parameter details

Change-Id: Id095b12baf34b824445bcf4ea16cdfeeeac93e6b
This commit is contained in:
Milutin Kristofic
2020-02-04 11:03:19 +01:00
parent 6734cce159
commit 624428d261
2 changed files with 18 additions and 2 deletions

View File

@@ -367,8 +367,7 @@
acc[val] = (acc[val] || 0) + 1;
return acc;
}, {all: messages.length});
this.$.reporting.reportInteraction('messages-count',
JSON.stringify(tagsCounted));
this.$.reporting.reportInteraction('messages-count', tagsCounted);
}
}

View File

@@ -553,6 +553,23 @@ limitations under the License.
assert.isFalse(element._hasAutomatedMessages(messages));
});
test('initially show only 20 messages', () => {
sandbox.stub(element.$.reporting, 'reportInteraction',
(eventName, details) => {
assert.equal(typeof(eventName), 'string');
if (details) {
assert.equal(typeof(details), 'object');
}
});
const messages = Array.from(Array(23).keys())
.map(() => {
return {};
});
element._processedMessagesChanged(messages);
assert.equal(element._visibleMessages.length, 20);
});
test('_computeLabelExtremes', () => {
const computeSpy = sandbox.spy(element, '_computeLabelExtremes');