Bug 1284843 - Reps: Don't add quotes around strings. r=linclark

--HG--
extra : amend_source : 6b1ad815c9c3696f5b4c81a2b31809eec02d0d7e
This commit is contained in:
Hemanth Kumar Veeranki 2016-08-03 10:49:00 -04:00
Родитель f806b3f7de
Коммит c5639fb958
2 изменённых файлов: 14 добавлений и 2 удалений

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

@ -35,8 +35,11 @@ define(function (require, exports, module) {
let croppedString = this.props.cropLimit ?
cropMultipleLines(text, this.props.cropLimit) : cropMultipleLines(text);
let formattedString = this.props.omitQuotes ?
croppedString : "\"" + croppedString + "\"";
return (
span({className: "objectBox objectBox-string"}, "\"" + croppedString + "\""
span({className: "objectBox objectBox-string"}, formattedString
)
);
},

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

@ -27,6 +27,7 @@ window.onload = Task.async(function* () {
yield testMultiline();
yield testMultilineOpen();
yield testMultilineLimit();
yield testOmitQuotes();
} catch(e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
@ -48,10 +49,18 @@ window.onload = Task.async(function* () {
is(renderedComponent.textContent, "\"aaaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbb\ncccccccccccccccc\n\"", "String rep has expected text content for multiline string when open");
}
function testOmitQuotes(){
const renderedComponent = renderComponent(StringRep.rep, { object: getGripStub("testOmitQuotes"), omitQuotes: true });
is(renderedComponent.textContent, "abc","String rep has expected to omit quotes");
}
function getGripStub(name) {
switch (name) {
case "testMultiline":
return "aaaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbb\ncccccccccccccccc\n";
break;
case "testOmitQuotes":
return "abc";
}
}
});