mirror of
https://github.com/zaphar/sheetsui.git
synced 2025-07-22 04:39:48 -04:00
fix: warnings and some tests
This commit is contained in:
parent
69b7fb5983
commit
0ddeadde37
@ -1,5 +1,3 @@
|
|||||||
use std::cmp::{max, min};
|
|
||||||
|
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
self,
|
self,
|
||||||
layout::{Constraint, Layout, Rect},
|
layout::{Constraint, Layout, Rect},
|
||||||
|
@ -340,8 +340,6 @@ impl Widget for Markdown {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use ratatui::text::Text;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_empty_markdown() {
|
fn test_empty_markdown() {
|
||||||
let md = Markdown::from_str("");
|
let md = Markdown::from_str("");
|
||||||
@ -362,15 +360,17 @@ mod tests {
|
|||||||
let md = Markdown::from_str("# Heading 1\n## Heading 2\n### Heading 3");
|
let md = Markdown::from_str("# Heading 1\n## Heading 2\n### Heading 3");
|
||||||
let text = md.get_text();
|
let text = md.get_text();
|
||||||
|
|
||||||
// Should have 3 headings
|
// Should have 3 headings and 6 lines
|
||||||
assert_eq!(text.lines.len(), 3);
|
assert_eq!(text.lines.len(), 6);
|
||||||
|
|
||||||
// Check content
|
// Check content
|
||||||
assert_eq!(text.lines[0].spans[0].content, "Heading 1");
|
assert_eq!(text.lines[0].spans[0].content, "Heading 1");
|
||||||
assert_eq!(text.lines[1].spans[0].content, "Heading 2");
|
assert_eq!(text.lines[1].spans.len(), 0);
|
||||||
assert_eq!(text.lines[2].spans[0].content, "Heading 3");
|
assert_eq!(text.lines[2].spans[0].content, "Heading 2");
|
||||||
|
assert_eq!(text.lines[3].spans.len(), 0);
|
||||||
|
assert_eq!(text.lines[4].spans[0].content, "Heading 3");
|
||||||
|
assert_eq!(text.lines[5].spans.len(), 0);
|
||||||
|
|
||||||
// Check styling (we can't directly check the style, but we can verify it's different)
|
|
||||||
assert!(text.lines[0].style != text.lines[1].style);
|
assert!(text.lines[0].style != text.lines[1].style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user