我在 Rails 应用程序中使用fullcalendar并想测试我在使用Konacha时使用它的页面。
在一个名为 的文件fullcal_init
中,我有以下(工作)代码
jQuery(document).ready(function($) {
$('#calendar').fullCalendar({
//do stuff with fullCalendar
});
});
这会产生<div id="calendar" class="fc fc-ltr" ... ></div>
我正在尝试使用以下代码对其进行测试:
#test_helper
//= require jquery
//= require chai-jquery
//= require "application"
...
#my_tests.js
//= require "test_helper"
var $ = jQuery
"use strict";
describe('fullcalendar_init', function() {
it('renders the fullCalendar event stream', function() {
('#konacha').fullCalendar;
assert.ok($('#konacha').should.have.class('fc'));
});
});
然而,这不起作用 - Konacha 测试主体没有附加任何类。没有很多关于使用 Konacha 的文档(尤其是在backbone.js
上下文之外) - 任何人都可以指出我如何测试fullcalendar
正在初始化的正确方向吗?