in src/components/alignment.rs [168:195]
fn test_align_left_justified() {
let mut state = State::new();
let component = Aligned::new(
Box::new(Echo::<Msg>::new(false)),
HorizontalAlignmentKind::Left(true),
VerticalAlignmentKind::Top,
);
let original = vec![
vec!["hello world"].try_into().unwrap(), // 11 chars
vec!["pretty normal test"].try_into().unwrap(), // 18 chars
vec!["short"].try_into().unwrap(), // 5 chars
];
let msg = Msg(original);
state.insert(&msg);
let dimensions = Dimensions::new(20, 20);
let actual = component
.draw(&state, dimensions, DrawMode::Normal)
.unwrap();
let expected = vec![
vec!["hello world", &" ".repeat(18 - 11)]
.try_into()
.unwrap(),
vec!["pretty normal test"].try_into().unwrap(),
vec!["short", &" ".repeat(18 - 5)].try_into().unwrap(),
];
assert_eq!(actual, expected,);
}