mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-18 16:11:38 +03:00
test(tauri.js) update fixture app and fix build/dev e2e tests (#1058)
This commit is contained in:
parent
92908c7e91
commit
a3b724738e
@ -41,6 +41,7 @@ module.exports = {
|
||||
transform: {
|
||||
'templates[\\\\/](tauri|mutation-observer).js':
|
||||
'./test/jest/raw-loader-transformer.js',
|
||||
'api[\\\\/]tauri.bundle.umd.js': './test/jest/raw-loader-transformer.js',
|
||||
'\\.(js|ts)$': 'babel-jest'
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,8 @@ function runBuildTest(tauriConfig) {
|
||||
describe('Tauri Build', () => {
|
||||
const build = {
|
||||
devPath: distDir,
|
||||
distDir: distDir
|
||||
distDir: distDir,
|
||||
withGlobalTauri: true
|
||||
}
|
||||
|
||||
it.each`
|
||||
@ -77,6 +78,9 @@ describe('Tauri Build', () => {
|
||||
debug: flag === 'debug'
|
||||
},
|
||||
tauri: {
|
||||
allowlist: {
|
||||
all: true
|
||||
},
|
||||
embeddedServer: {
|
||||
active: mode === 'embedded-server'
|
||||
}
|
||||
|
@ -66,7 +66,8 @@ function runDevTest(tauriConfig) {
|
||||
|
||||
describe('Tauri Dev', () => {
|
||||
const build = {
|
||||
distDir: distDir
|
||||
distDir: distDir,
|
||||
withGlobalTauri: true
|
||||
}
|
||||
|
||||
const devServer = startDevServer()
|
||||
|
@ -36,7 +36,7 @@
|
||||
return window.__TAURI__.fs
|
||||
.writeFile(
|
||||
{
|
||||
file: 'tauri-test.txt',
|
||||
path: 'tauri-test.txt',
|
||||
contents: contents
|
||||
},
|
||||
options
|
||||
@ -136,7 +136,7 @@
|
||||
})
|
||||
|
||||
setTimeout(function () {
|
||||
window.__TAURI__.invoke({
|
||||
window.__TAURI_INVOKE_HANDLER__({
|
||||
cmd: 'exit'
|
||||
})
|
||||
}, 15000)
|
||||
|
@ -27,7 +27,7 @@ serde_derive = "1.0"
|
||||
tiny_http = "0.7"
|
||||
phf = "0.8.0"
|
||||
includedir = "0.6.0"
|
||||
tauri = { path = "../../../../../../../tauri", features = [ "all-api", "edge" ] }
|
||||
tauri = { path = "../../../../../../../tauri", features = [ "all-api" ] }
|
||||
|
||||
[features]
|
||||
embedded-server = [ "tauri/embedded-server" ]
|
||||
|
@ -7,23 +7,26 @@ extern crate serde_json;
|
||||
fn main() {
|
||||
tauri::AppBuilder::new()
|
||||
.setup(|webview, _| {
|
||||
let handle = webview.handle();
|
||||
let mut webview_ = webview.as_mut();
|
||||
tauri::event::listen(String::from("hello"), move |_| {
|
||||
tauri::event::emit(&handle, String::from("reply"), Some("{ msg: 'TEST' }".to_string()));
|
||||
tauri::event::emit(
|
||||
&mut webview_,
|
||||
String::from("reply"),
|
||||
Some("{ msg: 'TEST' }".to_string()),
|
||||
)
|
||||
.unwrap();
|
||||
});
|
||||
webview.eval("window.onTauriInit && window.onTauriInit()").unwrap();
|
||||
webview.eval("window.onTauriInit && window.onTauriInit()");
|
||||
})
|
||||
.invoke_handler(|webview, arg| {
|
||||
use cmd::Cmd::*;
|
||||
match serde_json::from_str(arg) {
|
||||
Err(e) => {
|
||||
Err(e.to_string())
|
||||
}
|
||||
Err(e) => Err(e.to_string()),
|
||||
Ok(command) => {
|
||||
match command {
|
||||
// definitions for your custom commands from Cmd here
|
||||
Exit {} => {
|
||||
webview.exit();
|
||||
webview.terminate();
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user