Fix flakey windows tests (#2332)
This commit is contained in:
1 parent
c9ab09b348
commit
5ce91e1bfc
31 files changed
+217
-136
No files matched your search
@@ -20,6 +20,9 @@ quote = { workspace = true }
|
||||
proc-macro2 = { workspace = true }
|
||||
slab = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
dioxus = { workspace = true, features = ["router"] }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
web = []
|
||||
@@ -42,7 +42,9 @@ mod segment;
|
||||
/// 2. By the order they are defined in the enum
|
||||
///
|
||||
/// All features:
|
||||
/// ```rust, skip
|
||||
/// ```rust
|
||||
/// use dioxus::prelude::*;
|
||||
///
|
||||
/// #[rustfmt::skip]
|
||||
/// #[derive(Clone, Debug, PartialEq, Routable)]
|
||||
/// enum Route {
|
||||
@@ -75,9 +77,17 @@ mod segment;
|
||||
/// #[redirect("/:id/user", |id: usize| Route::Route3 { dynamic: id.to_string()})]
|
||||
/// #[route("/:dynamic")]
|
||||
/// Route3 { dynamic: String },
|
||||
/// #[child]
|
||||
/// NestedRoute(NestedRoute),
|
||||
/// }
|
||||
/// # #[component]
|
||||
/// # fn Route1(user_id: usize, dynamic: usize, query: String) -> Element { None }
|
||||
/// # #[component]
|
||||
/// # fn Route2(user_id: usize) -> Element { None }
|
||||
/// # #[component]
|
||||
/// # fn Route3(dynamic: String) -> Element { None }
|
||||
/// # #[component]
|
||||
/// # fn UserFrame(user_id: usize) -> Element { None }
|
||||
/// # #[component]
|
||||
/// # fn IndexComponent() -> Element { None }
|
||||
/// ```
|
||||
///
|
||||
/// # `#[route("path", component)]`
|
||||
@@ -89,7 +99,9 @@ mod segment;
|
||||
/// Routes are the most basic attribute. They allow you to define a route and the component to render when the route is matched. The component must take all dynamic parameters of the route and all parent nests.
|
||||
/// The next variant will be tied to the component. If you link to that variant, the component will be rendered.
|
||||
///
|
||||
/// ```rust, skip
|
||||
/// ```rust
|
||||
/// use dioxus::prelude::*;
|
||||
///
|
||||
/// #[derive(Clone, Debug, PartialEq, Routable)]
|
||||
/// enum Route {
|
||||
/// // Define routes that renders the IndexComponent
|
||||
@@ -97,6 +109,8 @@ mod segment;
|
||||
/// #[route("/", Index)]
|
||||
/// Index {},
|
||||
/// }
|
||||
/// # #[component]
|
||||
/// # fn Index() -> Element { None }
|
||||
/// ```
|
||||
///
|
||||
/// # `#[redirect("path", function)]`
|
||||
@@ -105,14 +119,18 @@ mod segment;
|
||||
/// - `path`: The path to the enum variant (relative to the parent nest)
|
||||
/// - `function`: A function that takes the parameters from the path and returns a new route
|
||||
///
|
||||
/// ```rust, skip
|
||||
/// ```rust
|
||||
/// use dioxus::prelude::*;
|
||||
///
|
||||
/// #[derive(Clone, Debug, PartialEq, Routable)]
|
||||
/// enum Route {
|
||||
/// // Redirects the /:id route to the Index route
|
||||
/// #[redirect("/:id", |_: usize| Route::Index {})]
|
||||
/// #[redirect("/:id", |id: usize| Route::Index {})]
|
||||
/// #[route("/", Index)]
|
||||
/// Index {},
|
||||
/// }
|
||||
/// # #[component]
|
||||
/// # fn Index() -> Element { None }
|
||||
/// ```
|
||||
///
|
||||
/// Redirects allow you to redirect a route to another route. The function must take all dynamic parameters of the route and all parent nests.
|
||||
@@ -124,29 +142,35 @@ mod segment;
|
||||
///
|
||||
/// Nests effect all nests, routes and redirects defined until the next `#[end_nest]` attribute. All children of nests are relative to the nest route and must include all dynamic parameters of the nest.
|
||||
///
|
||||
/// ```rust, skip
|
||||
/// ```rust
|
||||
/// use dioxus::prelude::*;
|
||||
///
|
||||
/// #[derive(Clone, Debug, PartialEq, Routable)]
|
||||
/// enum Route {
|
||||
/// // Nests all child routes in the /blog route
|
||||
/// #[nest("/blog")]
|
||||
/// // This is at /blog/:id
|
||||
/// #[redirect("/:id", |_: usize| Route::Index {})]
|
||||
/// #[redirect("/:id", |id: usize| Route::Index {})]
|
||||
/// // This is at /blog
|
||||
/// #[route("/", Index)]
|
||||
/// Index {},
|
||||
/// }
|
||||
/// # #[component]
|
||||
/// # fn Index() -> Element { None }
|
||||
/// ```
|
||||
///
|
||||
/// # `#[end_nest]`
|
||||
///
|
||||
/// The `#[end_nest]` attribute is used to end a nest. It takes no parameters.
|
||||
///
|
||||
/// ```rust, skip
|
||||
/// ```rust
|
||||
/// use dioxus::prelude::*;
|
||||
///
|
||||
/// #[derive(Clone, Debug, PartialEq, Routable)]
|
||||
/// enum Route {
|
||||
/// #[nest("/blog")]
|
||||
/// // This is at /blog/:id
|
||||
/// #[redirect("/:id", |_: usize| Route::Index {})]
|
||||
/// #[redirect("/:id", |id: usize| Route::Index {})]
|
||||
/// // This is at /blog
|
||||
/// #[route("/", Index)]
|
||||
/// Index {},
|
||||
@@ -156,6 +180,10 @@ mod segment;
|
||||
/// #[route("/")]
|
||||
/// Home {},
|
||||
/// }
|
||||
/// # #[component]
|
||||
/// # fn Index() -> Element { None }
|
||||
/// # #[component]
|
||||
/// # fn Home() -> Element { None }
|
||||
/// ```
|
||||
///
|
||||
/// # `#[layout(component)]`
|
||||
@@ -165,26 +193,34 @@ mod segment;
|
||||
///
|
||||
/// The layout component allows you to wrap all children of the layout in a component. The child routes are rendered in the Outlet of the layout component. The layout component must take all dynamic parameters of the nests it is nested in.
|
||||
///
|
||||
/// ```rust, skip
|
||||
/// ```rust
|
||||
/// use dioxus::prelude::*;
|
||||
///
|
||||
/// #[derive(Clone, Debug, PartialEq, Routable)]
|
||||
/// enum Route {
|
||||
/// #[layout(BlogFrame)]
|
||||
/// #[redirect("/:id", |_: usize| Route::Index {})]
|
||||
/// #[redirect("/:id", |id: usize| Route::Index {})]
|
||||
/// // Index will be rendered in the Outlet of the BlogFrame component
|
||||
/// #[route("/", Index)]
|
||||
/// Index {},
|
||||
/// }
|
||||
/// # #[component]
|
||||
/// # fn Index() -> Element { None }
|
||||
/// # #[component]
|
||||
/// # fn BlogFrame() -> Element { None }
|
||||
/// ```
|
||||
///
|
||||
/// # `#[end_layout]`
|
||||
///
|
||||
/// The `#[end_layout]` attribute is used to end a layout. It takes no parameters.
|
||||
///
|
||||
/// ```rust, skip
|
||||
/// ```rust
|
||||
/// use dioxus::prelude::*;
|
||||
///
|
||||
/// #[derive(Clone, Debug, PartialEq, Routable)]
|
||||
/// enum Route {
|
||||
/// #[layout(BlogFrame)]
|
||||
/// #[redirect("/:id", |_: usize| Route::Index {})]
|
||||
/// #[redirect("/:id", |id: usize| Route::Index {})]
|
||||
/// // Index will be rendered in the Outlet of the BlogFrame component
|
||||
/// #[route("/", Index)]
|
||||
/// Index {},
|
||||
@@ -194,6 +230,12 @@ mod segment;
|
||||
/// #[route("/")]
|
||||
/// Home {},
|
||||
/// }
|
||||
/// # #[component]
|
||||
/// # fn Index() -> Element { None }
|
||||
/// # #[component]
|
||||
/// # fn BlogFrame() -> Element { None }
|
||||
/// # #[component]
|
||||
/// # fn Home() -> Element { None }
|
||||
/// ```
|
||||
#[proc_macro_derive(
|
||||
Routable,
|
||||
|
||||
Reference in new issue
Block a user