forked from fulcrum-agile/fulcrum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Malcolm Locke
committed
Oct 27, 2011
1 parent
b4e9e00
commit 2ef2809
Showing
4 changed files
with
54 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,43 @@ | ||
describe("NoteForm", function() { | ||
|
||
beforeEach(function() { | ||
this.view = new NoteForm({model: {}}); | ||
var Note = Backbone.Model.extend({name: 'note', url: '/foo'}); | ||
this.note = new Note(); | ||
this.view = new NoteForm({model: this.note}); | ||
}); | ||
|
||
it("should have a tag name of div", function() { | ||
//expect(this.view.el.nodeName).toEqual('DIV'); | ||
expect(this.view.el.nodeName).toEqual('DIV'); | ||
}); | ||
|
||
it("should have a class of note_form", function() { | ||
expect($(this.view.el)).toHaveClass('note_form'); | ||
}); | ||
|
||
describe("saveEdit", function() { | ||
|
||
it("should disable all form controls on submit", function() { | ||
var disableSpy = sinon.spy(this.view, 'disableForm'); | ||
this.view.saveEdit(); | ||
expect(disableSpy).toHaveBeenCalled(); | ||
}); | ||
|
||
}); | ||
|
||
describe("disableForm", function() { | ||
|
||
it("sets disabled state on form tags", function() { | ||
$(this.view.el).html('<textarea></textarea><input type="submit">'); | ||
this.view.disableForm(); | ||
expect(this.view.$('textarea').attr('disabled')).toBeTruthy(); | ||
expect(this.view.$('input').attr('disabled')).toBeTruthy(); | ||
}); | ||
|
||
it("sets saving class on the submit button", function() { | ||
$(this.view.el).html('<input type="button">'); | ||
this.view.disableForm(); | ||
expect(this.view.$('input[type="button"]')).toHaveClass('saving'); | ||
}); | ||
|
||
}); | ||
}); |