Bug 1288529 - New console frontend: Handle console.count calls without label. r=me

--HG--
extra : rebase_source : 8634895d2950705bb2a79b03ea21158d3717fdf5
This commit is contained in:
Nicolas Chevobbe 2016-07-21 22:43:48 +02:00
Родитель 6415eb5945
Коммит d72dd2ca63
2 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -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;
}