diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..3bcbe0b --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,34 @@ +on: + pull_request: + workflow_dispatch: + +name: Tests + +permissions: write-all + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + profile: minimal + override: true + components: rustfmt, clippy, rust-src + - name: Cache + uses: Swatinem/rust-cache@v2 + - name: Check function count badge + run: python3 docs/generate_count_badge.py --check + - name: Check formatting + run: cargo fmt --check +# TODO: this action doesn't seem to work +# - name: Clippy check +# uses: auguwu/clippy-action@1.1.2 +# with: +# args: --all-features --tests +# token: ${{ secrets.GITHUB_TOKEN }} + - name: Run tests + run: cargo test --all-features diff --git a/src/on_click_outside.rs b/src/on_click_outside.rs index c9bc694..5167099 100644 --- a/src/on_click_outside.rs +++ b/src/on_click_outside.rs @@ -25,11 +25,12 @@ static IOS_WORKAROUND: RwLock = RwLock::new(false); /// ``` /// # use leptos::*; /// # use leptos::ev::resize; +/// # use leptos::html::Div; /// # use leptos_use::on_click_outside; /// # /// # #[component] /// # fn Demo(cx: Scope) -> impl IntoView { -/// let target = create_node_ref(cx); +/// let target = create_node_ref::
(cx); /// /// on_click_outside(cx, target, move |event| { log!("{:?}", event); }); /// diff --git a/src/use_css_var.rs b/src/use_css_var.rs index 4b3c346..88ddccd 100644 --- a/src/use_css_var.rs +++ b/src/use_css_var.rs @@ -48,11 +48,12 @@ use wasm_bindgen::{JsCast, JsValue}; /// /// ``` /// # use leptos::*; +/// # use leptos::html::Div; /// # use leptos_use::{use_css_var_with_options, UseCssVarOptions}; /// # /// # #[component] /// # fn Demo(cx: Scope) -> impl IntoView { -/// let el = create_node_ref(cx); +/// let el = create_node_ref::
(cx); /// /// let (color, set_color) = use_css_var_with_options( /// cx, diff --git a/src/use_element_hover.rs b/src/use_element_hover.rs index f6a6be7..349b8ca 100644 --- a/src/use_element_hover.rs +++ b/src/use_element_hover.rs @@ -17,11 +17,12 @@ use web_sys::AddEventListenerOptions; /// /// ``` /// # use leptos::*; -/// use leptos_use::use_element_hover; +/// # use leptos::html::Button; +/// # use leptos_use::use_element_hover; /// # /// # #[component] /// # fn Demo(cx: Scope) -> impl IntoView { -/// let el = create_node_ref(cx); +/// let el = create_node_ref::