This repository has been archived by the owner on Apr 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browser: Fix scroll key binding conflict (#2239)
* Check for webview focus before running command on webview * Fix browser path * Hook up active tag management for the browser layer * Fix lint issues
- Loading branch information
Showing
7 changed files
with
188 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* Test scripts for Auto Complete for a Typescript file. | ||
*/ | ||
|
||
import * as assert from "assert" | ||
|
||
import * as Oni from "oni-api" | ||
|
||
import { WebviewTag } from "electron" | ||
|
||
import { getElementsBySelector } from "./Common" | ||
|
||
export const test = async (oni: Oni.Plugin.Api) => { | ||
await oni.automation.waitForEditors() | ||
|
||
const getWebView = (): WebviewTag | null => { | ||
const elems = getElementsBySelector("webview") | ||
return elems.length > 0 ? elems[0] : null | ||
} | ||
|
||
const waitForWebViewUrl = (urlPart: string): boolean => { | ||
const webview = getWebView() | ||
|
||
if (!webview) { | ||
return false | ||
} | ||
|
||
const url = webview.getURL() | ||
|
||
return url.indexOf(urlPart) >= 0 | ||
} | ||
|
||
oni.commands.executeCommand("browser.openUrl.verticalSplit", "https://github.com/onivim/oni") | ||
|
||
await oni.automation.waitFor(() => getWebView() !== null) | ||
await oni.automation.waitFor(() => waitForWebViewUrl("github.com")) | ||
|
||
await oni.automation.sendKeys("<c-g>") | ||
await oni.automation.sleep(500) | ||
|
||
// We'll sneak to the browser address and load a new site | ||
const anyOni = oni as any | ||
const sneak = anyOni.sneak.getSneakMatchingTag("browser.address") | ||
|
||
const keys: string = sneak.triggerKeys.toLowerCase() | ||
await anyOni.automation.sendKeysV2(keys) | ||
|
||
await oni.automation.sleep(500) | ||
|
||
await anyOni.automation.sendKeysV2("https://www.onivim.io") | ||
|
||
await oni.automation.sleep(500) | ||
|
||
await anyOni.automation.sendKeysV2("<CR>") | ||
|
||
await oni.automation.waitFor(() => waitForWebViewUrl("onivim.io")) | ||
|
||
assert.ok( | ||
getWebView() | ||
.getURL() | ||
.indexOf("onivim.io") >= 0, | ||
"Successfully navigated to onivim.io", | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters