/ features / hooks.feature
hooks.feature
 1  Feature: Hooks
 2  
 3    Background:
 4      Given I insert:
 5        """
 6        line 1
 7        line 2
 8        line 3
 9        line 4
10        """
11      And I turn on drag-stuff
12      And I activate the suggested drag-stuff key-bindings
13  
14    Scenario: Before and after wrap hooks
15      Given I load the following:
16        """
17          (defvar drag-stuff-hax nil)
18  
19          (add-hook 'drag-stuff-before-drag-hook
20                    (lambda ()
21                      (when (zerop (current-column))
22                        (backward-char 1)
23                        (setq drag-stuff-hax t))))
24  
25          (add-hook 'drag-stuff-after-drag-hook
26                    (lambda ()
27                      (when drag-stuff-hax
28                        (forward-char 1)
29                        (setq drag-stuff-hax nil))))
30        """
31      When I press "M-<"
32      And I press "C-f"
33      And I press "C-f"
34      And I press "C-SPC"
35      And I press "C-n"
36      And I press "C-n"
37      And I press "C-a"
38      And I press "<M-down>"
39      Then I should see:
40        """
41        line 3
42        line 1
43        line 2
44        line 4
45        """
46      And the region should be:
47        """
48        ne 1
49        line 2
50  
51        """