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::{
|
||||
self,
|
||||
layout::{Constraint, Layout, Rect},
|
||||
|
@ -340,8 +340,6 @@ impl Widget for Markdown {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use ratatui::text::Text;
|
||||
|
||||
#[test]
|
||||
fn test_empty_markdown() {
|
||||
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 text = md.get_text();
|
||||
|
||||
// Should have 3 headings
|
||||
assert_eq!(text.lines.len(), 3);
|
||||
// Should have 3 headings and 6 lines
|
||||
assert_eq!(text.lines.len(), 6);
|
||||
|
||||
// Check content
|
||||
assert_eq!(text.lines[0].spans[0].content, "Heading 1");
|
||||
assert_eq!(text.lines[1].spans[0].content, "Heading 2");
|
||||
assert_eq!(text.lines[2].spans[0].content, "Heading 3");
|
||||
assert_eq!(text.lines[1].spans.len(), 0);
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user