use crate::*;
#[test]
fn flex_container_with_padding() {
assert_xml!(
r#"
<div style="display: flex; width: 200px; padding: 10px;">
<div style="width: 50px; height: 50px;" expect_left="10"></div>
<div style="width: 50px; height: 50px;" expect_left="60"></div>
</div>
"#
)
}
#[test]
fn flex_item_with_padding() {
assert_xml!(
r#"
<div style="display: flex; width: 200px;">
<div style="width: 50px; height: 50px; padding: 10px;" expect_width="70"></div>
<div style="width: 50px; height: 50px;" expect_width="50"></div>
</div>
"#
)
}
#[test]
fn flex_container_with_border() {
assert_xml!(
r#"
<div style="display: flex; width: 200px; border: 5px solid black;">
<div style="width: 50px; height: 50px;" expect_left="5"></div>
<div style="width: 50px; height: 50px;" expect_left="55"></div>
</div>
"#
)
}
#[test]
fn flex_item_with_border() {
assert_xml!(
r#"
<div style="display: flex; width: 200px;">
<div style="width: 50px; height: 50px; border: 5px solid black;" expect_width="60"></div>
<div style="width: 50px; height: 50px;" expect_width="50"></div>
</div>
"#
)
}
#[test]
fn flex_container_padding_border() {
assert_xml!(
r#"
<div style="display: flex; width: 200px; padding: 10px; border: 5px solid black;">
<div style="width: 50px; height: 50px;" expect_left="15"></div>
<div style="width: 50px; height: 50px;" expect_left="65"></div>
</div>
"#
)
}
#[test]
fn flex_item_padding_border() {
assert_xml!(
r#"
<div style="display: flex; width: 200px;">
<div style="width: 50px; height: 50px; padding: 10px; border: 5px solid black;" expect_width="80"></div>
<div style="width: 50px; height: 50px;" expect_width="50"></div>
</div>
"#
)
}
#[test]
fn flex_grow_with_padding() {
assert_xml!(
r#"
<div style="display: flex; width: 300px;">
<div style="flex-grow: 1; padding: 10px; height: 50px;" expect_width="150"></div>
<div style="flex-grow: 1; padding: 10px; height: 50px;" expect_width="150"></div>
</div>
"#
)
}
#[test]
fn flex_shrink_with_border() {
assert_xml!(
r#"
<div style="display: flex; width: 200px;">
<div style="flex-shrink: 1; width: 300px; border: 5px solid black; height: 50px;" expect_width="173"></div>
<div style="width: 50px; height: 50px;" expect_width="27"></div>
</div>
"#
)
}
#[test]
fn gap_with_padding() {
assert_xml!(
r#"
<div style="display: flex; width: 200px; gap: 10px; padding: 10px;">
<div style="width: 50px; height: 50px;" expect_left="10"></div>
<div style="width: 50px; height: 50px;" expect_left="70"></div>
</div>
"#
)
}
#[test]
fn gap_with_border() {
assert_xml!(
r#"
<div style="display: flex; width: 200px; gap: 10px; border: 5px solid black;">
<div style="width: 50px; height: 50px;" expect_left="5"></div>
<div style="width: 50px; height: 50px;" expect_left="65"></div>
</div>
"#
)
}