зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1288529 - New console frontend: Handle console.count calls without label. r=me
--HG-- extra : rebase_source : 8634895d2950705bb2a79b03ea21158d3717fdf5
This commit is contained in:
Родитель
6415eb5945
Коммит
d72dd2ca63
|
@ -44,8 +44,16 @@ function testConsoleCount() {
|
|||
|
||||
const expected = `bar: ${i + 1}`;
|
||||
is(messageBody.textContent, expected,
|
||||
"console.count has the expected text content: ${expected}");
|
||||
`console.count has the expected text content: "${expected}"`);
|
||||
}
|
||||
|
||||
const packet = yield getPacket("console.count()", "consoleAPICall")
|
||||
const message = prepareMessage(packet);
|
||||
const rendered = renderComponent(ConsoleApiCall, {message: message});
|
||||
const messageBody = getMessageBody(rendered);
|
||||
const expected = "<no label>: 1";
|
||||
is(messageBody.textContent, expected,
|
||||
`console.count without label has the expected text content: "${expected}"`);
|
||||
}
|
||||
|
||||
function getMessageBody(renderedComponent) {
|
||||
|
|
|
@ -58,7 +58,9 @@ function transformPacket(packet) {
|
|||
// Chrome RDP doesn't have a special type for count.
|
||||
type = MESSAGE_TYPE.LOG;
|
||||
level = MESSAGE_LEVEL.DEBUG;
|
||||
messageText = `${message.counter.label}: ${message.counter.count}`;
|
||||
let {counter} = message;
|
||||
let label = counter.label ? counter.label : l10n.getStr("noCounterLabel");
|
||||
messageText = `${label}: ${counter.count}`;
|
||||
parameters = null;
|
||||
break;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче