Sha256: 40efd4a809eeda63900ad149408df4670d64c85c7ea511468b877425177ca43b
Contents?: true
Size: 1.13 KB
Versions: 42
Compression:
Stored size: 1.13 KB
Contents
describe("ServerDocView", function(){ beforeEach(function(){ var session = new Session(); session.setAuthenticated('true'); session.setApiKey('testtoken'); doc = new Doc(); sinon.stub(jQuery,'ajax') this.serverDocView = new App.Views.ServerDoc({model : doc}); }); afterEach(function(){ var session = new Session(); session.setAuthenticated('false'); session.setApiKey(null); jQuery.ajax.restore(); }); it("should have render initial html",function(){ this.serverDocRenderSpy = sinon.spy(this.serverDocView,'render'); this.serverDocView.render(); expect(this.serverDocRenderSpy).toHaveBeenCalledOnce(); }); it("should clear doc",function(){ this.serverDocClearSpy = sinon.spy(this.serverDocView,'clear'); doc.set('dbkey','testdbkey'); function myevent(){ this.preventDefault=function(){return true;} } e = new myevent(); this.serverDocView.clear(e); expect(this.serverDocClearSpy).toHaveBeenCalledOnce(); }); it("should have correct html rendered ",function(){ var title = this.serverDocView.el.innerHTML.search('Document '); expect(title).toBeGreaterThan(0); }) });
Version data entries
42 entries across 42 versions & 1 rubygems