Skip to content

Commit

Permalink
Hacks to make Vomnibar tests work again
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmr1993 committed Aug 21, 2014
1 parent cc3df59 commit de016dc
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
31 changes: 26 additions & 5 deletions pages/vomnibar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ Vomnibar =
@vomnibarUI.setQuery(options.query)
@vomnibarUI.update()

activate: -> @activateWithCompleter {completer:"omni"}
activateInNewTab: -> @activateWithCompleter {
completer: "omni"
selectFirst: false
newTab: true
}
activateTabSelection: -> @activateWithCompleter {
completer: "tabs"
selectFirst: true
}
activateBookmarks: -> @activateWithCompleter {
completer: "bookmarks"
selectFirst: true
}
activateBookmarksInNewTab: -> @activateWithCompleter {
completer: "bookmarks"
selectFirst: true
newTab: true
}
getUI: -> @vomnibarUI


Expand Down Expand Up @@ -72,11 +91,13 @@ class VomnibarUI

updateSize: ->
if document.readyState == "complete" # Do nothing if we haven't loaded yet
chrome.runtime.sendMessage
handler: "echo"
name: "vomnibarResize"
frameId: @frameId
height: Math.max(@box.getClientRects()[0].height, 55)
try
height = Math.max(@box.getClientRects()[0].height, 55)
chrome.runtime.sendMessage
handler: "echo"
name: "vomnibarResize"
frameId: @frameId
height: height

updateSelection: ->
# We have taken the option to add some global state here (previousCompletionType) to tell if a search
Expand Down
2 changes: 1 addition & 1 deletion test_harnesses/vomnibar.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<script type="text/javascript" src="../lib/keyboard_utils.js"></script>
<script type="text/javascript" src="../lib/dom_utils.js"></script>
<script src="https://github.com/ooyala/livecss/raw/master/livecss.js"></script>
<script type="text/javascript" src="../content_scripts/vomnibar.js"></script>
<script type="text/javascript" src="../pages/vomnibar.js"></script>
<link rel="stylesheet" type="text/css" href="../vimium.css" />
<script>
function setup() {
Expand Down
8 changes: 8 additions & 0 deletions tests/dom_tests/dom_tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<script type="text/javascript" src="../../content_scripts/vomnibar.js"></script>
<script type="text/javascript" src="../../content_scripts/scroller.js"></script>
<script type="text/javascript" src="../../content_scripts/vimium_frontend.js"></script>
<script type="text/javascript" src="../../pages/vomnibar.js"></script>

<script type="text/javascript" src="../shoulda.js/shoulda.js"></script>
<script type="text/javascript" src="dom_tests.js"></script>
Expand All @@ -53,5 +54,12 @@ <h1>Vimium Tests</h1>

<div id="output-div"></div>

<div id="vomnibar" class="vimiumReset">
<div class="vimiumReset vomnibarSearchArea">
<input type="text" class="vimiumReset">
</div>
<ul class="vimiumReset"></ul>
</div>

</body>
</html>

0 comments on commit de016dc

Please sign in to comment.