refactor(core): empty default value for config > tauri > windows (#3380)

This commit is contained in:
Lucas Fernandes Nogueira 2022-02-10 11:23:08 -03:00 committed by GitHub
parent e61162aa9a
commit c119060e3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 34 deletions

View File

@ -0,0 +1,6 @@
---
"tauri": patch
"tauri-utils": patch
---
**Breaking change*** Remove default webview window when `tauri.conf.json > tauri > windows` is not set.

View File

@ -1454,10 +1454,6 @@ impl Allowlist for AllowlistConfig {
}
}
fn default_window_config() -> Vec<WindowConfig> {
vec![Default::default()]
}
/// The application pattern.
#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
@ -1490,7 +1486,7 @@ pub struct TauriConfig {
#[serde(default)]
pub pattern: PatternKind,
/// The windows configuration.
#[serde(default = "default_window_config")]
#[serde(default)]
pub windows: Vec<WindowConfig>,
/// The CLI configuration.
pub cli: Option<CliConfig>,
@ -1517,7 +1513,7 @@ impl Default for TauriConfig {
fn default() -> Self {
Self {
pattern: Default::default(),
windows: default_window_config(),
windows: Default::default(),
cli: None,
bundle: BundleConfig::default(),
allowlist: AllowlistConfig::default(),
@ -2544,9 +2540,7 @@ mod test {
// get default dev path
let d_path = default_dev_path();
// get default window
let d_windows = default_window_config();
// get default title
let d_title = default_title();
let d_windows: Vec<WindowConfig> = vec![];
// get default bundle
let d_bundle = BundleConfig::default();
// get default updater
@ -2555,30 +2549,7 @@ mod test {
// create a tauri config.
let tauri = TauriConfig {
pattern: Default::default(),
windows: vec![WindowConfig {
label: "main".to_string(),
url: WindowUrl::default(),
file_drop_enabled: true,
center: false,
x: None,
y: None,
width: 800f64,
height: 600f64,
min_width: None,
min_height: None,
max_width: None,
max_height: None,
resizable: true,
title: String::from("Tauri App"),
fullscreen: false,
focus: false,
transparent: false,
maximized: false,
visible: true,
decorations: true,
always_on_top: false,
skip_taskbar: false,
}],
windows: vec![],
bundle: BundleConfig {
active: false,
targets: None,
@ -2635,7 +2606,6 @@ mod test {
Url::parse("http://localhost:8080").unwrap()
))
);
assert_eq!(d_title, tauri.windows[0].title);
assert_eq!(d_windows, tauri.windows);
}
}