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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
requireRequest();
testSupport.lib('templates/calendar_data');
suite('webcals/templates/calendar_data', function() {
var CalendarData;
var Template;
var subject;
var template;
function select() {
subject.select('VTODO', ['DTIME']);
subject.select('VTODO', ['NAME', { VTIMEZONE: true }]);
subject.select('VEVENT', ['NAME', {
'VALARM': ['NAME']
}]);
}
suiteSetup(function() {
CalendarData = Webcals.require('templates/calendar_data');
Template = Webcals.require('template');
});
setup(function() {
subject = new CalendarData();
template = new Template('root');
});
test('initialization', function() {
assert.deepEqual(subject.struct, {});
});
suite('#render', function() {
var output;
var expected;
expected = [
'<N0:calendar-data>',
'<N0:comp name="VCALENDAR">',
'<N0:comp name="VTODO">',
'<N0:prop name="DTIME" />',
'<N0:prop name="NAME" />',
'<N0:comp name="VTIMEZONE" />',
'</N0:comp>',
'<N0:comp name="VEVENT">',
'<N0:prop name="NAME" />',
'<N0:comp name="VALARM">',
'<N0:prop name="NAME" />',
'</N0:comp>',
'</N0:comp>',
'</N0:comp>',
'</N0:calendar-data>'
].join('');
test('without items', function() {
var output = subject.render(template);
assert.equal(
output,
'<N0:calendar-data />'
);
});
test('output', function() {
select();
var output = subject.render(template);
assert.equal(output, expected);
});
});
});
|