diff options
| author | Stephen Blott | 2016-03-30 13:07:05 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2016-03-30 14:58:46 +0100 | 
| commit | 21da3fcafbb29540788037dbcdbdce79ad14e650 (patch) | |
| tree | 0d4ff357c8cfd25226cb8dd6bf07d398ed3dfb03 /tests/unit_tests/handler_stack_test.coffee | |
| parent | a2fba970e089254adae2631a5b154e6bd92ec1e2 (diff) | |
| download | vimium-21da3fcafbb29540788037dbcdbdce79ad14e650.tar.bz2 | |
Rename handlerStack constants.
Problems:
  - The meanings of some of the Mode/handlerStack constant names is far
    from obvious.
  - The same thing is named different things in different places.
This changes various constant names such that:
  - the names used in the handler stack and in the modes are the same.
  - ditto vis-a-vis DomUtils.
Also, break out the core of the handler stacks' `bubbleEvent` method
into a switch statements.  This makes it more obvious that the cases are
mutually exclusive.
Diffstat (limited to 'tests/unit_tests/handler_stack_test.coffee')
| -rw-r--r-- | tests/unit_tests/handler_stack_test.coffee | 9 | 
1 files changed, 5 insertions, 4 deletions
| diff --git a/tests/unit_tests/handler_stack_test.coffee b/tests/unit_tests/handler_stack_test.coffee index 629fc3ed..7b62af07 100644 --- a/tests/unit_tests/handler_stack_test.coffee +++ b/tests/unit_tests/handler_stack_test.coffee @@ -5,6 +5,7 @@ context "handlerStack",    setup ->      stub global, "DomUtils", {}      stub DomUtils, "suppressEvent", -> +    stub DomUtils, "suppressPropagation", ->      @handlerStack = new HandlerStack      @handler1Called = false      @handler2Called = false @@ -23,16 +24,16 @@ context "handlerStack",      assert.isTrue @handler2Called      assert.isFalse @handler1Called -  should "terminate bubbling on stopBubblingAndTrue, and be true", -> +  should "terminate bubbling on passEventToPage, and be true", ->      @handlerStack.push { keydown: => @handler1Called = true } -    @handlerStack.push { keydown: => @handler2Called = true; @handlerStack.stopBubblingAndTrue  } +    @handlerStack.push { keydown: => @handler2Called = true; @handlerStack.passEventToPage }      assert.isTrue @handlerStack.bubbleEvent 'keydown', {}      assert.isTrue @handler2Called      assert.isFalse @handler1Called -  should "terminate bubbling on stopBubblingAndTrue, and be false", -> +  should "terminate bubbling on passEventToPage, and be false", ->      @handlerStack.push { keydown: => @handler1Called = true } -    @handlerStack.push { keydown: => @handler2Called = true; @handlerStack.stopBubblingAndFalse  } +    @handlerStack.push { keydown: => @handler2Called = true; @handlerStack.suppressPropagation }      assert.isFalse @handlerStack.bubbleEvent 'keydown', {}      assert.isTrue @handler2Called      assert.isFalse @handler1Called | 
