describe("View", function() {
it("is the object that helps the UI", function() {
expect(typeof View === "object").toBeTruthy();
});
describe("initialize", function() {
it("is called on DOM ready", function() {
spyOn(View, "initialize");
$(View.initialize);
expect(View.initialize).toHaveBeenCalled();
});
});
describe("fancyBoxButtons", function() {
describe("selectors", function() {
it("is an array of all the selectors that will have fancybox attached", function() {
expect(typeof View.fancyBoxButtons.selectors === "object").toBeTruthy();
expect($.isArray(View.fancyBoxButtons.selectors)).toBeTruthy();
});
});
});
describe("debug", function() {
describe("click", function() {
beforeEach(function() {
jasmine.Clock.useMock();
$("#jasmine_content").html(
'
' +
'
DEBUG INFO
' +
'
' +
'DEBUG INFO' +
'
' +
'
'
);
});
it("is called when the user clicks an element matching the selector", function() {
spyOn(View.debug, "click");
View.initialize();
$(View.debug.selector).click();
jasmine.Clock.tick(200);
expect(View.debug.click).toHaveBeenCalled();
expect($(View.debug.selector).css("display")).toEqual("block");
});
});
});
describe("flashes", function() {
describe("animate", function() {
beforeEach(function() {
$("#jasmine_content").html(
'' +
'flash! flash! flash!' +
'
'
);
});
it("is called when the DOM is ready", function() {
spyOn(View.flashes, "animate").andCallThrough();
View.initialize();
expect(View.flashes.animate).toHaveBeenCalled();
});
});
});
describe("newRequest", function() {
beforeEach(function() {
$("#jasmine_content").html(
'