diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6fd96aa..ff0bf0e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -114,6 +114,34 @@ jobs: - name: Run cargo test run: cargo test --all-targets --no-fail-fast + wasm-test: + name: wasm-pack test (headless Firefox) + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + + - name: Install nightly Rust + uses: dtolnay/rust-toolchain@nightly + with: + targets: wasm32-unknown-unknown + + - name: Cache cargo registry and target + uses: Swatinem/rust-cache@v2 + with: + key: wasm-test + + - name: Install wasm-pack + # wasm-pack ships pre-built binaries; the official installer is the + # fastest path on Linux runners (cargo install would compile from + # source for several minutes). + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + + - name: Run browser tests + # ubuntu-latest already ships Firefox; geckodriver is auto-fetched + # by wasm-pack in a version that matches the installed browser. + run: wasm-pack test --headless --firefox --test wasm + build: runs-on: ubuntu-latest timeout-minutes: 15 diff --git a/Cargo.lock b/Cargo.lock index 95994bb..6dbab66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -116,6 +116,16 @@ version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" +[[package]] +name = "cc" +version = "1.2.62" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98" +dependencies = [ + "find-msvc-tools", + "shlex", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -318,6 +328,12 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + [[package]] name = "fnv" version = "1.0.7" @@ -950,6 +966,16 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "minicov" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4869b6a491569605d66d3952bcdf03df789e5b536e5f0cf7758a7f08a55ae24d" +dependencies = [ + "cc", + "walkdir", +] + [[package]] name = "next_tuple" version = "0.1.0" @@ -981,11 +1007,14 @@ name = "odp" version = "0.1.0" dependencies = [ "console_error_panic_hook", + "js-sys", "leptos", "leptos_meta", "leptos_router", "serde_json", "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test", "web-sys", ] @@ -1449,6 +1478,12 @@ dependencies = [ "syn", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "slab" version = "0.4.9" @@ -1810,6 +1845,30 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-bindgen-test" +version = "0.3.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66c8d5e33ca3b6d9fa3b4676d774c5778031d27a578c2b007f905acf816152c3" +dependencies = [ + "js-sys", + "minicov", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test-macro", +] + +[[package]] +name = "wasm-bindgen-test-macro" +version = "0.3.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17d5042cc5fa009658f9a7333ef24291b1291a25b6382dd68862a7f3b969f69b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "wasm-streams" version = "0.4.2" diff --git a/Cargo.toml b/Cargo.toml index 59b4cd9..842e6b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,13 @@ wasm-bindgen = "0.2.100" web-sys = { version = "0.3.77", features = ["Document", "Window", "console"] } [dev-dependencies] +js-sys = "0.3" serde_json = "1" +wasm-bindgen-futures = "0.4" +wasm-bindgen-test = "0.3" [package.metadata.leptos] -assets-dir="public" \ No newline at end of file +assets-dir="public" + +[profile.release] +strip = true diff --git a/index.html b/index.html index 61562ff..6fd059e 100644 --- a/index.html +++ b/index.html @@ -15,7 +15,20 @@ - + + diff --git a/src/components/documentation_training.rs b/src/components/documentation_training.rs index 75fa660..5a02001 100644 --- a/src/components/documentation_training.rs +++ b/src/components/documentation_training.rs @@ -1,7 +1,5 @@ -use crate::components::themed_icon::ThemedIcon; -use crate::components::ui::{Heading, HeadingLevel, Text, TextSize}; +use crate::components::ui::{DocLinkItem, Heading, HeadingLevel, IconBlock, IconBlockSize, Text, TextSize}; use leptos::prelude::*; -use leptos_router::components::A; #[derive(Clone)] pub struct DocLink { @@ -46,12 +44,7 @@ pub const DEFAULT_DOC_LINKS: &[DocLink] = &[ pub fn DocumentationTraining(#[prop(default = DEFAULT_DOC_LINKS.to_vec())] links: Vec) -> impl IntoView { view! {
-
- + "Documentation" @@ -59,35 +52,14 @@ pub fn DocumentationTraining(#[prop(default = DEFAULT_DOC_LINKS.to_vec())] links "Start developing with ODP" -
+