mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 21:52:32 +00:00
The surface and story layout tables name the library's types under craft_ui, but since the split a type's crate target is the crate that declares it, so no library row matched: Slider's value groups lost their form rows and every library type sat on the panel surface. The table key reads a type of any library crate as craft_ui, as the level rows already read a library module path. The stale-row check runs in the craft-ui facade's trials, where every crate of the library is linked, and checks the library's rows whenever one of its crates is.
27 lines
1.1 KiB
Rust
27 lines
1.1 KiB
Rust
//! The components index (`docs/components-index.md`) is what the registrations give, and the level tables name only
|
|
//! registered types.
|
|
|
|
use craft_ui::contract::stale_table_rows;
|
|
use craft_ui::testing::index::components_index;
|
|
use craft_ui::testing::library_registrations;
|
|
use craft_ui::testing::trial;
|
|
use std::path::Path;
|
|
|
|
#[trial]
|
|
fn the_committed_components_index_is_what_the_registrations_give() {
|
|
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../..");
|
|
let committed = std::fs::read_to_string(root.join("docs/components-index.md")).unwrap_or_default();
|
|
assert!(
|
|
committed == components_index(&root, &library_registrations()),
|
|
"docs/components-index.md is stale; run `cargo run -p craft-ui-gallery --bin components-index`"
|
|
);
|
|
}
|
|
|
|
/// Guards against a surface or story layout row whose type or story group is gone; the library's crates are linked
|
|
/// together only here.
|
|
#[trial]
|
|
fn the_level_tables_name_only_registered_types_and_story_groups() {
|
|
let stale = stale_table_rows(&library_registrations());
|
|
assert!(stale.is_empty(), "stale level table rows: {stale:#?}");
|
|
}
|