Bug 1308742 - Preserve line breaks in String rep; r=linclark

This commit is contained in:
Jan Odvarko 2016-10-17 15:58:49 +02:00
Родитель 95701b6cbf
Коммит 4e97bb7842
2 изменённых файлов: 6 добавлений и 5 удалений

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

@ -10,7 +10,7 @@
define(function (require, exports, module) {
// Dependencies
const React = require("devtools/client/shared/vendor/react");
const { cropMultipleLines } = require("./rep-utils");
const { cropString } = require("./rep-utils");
// Shortcuts
const { span } = React.DOM;
@ -43,13 +43,14 @@ define(function (require, exports, module) {
}
let croppedString = this.props.cropLimit ?
cropMultipleLines(text, this.props.cropLimit) : cropMultipleLines(text);
cropString(text, this.props.cropLimit) : cropString(text);
let formattedString = this.props.useQuotes ?
"\"" + croppedString + "\"" : croppedString;
return (
span({className: "objectBox objectBox-string"}, formattedString
span({className: "objectBox objectBox-string"},
formattedString
)
);
},

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

@ -36,12 +36,12 @@ window.onload = Task.async(function* () {
function testMultiline() {
const renderedComponent = renderComponent(StringRep.rep, { object: getGripStub("testMultiline") });
is(renderedComponent.textContent, "\"aaaaaaaaaaaaaaaaaaaaa\\nbbbbbbbbbbbbbbbbbbb\\ncccccccccccccccc\\n\"", "String rep has expected text content for multiline string");
is(renderedComponent.textContent, "\"aaaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbb\ncccccccccccccccc\n\"", "String rep has expected text content for multiline string");
}
function testMultilineLimit() {
const renderedComponent = renderComponent(StringRep.rep, { object: getGripStub("testMultiline"), cropLimit: 20 });
is(renderedComponent.textContent, "\"aaaaaaaaaa…cccccccc\\n\"", "String rep has expected text content for multiline string with specified number of characters");
is(renderedComponent.textContent, "\"aaaaaaaaaa…cccccccc\n\"", "String rep has expected text content for multiline string with specified number of characters");
}
function testMultilineOpen() {