diff options
| -rw-r--r-- | content_scripts/link_hints.coffee | 2 | ||||
| -rw-r--r-- | tests/dom_tests/dom_tests.coffee | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 6f365700..6f99d970 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -664,3 +664,5 @@ class WaitForEnter extends Mode root = exports ? window root.LinkHints = LinkHints +# For tests: +root.AlphabetHints = AlphabetHints diff --git a/tests/dom_tests/dom_tests.coffee b/tests/dom_tests/dom_tests.coffee index 3797a37b..024ea801 100644 --- a/tests/dom_tests/dom_tests.coffee +++ b/tests/dom_tests/dom_tests.coffee @@ -93,6 +93,21 @@ createGeneralHintTests = (isFilteredMode) -> assertStartPosition document.getElementsByTagName("a")[1], hintMarkers[1] linkHints.deactivateMode() + should "generate the correct number of alphabet hints", -> + alphabetHints = new AlphabetHints + for n in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + hintStrings = alphabetHints.hintStrings n + assert.equal n, hintStrings.length + + should "generate non-overlapping alphabet hints", -> + alphabetHints = new AlphabetHints + for n in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + hintStrings = alphabetHints.hintStrings n + for h1 in hintStrings + for h2 in hintStrings + unless h1 == h2 + assert.isFalse 0 == h1.indexOf h2 + createGeneralHintTests false createGeneralHintTests true |
