mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-01-23 00:59:22 -05:00
fixed tests
This commit is contained in:
parent
c8508665d3
commit
895ec2cf86
9 changed files with 65 additions and 19 deletions
34
.github/workflows/tests.yml
vendored
Normal file
34
.github/workflows/tests.yml
vendored
Normal file
|
@ -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
|
|
@ -25,11 +25,12 @@ static IOS_WORKAROUND: RwLock<bool> = 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::<Div>(cx);
|
||||
///
|
||||
/// on_click_outside(cx, target, move |event| { log!("{:?}", event); });
|
||||
///
|
||||
|
|
|
@ -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::<Div>(cx);
|
||||
///
|
||||
/// let (color, set_color) = use_css_var_with_options(
|
||||
/// cx,
|
||||
|
|
|
@ -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::<Button>(cx);
|
||||
/// let is_hovered = use_element_hover(cx, el);
|
||||
///
|
||||
/// view! { cx,
|
||||
|
|
|
@ -14,11 +14,12 @@ use std::marker::PhantomData;
|
|||
///
|
||||
/// ```
|
||||
/// # use leptos::*;
|
||||
/// # use leptos::html::Div;
|
||||
/// # use leptos_use::use_element_visibility;
|
||||
/// #
|
||||
/// # #[component]
|
||||
/// # fn Demo(cx: Scope) -> impl IntoView {
|
||||
/// let el = create_node_ref(cx);
|
||||
/// let el = create_node_ref::<Div>(cx);
|
||||
///
|
||||
/// let is_visible = use_element_visibility(cx, el);
|
||||
///
|
||||
|
|
|
@ -19,11 +19,12 @@ use wasm_bindgen::prelude::*;
|
|||
///
|
||||
/// ```
|
||||
/// # use leptos::*;
|
||||
/// # use leptos::html::Div;
|
||||
/// # use leptos_use::use_intersection_observer;
|
||||
/// #
|
||||
/// # #[component]
|
||||
/// # fn Demo(cx: Scope) -> impl IntoView {
|
||||
/// let el = create_node_ref(cx);
|
||||
/// let el = create_node_ref::<Div>(cx);
|
||||
/// let (is_visible, set_visible) = create_signal(cx, false);
|
||||
///
|
||||
/// use_intersection_observer(
|
||||
|
|
|
@ -53,6 +53,7 @@ use web_sys::AddEventListenerOptions;
|
|||
///
|
||||
/// ```
|
||||
/// # use leptos::*;
|
||||
/// # use leptos::html::Div;
|
||||
/// use web_sys::MouseEvent;
|
||||
/// use leptos_use::{use_mouse_with_options, UseMouseOptions, UseMouseReturn, UseMouseEventExtractor, UseMouseCoordType};
|
||||
///
|
||||
|
@ -69,7 +70,7 @@ use web_sys::AddEventListenerOptions;
|
|||
///
|
||||
/// #[component]
|
||||
/// fn Demo(cx: Scope) -> impl IntoView {
|
||||
/// let element = create_node_ref(cx);
|
||||
/// let element = create_node_ref::<Div>(cx);
|
||||
///
|
||||
/// let UseMouseReturn {
|
||||
/// x, y, source_type, ..
|
||||
|
|
|
@ -18,11 +18,12 @@ use web_sys::MutationObserverInit;
|
|||
///
|
||||
/// ```
|
||||
/// # use leptos::*;
|
||||
/// # use leptos::html::Pre;
|
||||
/// # use leptos_use::use_mutation_observer_with_options;
|
||||
/// #
|
||||
/// # #[component]
|
||||
/// # fn Demo(cx: Scope) -> impl IntoView {
|
||||
/// let el = create_node_ref(cx);
|
||||
/// let el = create_node_ref::<Pre>(cx);
|
||||
/// let (text, set_text) = create_signal(cx, "".to_string());
|
||||
///
|
||||
/// let mut init = web_sys::MutationObserverInit::new();
|
||||
|
|
|
@ -19,11 +19,12 @@ use wasm_bindgen::JsCast;
|
|||
/// ```
|
||||
/// # use leptos::*;
|
||||
/// # use leptos::ev::resize;
|
||||
/// # use leptos::html::Div;
|
||||
/// # use leptos_use::{use_scroll, UseScrollReturn};
|
||||
/// #
|
||||
/// # #[component]
|
||||
/// # fn Demo(cx: Scope) -> impl IntoView {
|
||||
/// let element = create_node_ref(cx);
|
||||
/// let element = create_node_ref::<Div>(cx);
|
||||
///
|
||||
/// let UseScrollReturn {
|
||||
/// x, y, set_x, set_y, is_scrolling, arrived_state, directions, ..
|
||||
|
@ -42,12 +43,13 @@ use wasm_bindgen::JsCast;
|
|||
///
|
||||
/// ```
|
||||
/// # use leptos::*;
|
||||
/// # use leptos::html::Div;
|
||||
/// # use leptos::ev::resize;
|
||||
/// # use leptos_use::{use_scroll_with_options, UseScrollReturn, UseScrollOptions, ScrollOffset};
|
||||
/// #
|
||||
/// # #[component]
|
||||
/// # fn Demo(cx: Scope) -> impl IntoView {
|
||||
/// # let element = create_node_ref(cx);
|
||||
/// # let element = create_node_ref::<Div>(cx);
|
||||
/// #
|
||||
/// let UseScrollReturn {
|
||||
/// x,
|
||||
|
@ -81,12 +83,13 @@ use wasm_bindgen::JsCast;
|
|||
///
|
||||
/// ```
|
||||
/// # use leptos::*;
|
||||
/// # use leptos::html::Div;
|
||||
/// # use leptos::ev::resize;
|
||||
/// # use leptos_use::{use_scroll, UseScrollReturn};
|
||||
/// #
|
||||
/// # #[component]
|
||||
/// # fn Demo(cx: Scope) -> impl IntoView {
|
||||
/// let element = create_node_ref(cx);
|
||||
/// let element = create_node_ref::<Div>(cx);
|
||||
///
|
||||
/// let UseScrollReturn {
|
||||
/// x, y, set_x, set_y, ..
|
||||
|
@ -109,11 +112,12 @@ use wasm_bindgen::JsCast;
|
|||
/// ```
|
||||
/// # use leptos::*;
|
||||
/// # use leptos::ev::resize;
|
||||
/// # use leptos::html::Div;
|
||||
/// # use leptos_use::{use_scroll_with_options, UseScrollReturn, UseScrollOptions, ScrollBehavior};
|
||||
/// #
|
||||
/// # #[component]
|
||||
/// # fn Demo(cx: Scope) -> impl IntoView {
|
||||
/// # let element = create_node_ref(cx);
|
||||
/// # let element = create_node_ref::<Div>(cx);
|
||||
/// #
|
||||
/// let UseScrollReturn {
|
||||
/// x, y, set_x, set_y, ..
|
||||
|
@ -134,11 +138,12 @@ use wasm_bindgen::JsCast;
|
|||
/// ```
|
||||
/// # use leptos::*;
|
||||
/// # use leptos::ev::resize;
|
||||
/// # use leptos::html::Div;
|
||||
/// # use leptos_use::{use_scroll_with_options, UseScrollReturn, UseScrollOptions, ScrollBehavior};
|
||||
/// #
|
||||
/// # #[component]
|
||||
/// # fn Demo(cx: Scope) -> impl IntoView {
|
||||
/// # let element = create_node_ref(cx);
|
||||
/// # let element = create_node_ref::<Div>(cx);
|
||||
/// #
|
||||
/// let (smooth, set_smooth) = create_signal(cx, false);
|
||||
///
|
||||
|
|
Loading…
Add table
Reference in a new issue