Skip to content

Commit

Permalink
try to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sachiniyer committed Nov 10, 2023
1 parent 5906a72 commit e29826b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 101 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run api tests
run: cargo test --verbose --lib api
- name: Run model tests
run: cargo test --verbose --lib model
- name: Run site tests
run: cargo test --verbose --lib site

images:
runs-on: ubuntu-latest
Expand Down
47 changes: 0 additions & 47 deletions site/src/hooks/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,53 +120,6 @@ impl PartialEq for UseCounterHandle {
///
/// ```rust
/// # use yew::prelude::*;
/// #
/// use yew_hooks::prelude::*;
///
/// #[function_component(Counter)]
/// fn counter() -> Html {
/// let counter = use_counter(0);
///
/// let onincrease = {
/// let counter = counter.clone();
/// Callback::from(move |_| counter.increase())
/// };
/// let ondecrease = {
/// let counter = counter.clone();
/// Callback::from(move |_| counter.decrease())
/// };
/// let onincreaseby = {
/// let counter = counter.clone();
/// Callback::from(move |_| counter.increase_by(10))
/// };
/// let ondecreaseby = {
/// let counter = counter.clone();
/// Callback::from(move |_| counter.decrease_by(10))
/// };
/// let onset = {
/// let counter = counter.clone();
/// Callback::from(move |_| counter.set(100))
/// };
/// let onreset = {
/// let counter = counter.clone();
/// Callback::from(move |_| counter.reset())
/// };
///
/// html! {
/// <div>
/// <button onclick={onincrease}>{ "Increase" }</button>
/// <button onclick={ondecrease}>{ "Decrease" }</button>
/// <button onclick={onincreaseby}>{ "Increase by 10" }</button>
/// <button onclick={ondecreaseby}>{ "Decrease by 10" }</button>
/// <button onclick={onset}>{ "Set to 100" }</button>
/// <button onclick={onreset}>{ "Reset" }</button>
/// <p>
/// <b>{ "Current value: " }</b>
/// { *counter }
/// </p>
/// </div>
/// }
/// }
/// ```
#[hook]
pub fn use_counter(default: i32) -> UseCounterHandle {
Expand Down
51 changes: 0 additions & 51 deletions site/src/hooks/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,57 +102,6 @@ where
/// # use std::collections::VecDeque;
/// # use yew::prelude::*;
/// #
/// use yew_hooks::prelude::*;
///
/// #[function_component(UseQueue)]
/// fn queue() -> Html {
/// let queue = use_queue(VecDeque::from(["Mercury", "Venus", "Earth", "Mars"]));
///
/// let onset = {
/// let queue = queue.clone();
/// Callback::from(move |_| queue.set(VecDeque::from(["Moon", "Earth"])))
/// };
/// let onpush_back = {
/// let queue = queue.clone();
/// Callback::from(move |_| {
/// queue.push_back("Jupiter");
/// })
/// };
/// let onpop_front = {
/// let queue = queue.clone();
/// Callback::from(move |_| {
/// let _ = queue.pop_front();
/// })
/// };
/// let onretain = {
/// let queue = queue.clone();
/// Callback::from(move |_| queue.retain(|v| v.contains('a')))
/// };
/// let onclear = {
/// let queue = queue.clone();
/// Callback::from(move |_| queue.clear())
/// };
///
/// html! {
/// <div>
/// <button onclick={onset}>{ "Set" }</button>
/// <button onclick={onpush_back}>{ "Push back" }</button>
/// <button onclick={onpop_front}>{ "Pop front" }</button>
/// <button onclick={onretain}>{ "Retain" }</button>
/// <button onclick={onclear}>{ "Clear all" }</button>
/// <p>
/// <b>{ "Current value: " }</b>
/// </p>
/// {
/// for queue.current().iter().map(|v| {
/// html! {
/// <p><b>{ v }</b></p>
/// }
/// })
/// }
/// </div>
/// }
/// }
/// ```
#[hook]
pub fn use_queue<T>(initial_value: VecDeque<T>) -> UseQueueHandle<T>
Expand Down

0 comments on commit e29826b

Please sign in to comment.