Synchronous prevent default (#2792)
* add prevent default methods to the event * sync prevent default almost working * sync prevent default working * Move event handling into the runtime * update core tests * restore desktop file dialog * implement prevent default on web * add a hint about the new prevent default method * fix web prevent default * Fix CTRL+click on links * fix values memorize in place test * Fix a few more tests * Add a playwright test for sync prevent default * Fix core doc tests * create a deprecated VirtualDom::handle_event * fix macos imports in desktop * Fix onmounted event * Fix liveview support * switch to RefCell for metadata * Remove println * remove prevent default attribute * remove web specific link behavior * Fix liveview links * more liveview fixes for link * Fix merge conflicts * Fix clippy * use the new prevent default in the file upload example
This commit is contained in:
1 parent
8b62b71e2d
commit
cab573eefd
54 files changed
+940
-729
No files matched your search
@@ -72,11 +72,7 @@ fn href_internal() {
|
||||
}
|
||||
}
|
||||
|
||||
let expected = format!(
|
||||
"<h1>App</h1><a {href} {default}>Link</a>",
|
||||
href = r#"href="/test""#,
|
||||
default = r#"dioxus-prevent-default="onclick""#,
|
||||
);
|
||||
let expected = format!("<h1>App</h1><a {href}>Link</a>", href = r#"href="/test""#,);
|
||||
|
||||
assert_eq!(prepare::<Route>(), expected);
|
||||
}
|
||||
@@ -107,9 +103,8 @@ fn href_external() {
|
||||
}
|
||||
|
||||
let expected = format!(
|
||||
"<h1>App</h1><a {href} {default} {rel}>Link</a>",
|
||||
"<h1>App</h1><a {href} {rel}>Link</a>",
|
||||
href = r#"href="https://dioxuslabs.com/""#,
|
||||
default = r#"dioxus-prevent-default="""#,
|
||||
rel = r#"rel="noopener noreferrer""#,
|
||||
);
|
||||
|
||||
@@ -143,9 +138,8 @@ fn with_class() {
|
||||
}
|
||||
|
||||
let expected = format!(
|
||||
"<h1>App</h1><a {href} {default} {class}>Link</a>",
|
||||
"<h1>App</h1><a {href} {class}>Link</a>",
|
||||
href = r#"href="/test""#,
|
||||
default = r#"dioxus-prevent-default="onclick""#,
|
||||
class = r#"class="test_class""#,
|
||||
);
|
||||
|
||||
@@ -173,9 +167,8 @@ fn with_active_class_active() {
|
||||
}
|
||||
|
||||
let expected = format!(
|
||||
"<h1>App</h1><a {href} {default} {class} {aria}>Link</a>",
|
||||
"<h1>App</h1><a {href} {class} {aria}>Link</a>",
|
||||
href = r#"href="/""#,
|
||||
default = r#"dioxus-prevent-default="onclick""#,
|
||||
class = r#"class="test_class active_class""#,
|
||||
aria = r#"aria-current="page""#,
|
||||
);
|
||||
@@ -211,9 +204,8 @@ fn with_active_class_inactive() {
|
||||
}
|
||||
|
||||
let expected = format!(
|
||||
"<h1>App</h1><a {href} {default} {class}>Link</a>",
|
||||
"<h1>App</h1><a {href} {class}>Link</a>",
|
||||
href = r#"href="/test""#,
|
||||
default = r#"dioxus-prevent-default="onclick""#,
|
||||
class = r#"class="test_class""#,
|
||||
);
|
||||
|
||||
@@ -247,9 +239,8 @@ fn with_id() {
|
||||
}
|
||||
|
||||
let expected = format!(
|
||||
"<h1>App</h1><a {href} {default} {id}>Link</a>",
|
||||
"<h1>App</h1><a {href} {id}>Link</a>",
|
||||
href = r#"href="/test""#,
|
||||
default = r#"dioxus-prevent-default="onclick""#,
|
||||
id = r#"id="test_id""#,
|
||||
);
|
||||
|
||||
@@ -283,9 +274,8 @@ fn with_new_tab() {
|
||||
}
|
||||
|
||||
let expected = format!(
|
||||
"<h1>App</h1><a {href} {default} {target}>Link</a>",
|
||||
"<h1>App</h1><a {href} {target}>Link</a>",
|
||||
href = r#"href="/test""#,
|
||||
default = r#"dioxus-prevent-default="""#,
|
||||
target = r#"target="_blank""#
|
||||
);
|
||||
|
||||
@@ -312,9 +302,8 @@ fn with_new_tab_external() {
|
||||
}
|
||||
|
||||
let expected = format!(
|
||||
"<h1>App</h1><a {href} {default} {rel} {target}>Link</a>",
|
||||
"<h1>App</h1><a {href} {rel} {target}>Link</a>",
|
||||
href = r#"href="https://dioxuslabs.com/""#,
|
||||
default = r#"dioxus-prevent-default="""#,
|
||||
rel = r#"rel="noopener noreferrer""#,
|
||||
target = r#"target="_blank""#
|
||||
);
|
||||
@@ -349,9 +338,8 @@ fn with_rel() {
|
||||
}
|
||||
|
||||
let expected = format!(
|
||||
"<h1>App</h1><a {href} {default} {rel}>Link</a>",
|
||||
"<h1>App</h1><a {href} {rel}>Link</a>",
|
||||
href = r#"href="/test""#,
|
||||
default = r#"dioxus-prevent-default="onclick""#,
|
||||
rel = r#"rel="test_rel""#,
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user