Created
January 27, 2011 16:12
-
-
Save julesfern/798705 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test(description="Elements with height: auto correctly recalculate their dimensions when children modify their sizes")] | |
public function heightAutoElementsCalculateContentSizes():void | |
{ | |
var wrapper:UIElement = new UIElement(this._baseUI); | |
wrapper.localStyleString = "width: 100px; height: auto;"; | |
Assert.assertEquals(0, wrapper.contentHeight); | |
var children:Vector.<UIElement> = new Vector.<UIElement>(); | |
for(var i:uint=0; i<5; i++) | |
{ | |
var h:uint = wrapper.contentHeight; | |
var c:UIElement = new UIElement(this._baseUI); | |
c.localStyleString = "display: block; width: 50px; height: 10px;"; | |
children.push(c); | |
wrapper.addElement(c); | |
Assert.assertEquals(h+10, wrapper.contentHeight); | |
} | |
// Now take a child and increase its size | |
children[0].localStyleString = "display: block; width: 50px; height: 100px;"; | |
Assert.assertEquals(140, wrapper.contentHeight); | |
// Now do something evil - set them all to float | |
for(var j:uint=0; j<children.length; j++) | |
{ | |
children[j].localStyleString = "display: block; width: 50px; height: 10px; float: left;"; | |
} | |
// It should now be wrapped onto three lines | |
Assert.assertEquals(30, wrapper.contentHeight); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment