Bug 947615 - Event description shows escaped comma and line breaks;r=philipp

--HG--
extra : histedit_source : 722a27486b2d38d41a91be2f2a5ab407269a32cc
This commit is contained in:
MakeMyDay 2014-10-05 21:30:37 +02:00
Родитель abc7f5ba55
Коммит f482c97886
2 изменённых файлов: 31 добавлений и 5 удалений

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

@ -30,20 +30,23 @@ calIcalProperty.prototype = {
get parent() this.innerObject.parent,
toString: function() this.innerObject.toICAL(),
get value() {
get value() this.innerObject.getValues().join(","),
set value(val) {
this.innerObject.setValue(val);
return val;
},
get valueAsIcalString() {
let type = this.innerObject.type;
function stringifyValue(x) ICAL.stringify.value(x.toString(), type);
return this.innerObject.getValues().map(stringifyValue).join(",");
},
set value(val) {
set valueAsIcalString(val) {
var icalval = ICAL.parse._parseValue(val, this.innerObject.type);
this.innerObject.setValue(icalval);
return val;
},
get valueAsIcalString() this.value,
set valueAsIcalString(val) this.value = val,
get valueAsDatetime() {
let val = this.innerObject.getFirstValue();
let isIcalTime = val && (typeof val == "object") &&

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

@ -106,6 +106,11 @@ function test_icsservice() {
{ value: "http://example.com/test.ics", propertyName: "ATTACH" },
{ ENCODING: "BASE64", FMTTYPE: "text/calendar", FILENAME: "test.ics" });
checkProp(svc.createIcalPropertyFromString.bind(svc),
"DESCRIPTION:new\\nlines\\nare\\ngreat\\,eh?",
{ value: "new\nlines\nare\ngreat,eh?",
valueAsIcalString: "new\\nlines\\nare\\ngreat\\,eh?" }, {});
// Test ::createIcalProperty
let attach2 = svc.createIcalProperty("ATTACH");
do_check_eq(attach2.propertyName, "ATTACH");
@ -122,6 +127,24 @@ function test_icalproperty() {
comp.addProperty(prop);
do_check_eq(prop.parent.toString(), comp.toString());
do_check_eq(prop.valueAsDatetime, null);
prop = svc.createIcalProperty("PROP");
prop.value = "A\nB";
do_check_eq(prop.value, "A\nB");
do_check_eq(prop.valueAsIcalString, "A\\nB");
do_check_eq(prop.valueAsDatetime, null);
prop = svc.createIcalProperty("PROP");
prop.valueAsIcalString = "A\\nB";
do_check_eq(prop.value, "A\nB");
do_check_eq(prop.valueAsIcalString, "A\\nB");
do_check_eq(prop.valueAsDatetime, null);
prop = svc.createIcalProperty("PROP");
prop.value = "A\\nB";
do_check_eq(prop.value, "A\\nB");
do_check_eq(prop.valueAsIcalString, "A\\\\nB");
do_check_eq(prop.valueAsDatetime, null);
}
function test_icalcomponent() {