Allow import of layout_test into 3rd party crates (#3463)

* Expose layout tests

Currently I can't import tests because `cfg(test)` isn't sent to sub-dependencies.   This allows you to set a `yew/test` and import into your own tests.

* Update Cargo.toml

* Update lib.rs

* Update lib.rs

* Update lib.rs

* AnyScope::test needs feature = test cfg + fmt

---------

Co-authored-by: Elina <imelina@elina.website>
This commit is contained in:
rollo-b2c2 2024-10-14 16:27:54 +01:00 committed by GitHub
parent a80542fd49
commit 4025fa75f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -96,6 +96,7 @@ ssr = ["dep:html-escape", "dep:base64ct", "dep:bincode"]
csr = []
hydration = ["csr", "dep:bincode"]
default = []
test = []
[package.metadata.docs.rs]
all-features = true

View File

@ -513,7 +513,7 @@ mod feat_csr {
use crate::scheduler;
impl AnyScope {
#[cfg(test)]
#[cfg(any(test, feature = "test"))]
pub(crate) fn test() -> Self {
Self {
type_id: TypeId::of::<()>(),

View File

@ -293,8 +293,7 @@ mod app_handle;
#[cfg(feature = "csr")]
mod renderer;
#[cfg(feature = "csr")]
#[cfg(test)]
#[cfg(all(feature = "csr", any(test, feature = "test")))]
#[allow(missing_docs)]
pub mod tests;