Skip to content

Commit

Permalink
Add several tests for DateSelect (#207)
Browse files Browse the repository at this point in the history
* Add several tests for DateSelect

* Fix
  • Loading branch information
mikaelmello authored Dec 28, 2023
1 parent 9ec65eb commit cc89b75
Show file tree
Hide file tree
Showing 4 changed files with 664 additions and 43 deletions.
3 changes: 3 additions & 0 deletions inquire/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ once_cell = "1.18.0"
unicode-segmentation = "1"
unicode-width = "0.1"

[dev-dependencies]
chrono = { version = "0.4" }

[[example]]
name = "form"
required-features = ["date", "macros"]
Expand Down
8 changes: 4 additions & 4 deletions inquire/src/prompts/dateselect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use crate::{
error::{InquireError, InquireResult},
formatter::{self, DateFormatter},
prompts::prompt::Prompt,
terminal::{get_default_terminal, Terminal},
ui::{Backend, RenderConfig},
terminal::get_default_terminal,
ui::{date::DateSelectBackend, Backend, RenderConfig},
validator::DateValidator,
};

Expand Down Expand Up @@ -270,9 +270,9 @@ impl<'a> DateSelect<'a> {
self.prompt_with_backend(&mut backend)
}

pub(crate) fn prompt_with_backend<T: Terminal>(
pub(crate) fn prompt_with_backend<B: DateSelectBackend>(
self,
backend: &mut Backend<'a, T>,
backend: &mut B,
) -> InquireResult<NaiveDate> {
DateSelectPrompt::new(self)?.prompt(backend)
}
Expand Down
Loading

0 comments on commit cc89b75

Please sign in to comment.