From 97e61e29d59b9557fe1fb8d7ae1a34be1d47fcc1 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Mon, 19 Jan 2015 05:39:24 +0000 Subject: Rework DOM tests. - Set up modes such that they can be re-initialised. - Move initialisation of BadgeMode to general initialisation function. - Add reset() method for handlerStack. - Consistently use initializeModeState() in all tests' setup(). - Refactor focusInput tests. - Add some more tests. - Simplify some other tests. Note: Clean-up of the inputFocus overlay now happens when the exit() method is called in Mode.reset(). This eliminates most needs to artificially bubble a keyboard event to clear the overlay. --- lib/handler_stack.coffee | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/handler_stack.coffee b/lib/handler_stack.coffee index 76d835b7..b8049b81 100644 --- a/lib/handler_stack.coffee +++ b/lib/handler_stack.coffee @@ -95,5 +95,8 @@ class HandlerStack label ||= if result then "continue/truthy" else "suppress" console.log "#{@eventNumber}", type, handler._name, label + reset: -> + @stack = [] + root.HandlerStack = HandlerStack root.handlerStack = new HandlerStack() -- cgit v1.2.3 From 2cb0079bde5461490e0ae09286b2b3c75056fe1a Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Mon, 19 Jan 2015 13:42:31 +0000 Subject: Rework DOM tests (integrate keyboard-event handling). This uses phantomjs to generate keyboard events. So the events are propagated through the regular event listeners. So we're testing the full keyboard-event flow. --- lib/handler_stack.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/handler_stack.coffee b/lib/handler_stack.coffee index b8049b81..3d635005 100644 --- a/lib/handler_stack.coffee +++ b/lib/handler_stack.coffee @@ -1,7 +1,6 @@ root = exports ? window class HandlerStack - constructor: -> @debug = false @eventNumber = 0 @@ -95,6 +94,7 @@ class HandlerStack label ||= if result then "continue/truthy" else "suppress" console.log "#{@eventNumber}", type, handler._name, label + # For tests only. reset: -> @stack = [] -- cgit v1.2.3