1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var { CalItipEmailTransport } = ChromeUtils.import("resource:///modules/CalItipEmailTransport.jsm");
function itipItemForTest(title, seq) {
let itipItem = Cc["@mozilla.org/calendar/itip-item;1"].createInstance(Ci.calIItipItem);
itipItem.init(
[
"BEGIN:VCALENDAR",
"METHOD:REQUEST",
"BEGIN:VEVENT",
"SUMMARY:" + title,
"SEQUENCE:" + (seq || 0),
"END:VEVENT",
"END:VCALENDAR",
].join("\r\n")
);
return itipItem;
}
let transport = new CalItipEmailTransport();
add_task(function test_title_in_subject() {
Services.prefs.setBoolPref("calendar.itip.useInvitationSubjectPrefixes", false);
let items = transport._prepareItems(itipItemForTest("foo"));
equal(items.subject, "foo");
});
add_task(function test_title_in_summary() {
Services.prefs.setBoolPref("calendar.itip.useInvitationSubjectPrefixes", true);
let items = transport._prepareItems(itipItemForTest("bar"));
equal(items.subject, "Invitation: bar");
});
add_task(function test_updated_title_in_subject() {
Services.prefs.setBoolPref("calendar.itip.useInvitationSubjectPrefixes", false);
let items = transport._prepareItems(itipItemForTest("foo", 2));
equal(items.subject, "foo");
});
add_task(function test_updated_title_in_summary() {
Services.prefs.setBoolPref("calendar.itip.useInvitationSubjectPrefixes", true);
let items = transport._prepareItems(itipItemForTest("bar", 2));
equal(items.subject, "Updated: bar");
});
|