aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dom_tests
diff options
context:
space:
mode:
authorStephen Blott2017-10-29 14:08:00 +0000
committerGitHub2017-10-29 14:08:00 +0000
commit52bd2cdbf662e3d40c0f5273485379be77ef8c19 (patch)
treef54999999cf42b320d6a8cd929065f54d5630c3f /tests/dom_tests
parent69c3e8a4b8aef152a2c994c5da922a37ac3f5cf6 (diff)
parent24148c709806d1631f35cd8efd3fdec4f2376f92 (diff)
downloadvimium-52bd2cdbf662e3d40c0f5273485379be77ef8c19.tar.bz2
Merge pull request #2748 from mrmr1993/frontend-split
Move normal mode and its commands out of vimium_frontend.coffee
Diffstat (limited to 'tests/dom_tests')
-rw-r--r--tests/dom_tests/dom_tests.coffee26
-rw-r--r--tests/dom_tests/dom_tests.html1
2 files changed, 14 insertions, 13 deletions
diff --git a/tests/dom_tests/dom_tests.coffee b/tests/dom_tests/dom_tests.coffee
index a5c85606..6e422d46 100644
--- a/tests/dom_tests/dom_tests.coffee
+++ b/tests/dom_tests/dom_tests.coffee
@@ -436,29 +436,29 @@ context "Input focus",
document.getElementById("test-div").innerHTML = ""
should "focus the first element", ->
- focusInput 1
+ NormalModeCommands.focusInput 1
assert.equal "first", document.activeElement.id
should "focus the nth element", ->
- focusInput 100
+ NormalModeCommands.focusInput 100
assert.equal "third", document.activeElement.id
should "activate insert mode on the first element", ->
- focusInput 1
+ NormalModeCommands.focusInput 1
assert.isTrue InsertMode.permanentInstance.isActive()
should "activate insert mode on the first element", ->
- focusInput 100
+ NormalModeCommands.focusInput 100
assert.isTrue InsertMode.permanentInstance.isActive()
should "activate the most recently-selected input if the count is 1", ->
- focusInput 3
- focusInput 1
+ NormalModeCommands.focusInput 3
+ NormalModeCommands.focusInput 1
assert.equal "third", document.activeElement.id
should "not trigger insert if there are no inputs", ->
document.getElementById("test-div").innerHTML = ""
- focusInput 1
+ NormalModeCommands.focusInput 1
assert.isFalse InsertMode.permanentInstance.isActive()
# TODO: these find prev/next link tests could be refactored into unit tests which invoke a function which has
@@ -479,7 +479,7 @@ context "Find prev / next links",
<a href='#second'>next page</a>
"""
stubSettings "nextPatterns", "next"
- goNext()
+ NormalModeCommands.goNext()
assert.equal '#second', window.location.hash
should "match against non-word patterns", ->
@@ -487,7 +487,7 @@ context "Find prev / next links",
<a href='#first'>&gt;&gt;</a>
"""
stubSettings "nextPatterns", ">>"
- goNext()
+ NormalModeCommands.goNext()
assert.equal '#first', window.location.hash
should "favor matches with fewer words", ->
@@ -496,14 +496,14 @@ context "Find prev / next links",
<a href='#second'>next!</a>
"""
stubSettings "nextPatterns", "next"
- goNext()
+ NormalModeCommands.goNext()
assert.equal '#second', window.location.hash
should "find link relation in header", ->
document.getElementById("test-div").innerHTML = """
<link rel='next' href='#first'>
"""
- goNext()
+ NormalModeCommands.goNext()
assert.equal '#first', window.location.hash
should "favor link relation to text matching", ->
@@ -511,14 +511,14 @@ context "Find prev / next links",
<link rel='next' href='#first'>
<a href='#second'>next</a>
"""
- goNext()
+ NormalModeCommands.goNext()
assert.equal '#first', window.location.hash
should "match mixed case link relation", ->
document.getElementById("test-div").innerHTML = """
<link rel='Next' href='#first'>
"""
- goNext()
+ NormalModeCommands.goNext()
assert.equal '#first', window.location.hash
createLinks = (n) ->
diff --git a/tests/dom_tests/dom_tests.html b/tests/dom_tests/dom_tests.html
index d2e795d1..37cd43e3 100644
--- a/tests/dom_tests/dom_tests.html
+++ b/tests/dom_tests/dom_tests.html
@@ -49,6 +49,7 @@
<script type="text/javascript" src="../../content_scripts/mode_key_handler.js"></script>
<script type="text/javascript" src="../../content_scripts/mode_visual.js"></script>
<script type="text/javascript" src="../../content_scripts/hud.js"></script>
+ <script type="text/javascript" src="../../content_scripts/mode_normal.js"></script>
<script type="text/javascript" src="../../content_scripts/vimium_frontend.js"></script>
<script type="text/javascript" src="../shoulda.js/shoulda.js"></script>