Bug 1393609 - Add a test for line-height in console.log custom style; r=nchevobbe.

MozReview-Commit-ID: BD2fjv6u4b2

--HG--
extra : rebase_source : 8943437bc2756334000ad7fe162dd8bdeeb6c72e
This commit is contained in:
ewhite7 2018-01-05 21:33:53 -05:00
Родитель da3e572a83
Коммит 7166c3c714
4 изменённых файлов: 23 добавлений и 18 удалений

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

@ -62,6 +62,7 @@ describe("ConsoleAPICall component:", () => {
const secondElementStyle = elements.eq(1).prop("style");
// Allowed styles are applied accordingly on the second element.
expect(secondElementStyle.color).toBe(`red`);
expect(secondElementStyle["line-height"]).toBe("1.5");
// Forbidden styles are not applied.
expect(secondElementStyle.background).toBe(undefined);
});

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

@ -94,15 +94,18 @@ function getCleanedPacket(key, packet) {
let newArgument = Object.assign({}, argument);
let existingArgument = existingPacket.message.arguments[i];
// Clean actor ids on each message.arguments item.
if (newArgument.actor) {
newArgument.actor = existingArgument.actor;
}
// `window`'s properties count can vary from OS to OS, so we
// clean the `ownPropertyLength` property from the grip.
if (newArgument.class === "Window") {
newArgument.ownPropertyLength = existingArgument.ownPropertyLength;
if (existingArgument) {
// Clean actor ids on each message.arguments item.
if (newArgument.actor) {
newArgument.actor = existingArgument.actor;
}
// `window`'s properties count can vary from OS to OS, so we
// clean the `ownPropertyLength` property from the grip.
if (newArgument.class === "Window") {
newArgument.ownPropertyLength = existingArgument.ownPropertyLength;
}
}
return newArgument;
});

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

@ -106,8 +106,9 @@ consoleApi.set("console.log(%cfoobar)", {
code: `
console.log(
"%cfoo%cbar",
"color:blue;font-size:1.3em;background:url('http://example.com/test');position:absolute;top:10px",
"color:red;background:\\165rl('http://example.com/test')");
"color:blue; font-size:1.3em; background:url('http://example.com/test'); position:absolute; top:10px; ",
"color:red; line-height: 1.5; background:\\165rl('http://example.com/test')"
);
`});
consoleApi.set("console.group(%cfoo%cbar)", {

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

@ -1105,7 +1105,7 @@ stubPreparedMessages.set(`console.log(%cfoobar)`, new ConsoleMessage({
"foo",
"bar"
],
"repeatId": "{\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":2,\"column\":1},\"groupId\":null,\"indent\":0,\"level\":\"log\",\"messageText\":null,\"parameters\":[\"foo\",\"bar\"],\"source\":\"console-api\",\"type\":\"log\",\"userProvidedStyles\":[\"color:blue;font-size:1.3em;background:url('http://example.com/test');position:absolute;top:10px\",\"color:red;background:url('http://example.com/test')\"]}",
"repeatId": "{\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":2,\"column\":1},\"groupId\":null,\"indent\":0,\"level\":\"log\",\"messageText\":null,\"parameters\":[\"foo\",\"bar\"],\"source\":\"console-api\",\"type\":\"log\",\"userProvidedStyles\":[\"color:blue; font-size:1.3em; background:url('http://example.com/test'); position:absolute; top:10px; \",\"color:red; line-height: 1.5; background:url('http://example.com/test')\"]}",
"stacktrace": null,
"frame": {
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html",
@ -1115,8 +1115,8 @@ stubPreparedMessages.set(`console.log(%cfoobar)`, new ConsoleMessage({
"groupId": null,
"exceptionDocURL": null,
"userProvidedStyles": [
"color:blue;font-size:1.3em;background:url('http://example.com/test');position:absolute;top:10px",
"color:red;background:url('http://example.com/test')"
"color:blue; font-size:1.3em; background:url('http://example.com/test'); position:absolute; top:10px; ",
"color:red; line-height: 1.5; background:url('http://example.com/test')"
],
"notes": null,
"indent": 0
@ -1242,7 +1242,7 @@ stubPreparedMessages.set(`console.dir({C, M, Y, K})`, new ConsoleMessage({
"parameters": [
{
"type": "object",
"actor": "server1.conn0.child1/obj40",
"actor": "server1.conn0.child1/obj36",
"class": "Object",
"extensible": true,
"frozen": false,
@ -1283,7 +1283,7 @@ stubPreparedMessages.set(`console.dir({C, M, Y, K})`, new ConsoleMessage({
}
}
],
"repeatId": "{\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":1,\"column\":27},\"groupId\":null,\"indent\":0,\"level\":\"log\",\"messageText\":null,\"parameters\":[{\"type\":\"object\",\"actor\":\"server1.conn0.child1/obj40\",\"class\":\"Object\",\"extensible\":true,\"frozen\":false,\"sealed\":false,\"ownPropertyLength\":4,\"preview\":{\"kind\":\"Object\",\"ownProperties\":{\"cyan\":{\"configurable\":true,\"enumerable\":true,\"writable\":true,\"value\":\"C\"},\"magenta\":{\"configurable\":true,\"enumerable\":true,\"writable\":true,\"value\":\"M\"},\"yellow\":{\"configurable\":true,\"enumerable\":true,\"writable\":true,\"value\":\"Y\"},\"black\":{\"configurable\":true,\"enumerable\":true,\"writable\":true,\"value\":\"K\"}},\"ownSymbols\":[],\"ownPropertiesLength\":4,\"ownSymbolsLength\":0,\"safeGetterValues\":{}}}],\"source\":\"console-api\",\"type\":\"dir\",\"userProvidedStyles\":[]}",
"repeatId": "{\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":1,\"column\":27},\"groupId\":null,\"indent\":0,\"level\":\"log\",\"messageText\":null,\"parameters\":[{\"type\":\"object\",\"actor\":\"server1.conn0.child1/obj36\",\"class\":\"Object\",\"extensible\":true,\"frozen\":false,\"sealed\":false,\"ownPropertyLength\":4,\"preview\":{\"kind\":\"Object\",\"ownProperties\":{\"cyan\":{\"configurable\":true,\"enumerable\":true,\"writable\":true,\"value\":\"C\"},\"magenta\":{\"configurable\":true,\"enumerable\":true,\"writable\":true,\"value\":\"M\"},\"yellow\":{\"configurable\":true,\"enumerable\":true,\"writable\":true,\"value\":\"Y\"},\"black\":{\"configurable\":true,\"enumerable\":true,\"writable\":true,\"value\":\"K\"}},\"ownSymbols\":[],\"ownPropertiesLength\":4,\"ownSymbolsLength\":0,\"safeGetterValues\":{}}}],\"source\":\"console-api\",\"type\":\"dir\",\"userProvidedStyles\":[]}",
"stacktrace": null,
"frame": {
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html",
@ -2578,8 +2578,8 @@ stubPackets.set(`console.log(%cfoobar)`, {
"prefix": "",
"private": false,
"styles": [
"color:blue;font-size:1.3em;background:url('http://example.com/test');position:absolute;top:10px",
"color:red;background:url('http://example.com/test')"
"color:blue; font-size:1.3em; background:url('http://example.com/test'); position:absolute; top:10px; ",
"color:red; line-height: 1.5; background:url('http://example.com/test')"
],
"timeStamp": 1502884924883,
"timer": null,
@ -2700,7 +2700,7 @@ stubPackets.set(`console.dir({C, M, Y, K})`, {
"arguments": [
{
"type": "object",
"actor": "server1.conn0.child1/obj40",
"actor": "server1.conn0.child1/obj36",
"class": "Object",
"extensible": true,
"frozen": false,