use crate::*;
#[test]
fn display_inline_flex() {
assert_xml!(
r#"
<div style="width: 200px; height: 100px;">
<div style="display: inline-flex; width: 100px; height: 50px;">
<div style="width: 50px; height: 50px;" expect_width="50" expect_height="50" expect_left="0"></div>
</div>
<div style="display: inline-flex; width: 100px; height: 50px;">
<div style="width: 50px; height: 50px;" expect_width="50" expect_height="50" expect_left="0"></div>
</div>
</div>
"#
)
}
#[test]
fn display_inline_flex_with_text_slot() {
assert_xml!(
r#"
<div style="width: 200px; height: 100px;">
<div style="display: inline-flex; height: 50px;">
<div style="display: inline;" expect_width="32" expect_height="50">
<text-slot len="2"></text-slot>
</div>
</div>
</div>
"#
)
}
#[test]
fn display_inline_flex_two_text_slots() {
assert_xml!(
r#"
<div style="width: 200px; height: 100px;">
<div style="display: inline-flex; width: 100px; height: 50px;">
<div style="display: inline;" expect_width="32" expect_height="50" expect_left="0">
<text-slot len="2"></text-slot>
</div>
<div style="display: inline;" expect_width="32" expect_height="50" expect_left="32">
<text-slot len="2"></text-slot>
</div>
</div>
</div>
"#
)
}
#[test]
fn display_inline_flex_with_margin() {
assert_xml!(
r#"
<div style="width: 200px; height: 100px;">
<div style="display: inline-flex; width: 50px; height: 50px; margin: 10px;">
<div style="width: 30px; height: 30px;" expect_width="30" expect_height="30" expect_left="0" expect_top="0"></div>
</div>
<div style="display: inline-flex; width: 50px; height: 50px; margin: 10px;">
<div style="width: 30px; height: 30px;" expect_width="30" expect_height="30" expect_left="0" expect_top="0"></div>
</div>
</div>
"#
)
}
#[test]
fn display_inline_flex_with_padding_border() {
assert_xml!(
r#"
<div style="width: 200px; height: 100px;">
<div style="display: inline-flex; width: 100px; height: 50px; padding: 10px; border-top-width: 5px; border-right-width: 5px; border-bottom-width: 5px; border-left-width: 5px;" expect_width="130" expect_height="80">
<div style="width: 50px; height: 30px;" expect_width="50" expect_height="30" expect_left="15" expect_top="15"></div>
</div>
</div>
"#
)
}
#[test]
fn display_inline_flex_auto_width() {
assert_xml!(
r#"
<div style="width: 200px; height: 100px;">
<div style="display: inline-flex; height: 50px;">
<div style="width: 50px; height: 30px;" expect_width="50" expect_height="30"></div>
</div>
</div>
"#
)
}
#[test]
fn display_inline_flex_border_box() {
assert_xml!(
r#"
<div style="width: 200px; height: 100px;">
<div style="display: inline-flex; box-sizing: border-box; width: 100px; height: 50px; padding: 10px; border-top-width: 5px; border-right-width: 5px; border-bottom-width: 5px; border-left-width: 5px;" expect_width="100" expect_height="50">
<div style="width: 50px; height: 30px;" expect_width="50" expect_height="30" expect_left="15" expect_top="15"></div>
</div>
</div>
"#
)
}
#[test]
fn display_inline_flex_multiple() {
assert_xml!(
r#"
<div style="width: 200px; height: 100px;">
<div style="display: inline-flex; width: 50px; height: 50px;">
<div style="width: 30px; height: 30px;" expect_width="30" expect_height="30" expect_left="0"></div>
</div>
<div style="display: inline-flex; width: 50px; height: 50px;">
<div style="width: 30px; height: 30px;" expect_width="30" expect_height="30" expect_left="0"></div>
</div>
</div>
"#
)
}
#[test]
fn display_inline_flex_with_flex_grow() {
assert_xml!(
r#"
<div style="width: 200px; height: 100px;">
<div style="display: inline-flex; width: 100px; height: 50px;">
<div style="flex-grow: 1; height: 30px;" expect_width="100" expect_height="30" expect_left="0"></div>
</div>
</div>
"#
)
}
#[test]
fn display_inline_flex_nested() {
assert_xml!(
r#"
<div style="width: 200px; height: 100px;">
<div style="display: inline-flex; width: 150px; height: 80px;">
<div style="display: inline-flex; width: 100px; height: 50px;">
<div style="width: 50px; height: 30px;" expect_width="50" expect_height="30" expect_left="0"></div>
</div>
</div>
</div>
"#
)
}