aboutsummaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)Author
2016-09-26Tweak jsaction detection and add tests.Stephen Blott
This tweaks the jsaction detection, in particular excluding elements where the "actionName" is "_". I see a lot of these, and clicking them doesn't do anything. Also, added corresponding tests.
2016-09-25Space rotates hints (to make hidden hints visible).Stephen Blott
It is common for link-hint markers to be close togother, and overlapping. Here, `<Space>` rotates hint markers such that hidden markers become visible. For filtered hints we additionally require a modifier (because `<space>` on its own is already a token separator). The calculation of overlapping hints is quite expensive: O(n^2) in the best case and O(n^3) in the worst cast. The worst case is extraordinarily unlikely to arise in practice.
2016-04-18Cache content_scripts/vimium.css in chrome.storage.local.Stephen Blott
Previously, we had two different approaches. This seems like a simpler approach. We simply cache the Vimium CSS in chrome.storage.local (in the background page) and fetch it from there (in UI components). There is also a minor change in the we no longer cache the CSS in memory. This seems to be the right thing to do. Caching the CSS in memory consumes a small amount of memory. However, it can only speed up the fastest loads. It cannot speed up the first load -- which is likely the one that matters most. So caching the CSS in memory seems to make little sense.
2016-04-18Fix tests.Stephen Blott
When the implementation of windowIsFocused() changed, the tests started failing. (It's not clear how I didn't spot this sooner. I've run the tests countless times - and they passed - since that change was made.
2016-04-18Require documentReady for all UI components.Stephen Blott
This replaces c01d7eea8675f9a7d84999777e8de72244d687b6. All UI components require the document to be ready. So, here the constructor waits for DomUtils.documentReady(). The diff looks big, but mainly it's a result of changes in indentation in the constructor and in hide(). Also, hide() now uses @postMessage() to post a null message. This forces hide to use @iframePort.use(), which ensures that hide()s cannot overtake activate()s. This continues #2100.
2016-04-10Fix Vomnibar initialization issue.Stephen Blott
On a slow loading page, as the page is loading, hit `o` repeatedly. Eventually, Vimium hangs. We seem to have had this problem for quite some time (e.g. it's in 1.54). This fixes the problem by ensuring that the Vomnibar is initialized before launching it. Also fix the same issue for the help dialog.
2016-04-08Merge pull request #2088 from ↵Stephen Blott
smblott-github/filtered-hints-better-typed-text-matching Filtered hints: better typed text handling.
2016-04-08Filtered hints; ignore unmatched text.Stephen Blott
When the user is typing a link's text, any mistyped character exits link hints mode. This makes little sense. In practice, this usually happens because the user mis-typed something. Here, we ignore typed characters which do not match any hints. (Also, add a test for this.)
2016-04-08Do not post hint descriptors back to the frame itself.Stephen Blott
When distributing hint descriptors, do not post a frame's own hint descriptors back to the frame itself. It already has them. With regard to the message-passing cost only, this represents a speedup of approximately 3/2 for link-busy sites like reddit -- several tens of milliseconds for me. There are other costs too (such as processing the hint descriptors) bu these are not affected.
2016-04-04Handle requireHref for link hints locally.Stephen Blott
The check that an element as an href (for certain hint modes) can be done earlier, thereby avoid the need to pass that information between frames.
2016-04-02Refactor DomUtils.documentReady.Stephen Blott
We do not need to install separate event listeners for every callback. Just install one listener and keep track of the callbacks ourself. This is clearer, and also determines the order in which callbacks are called. (Although, we don't rely on that currently.) This also adds a tests.
2016-03-30Rename handlerStack constants.Stephen Blott
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.
2016-03-30Add tests for GrabBackFocus.Stephen Blott
2016-03-30Add test for SuppressAllKeyboardEvents.Stephen Blott
Which: - uncovered a typo in 39adee9090fc5aadfd5dd681f91b80025084858a. Also: - make Mode.debug a class variable, which is more helpful while trying to debug. Specifically, you can turn debugging on or off from within the tests, for example.
2016-03-29Add tests for WaitForEnter.Stephen Blott
2016-03-29Ensure window has focus in tests.Stephen Blott
2016-03-28Use image data for icons.Stephen Blott
This uses image data (instead of a path) for the page icon. It also only builds 19x19 and 38x38 icons, as per the chrome.browserAction.setIcon() documentation. This appears to fix a memory leak related to a recent Chrome regression (versions 49+). Fixes #2055.
2016-03-28Filter out link-hint false positives.Stephen Blott
We recognise elements with a class names containing the text "button" as clickable. However, often they're not, they're just wrapping a clickable thing, like a real button. Here, we filter out such false positives. This has two effects: - It eliminates quite a number of real false pasitives in practice. - With fewer hints close together, fewer hint markers are obscured by the hints from (non-clickable) wrappers. This reduces the need for rotating the hint stacking order, e.g #1252.
2016-03-28Global link hints; fix tests after rebase.Stephen Blott
2016-03-28Global link hints; self code review.Stephen Blott
- Better comments in places. - Better variable and message names in some places.
2016-03-28Golbal link hints; fic tests.Stephen Blott
2016-03-27Add test for extractQuery().Stephen Blott
2016-03-27Add test for escapeRegexSpecialCharacters().Stephen Blott
2016-03-27Add test for invokeCommandString().Stephen Blott
2016-03-26Add test for badly-formed exclusion regexp.Stephen Blott
2016-03-26Multiple minor tweaks.Stephen Blott
Some of this code is showing its age, so these are just a number of minor tweaks (to keep things clear, consistent and concise). Also, add a couple of tests (while we're at it).
2016-03-25Better choice of callapse on exit.Stephen Blott
The question here is where to callapse the selection to, anchor or focus? When exiting visual mode, mimic vim. When trasitioning between visual and caret modes, do what's right to keep the selection in the same place. This also adds some related tests.
2016-03-25More selective integration with the tests.Stephen Blott
This is a better way of stubing for the tests. Previously, if anything went wrong, there would actually be a visual effect for the user (the page would scroll). This way, that cannot happen.
2016-03-25Add tests for visual mode.Stephen Blott
The coverage here is far from completem but we do catch the basics.
2016-03-21Simplify singleton handling.Stephen Blott
While working on the visual-mode code, it became apparent that our current "singleton" implementation is unnecessarily complicated. This simplifies it. The keys are now required to be strings. (Previously, they could be any object; which meant we needed to gove objects an identity. All of which was complicated.)
2016-03-21Rework visual mode.Stephen Blott
- Refactor the three visual-mode modes. - Use the key-handling framework from #2022. - Strip some legacy edit-mode code. - Rename the file (the old file name was misleading). - Add "aw" and "as", previously we had the code for this from edit mode.
2016-03-21Rename visual mode file.Stephen Blott
This previous file name was chosen when we (I) had the intention of implementing edit mode too. That initiative has been abandoned, so the file name is inappropriate. Renaming now in preparation for a significant refactoring of visual mode.
2016-03-18Clarify why things are exported.Stephen Blott
We have: window.XXX = XXX = -> ... in many places. This commit reduces the number of these, and moves the exports to the end, where a single comment explains why they're being exported.
2016-03-18Refactor the front-end initialisation sequence.Stephen Blott
The front-end initialisation sequence has become quite confused. This simplifies it, makes things which must be idemtpotent explicit and renames some functions to make it clear when they run. It also avoids a situation where we were possibly installing a `domReady` function to initialise the HUD multiple times. Should be a no-op functionality wise.
2016-03-18Add Utils.makeIdempotent.Stephen Blott
The intention is to use this to clean up some of the initialisation sequences in the front end.
2016-03-17Minor refactoring.Stephen Blott
This tidies up some logic that was showing its age.
2016-03-17Tweaks for #2053.Stephen Blott
2016-03-17Simplify domReady handling.Stephen Blott
2016-03-17Move isEnabledForUrl to Frame.port.Stephen Blott
2016-03-17Use Chrome frameIds.Stephen Blott
2016-03-17Move alphabet hint tests...Stephen Blott
... they were in the wrong place (and were being run twice).
2016-03-17Fix long-standing bug in link-hints tests.Stephen Blott
This code has been written to test both hints modes, however we were actually only testing one of them!
2016-03-13Add tests in various areas...Stephen Blott
- key handling - filtered hints - scoring - filtered hints - tab - link hints - changing mode Also, correct the argument ordering in several assert.equal() calls.
2016-03-10Tests; add alphabet-hint hint tests.Stephen Blott
This adds tests for a couple of properties that are required of alphabet hint strings.
2016-03-06Initialize UI components only when they're needed.Stephen Blott
HUD: Initialize only when the frame receives the focus and Vimium is enabled. Vomnibar: Initialize in the top frame when Vimium is enabled in *any* frame. Warning: There may be a race condition here. Specifically, if Vimium is disabled in the main/top frame (T) but enabled in another frame (A), then the initialisation could happen in frame A before frame T is listening, so frame T would miss the initialization message (which is only sent once). Message listeners are installed early (and probably installed first in the main/top frame), and the `isEnabledForUrl` messaging takes some time, so perhaps it's OK. But it *is* a race condition. Fixes #1838.
2016-03-06Fix count handling (again).Stephen Blott
`7gj` should be `1j`. Also, with: map ab SOMETHING `7aab` should be `1ab`. Replacement for 7774beb6643c0d905f9caba4345453790af948ad.
2016-03-06Normal mode tests.Stephen Blott
With #2022, we can now implement normal-mode key-handling tests. Writing these tests uncovered the bug behind 7774beb6643c0d905f9caba4345453790af948ad.
2016-03-05Key bindings; add line missing from tests.Stephen Blott
2016-03-05Key bindings; refactor passKeys distribution.Stephen Blott
It makes more sense to pass the passKeys directly to normalMode. So, do so, and remove the trackState mode option - which isn't otherwise being used.
2016-03-05Key bindings; tweaks.Stephen Blott