Skip to content

Commit

Permalink
Add spec to cover knockout#672
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveSanderson committed Oct 17, 2012
1 parent eba5624 commit 2aee242
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions spec/defaultBindings/hasfocusBehaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ describe('Binding: Hasfocus', {
testNode.childNodes[1].focus();
ko.utils.triggerEvent(testNode.childNodes[0], "focusout");
value_of(model.myVal()).should_be(false);

// If the model value becomes true after a blur, we re-focus the element
// (Represents issue #672, where this wasn't working)
var didFocusExpectedElement = false;
ko.utils.registerEventHandler(testNode.childNodes[0], "focusin", function() { didFocusExpectedElement = true });
model.myVal(true);
value_of(didFocusExpectedElement).should_be(true);
},

'Should set a non-observable value to be true on focus and false on blur': function() {
Expand Down

0 comments on commit 2aee242

Please sign in to comment.