From 7939b69ffc2880ff4590d1c8dcfd5eb7492200fd Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 20 Jan 2015 10:24:45 +0000 Subject: Rework focus input so it can be better included in tests. focusInput was getting its focus events from the handler stack. When the handler stack was reset during tests, we lost focusInput's handler. So we couldn't test the feature whereby focusInput has a memory (#1438). Instead, here focusInput adds its listener directly to the window, and we add the approriate test. --- tests/dom_tests/dom_tests.coffee | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/dom_tests/dom_tests.coffee b/tests/dom_tests/dom_tests.coffee index b0ee1a66..11fbe11f 100644 --- a/tests/dom_tests/dom_tests.coffee +++ b/tests/dom_tests/dom_tests.coffee @@ -218,6 +218,11 @@ context "Input focus", focusInput 100 assert.isTrue InsertMode.permanentInstance.isActive() + should "activate the most recently-selected input if the count is 1", -> + focusInput 3 + focusInput 1 + assert.equal "third", document.activeElement.id + should "not trigger insert if there are no inputs", -> document.getElementById("test-div").innerHTML = "" focusInput 1 -- cgit v1.2.3