Skip to content

Commit

Permalink
LibWeb/HTML: Tests for label layout: edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-za committed Dec 29, 2024
1 parent 3958d52 commit 27e9977
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Tests/LibWeb/Layout/expected/misc/label-empty-embedded-control.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x21 children: inline
frag 0 from Label start: 0, length: 0, rect: [8,8 200x21] baseline: 21
Label <label> at (8,8) content-size 200x21 inline-block [BFC] children: inline
frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 198x19] baseline: 21
TextNode <#text>
BlockContainer <input#hello> at (9,9) content-size 198x19 inline-block [BFC] children: not-inline
Box <div> at (11,10) content-size 194x17 flex-container(row) [FFC] children: not-inline
BlockContainer <div> at (11,10) content-size 194x17 flex-item [BFC] children: inline
TextNode <#text>
TextNode <#text>
TextNode <#text>

ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x21]
PaintableWithLines (Label<LABEL>) [8,8 200x21]
PaintableWithLines (BlockContainer<INPUT>#hello) [8,8 200x21]
PaintableBox (Box<DIV>) [9,9 198x19]
PaintableWithLines (BlockContainer<DIV>) [11,10 194x17]

24 changes: 24 additions & 0 deletions Tests/LibWeb/Layout/expected/misc/label-empty-forcontrol.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x24 children: inline
frag 0 from Label start: 0, length: 0, rect: [8,29 0x0] baseline: 0
frag 1 from TextNode start: 0, length: 1, rect: [8,15 8x17] baseline: 13.296875
" "
frag 2 from BlockContainer start: 0, length: 0, rect: [17,9 198x19] baseline: 21
Label <label> at (8,29) content-size 0x0 inline-block [BFC] children: not-inline
TextNode <#text>
BlockContainer <input#hello> at (17,9) content-size 198x19 inline-block [BFC] children: not-inline
Box <div> at (19,10) content-size 194x17 flex-container(row) [FFC] children: not-inline
BlockContainer <div> at (19,10) content-size 194x17 flex-item [BFC] children: inline
TextNode <#text>
TextNode <#text>

ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x24]
PaintableWithLines (Label<LABEL>) [8,29 0x0]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<INPUT>#hello) [16,8 200x21]
PaintableBox (Box<DIV>) [17,9 198x19]
PaintableWithLines (BlockContainer<DIV>) [19,10 194x17]

26 changes: 26 additions & 0 deletions Tests/LibWeb/Layout/expected/misc/label-notempty-nocontrol.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x34 children: not-inline
BlockContainer <(anonymous)> at (8,8) content-size 784x17 children: inline
frag 0 from Label start: 0, length: 0, rect: [8,8 45.90625x17] baseline: 13.296875
Label <label> at (8,8) content-size 45.90625x17 inline-block [BFC] children: inline
frag 0 from TextNode start: 0, length: 5, rect: [8,8 45.90625x17] baseline: 13.296875
"howdy"
TextNode <#text>
TextNode <#text>
BlockContainer <div> at (8,25) content-size 784x17 children: inline
frag 0 from TextNode start: 0, length: 5, rect: [8,25 36.84375x17] baseline: 13.296875
"hello"
TextNode <#text>
BlockContainer <(anonymous)> at (8,42) content-size 784x0 children: inline
TextNode <#text>

ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x34]
PaintableWithLines (BlockContainer(anonymous)) [8,8 784x17]
PaintableWithLines (Label<LABEL>) [8,8 45.90625x17]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<DIV>) [8,25 784x17]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer(anonymous)) [8,42 784x0]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<label>
<input id="hello" />
</label>
2 changes: 2 additions & 0 deletions Tests/LibWeb/Layout/input/misc/label-empty-forcontrol.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<label for="hello"></label>
<input id="hello" />
2 changes: 2 additions & 0 deletions Tests/LibWeb/Layout/input/misc/label-notempty-nocontrol.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<label>howdy</label>
<div>hello</div>

0 comments on commit 27e9977

Please sign in to comment.