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
parent f806b3f7de
commit c5639fb958
2 changed files with 14 additions and 2 deletions

View File

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

View File

@ -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";
return "aaaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbb\ncccccccccccccccc\n";
break;
case "testOmitQuotes":
return "abc";
}
}
});