mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Test page
This commit is contained in:
38
apps/app/ui-tests-app/web-view/query-params.ts
Normal file
38
apps/app/ui-tests-app/web-view/query-params.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { WebView } from "tns-core-modules/ui/web-view";
|
||||
import * as fs from "tns-core-modules/file-system";
|
||||
|
||||
let webView: WebView;
|
||||
export function webViewLoaded(args) {
|
||||
webView = args.object;
|
||||
}
|
||||
|
||||
const relUrl = "~/ui-tests-app/web-view/query.html" + "?foo=bar&urlType=relative";
|
||||
const absoluteUrl = `${fs.knownFolders.currentApp().path}/ui-tests-app/web-view/query.html` + "?foo=bar&urlType=absolute";
|
||||
const fileUrl = `file:///${fs.knownFolders.currentApp().path}/ui-tests-app/web-view/query.html` + "?foo=bar&urlType=filePrefix";
|
||||
const htmlString = `<html>
|
||||
<head>
|
||||
<title>Test Page</title>
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<div style="color:green" id="result">Just a string ...</div>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
export function loadRelative() {
|
||||
setSrc(relUrl)
|
||||
}
|
||||
export function loadAbsolute() {
|
||||
setSrc(absoluteUrl)
|
||||
}
|
||||
export function loadFile() {
|
||||
setSrc(fileUrl)
|
||||
}
|
||||
export function loadString() {
|
||||
setSrc(htmlString)
|
||||
}
|
||||
|
||||
function setSrc(src) {
|
||||
console.log("Setting src to: " + src);
|
||||
webView.src = src;
|
||||
}
|
||||
Reference in New Issue
Block a user