issue 2263, and tests

This commit is contained in:
Adam Shaw
2014-08-29 17:03:17 -07:00
parent abaac59218
commit fcf579bcb5
3 changed files with 50 additions and 1 deletions
+8 -1
View File
@@ -145,7 +145,14 @@ $.extend(TimeGrid.prototype, {
}
return '<a class="' + classes.join(' ') + '"' +
(skinCss ? ' style="' + skinCss + '"' : '') +
(event.url ?
' href="' + htmlEscape(event.url) + '"' :
''
) +
(skinCss ?
' style="' + skinCss + '"' :
''
) +
'>' +
'<div class="fc-content">' +
(timeText ?
+21
View File
@@ -34,4 +34,25 @@ describe('DayGrid event rendering', function() {
expect(row0event1.offset().top).toBeLessThan(row0event2.offset().top);
expect(row1event1.offset().top).toBeLessThan(row1event2.offset().top);
});
it('renders an event with no url with no <a> href', function() {
options.events = [ {
title: 'event1',
start: '2014-08-01'
} ];
$('#cal').fullCalendar(options);
var seg = $('.fc-event');
expect(seg).not.toHaveAttr('href');
});
it('renders an event with a url with an <a> href', function() {
options.events = [ {
title: 'event1',
start: '2014-08-01',
url: 'http://google.com/'
} ];
$('#cal').fullCalendar(options);
var seg = $('.fc-event');
expect(seg).toHaveAttr('href');
});
});
+21
View File
@@ -46,4 +46,25 @@ describe('TimeGrid event rendering', function() {
expect(seg2.find('.fc-time')).not.toBeInDOM();
});
it('renders an event with no url with no <a> href', function() {
options.events = [ {
title: 'event1',
start: '2014-08-18T02:00:00'
} ];
$('#cal').fullCalendar(options);
var seg = $('.fc-event');
expect(seg).not.toHaveAttr('href');
});
it('renders an event with a url with an <a> href', function() {
options.events = [ {
title: 'event1',
start: '2014-08-18T02:00:00',
url: 'http://google.com/'
} ];
$('#cal').fullCalendar(options);
var seg = $('.fc-event');
expect(seg).toHaveAttr('href');
});
});