Skip to content

Commit 4dd7004

Browse files
committed
Add RemoveViewDynamically Test
1 parent 649c734 commit 4dd7004

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Tests/FlexLayoutTests/FlexLayoutTests.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,18 @@ final class FlexLayoutTests: XCTestCase {
2626

2727
XCTAssertNil(weakView, "Creation of flex should not lead to retain cycle")
2828
}
29+
30+
31+
func testRemoveViewDynamically() {
32+
let rootFlexContainer = UIView()
33+
rootFlexContainer.flex.addItem(UIView())
34+
rootFlexContainer.flex.define { _ in }
35+
rootFlexContainer.flex.layout()
36+
37+
rootFlexContainer.subviews.forEach { $0.removeFromSuperview() }
38+
rootFlexContainer.flex.markDirty()
39+
rootFlexContainer.flex.layout()
2940

41+
XCTAssertTrue(rootFlexContainer.subviews.isEmpty)
42+
}
3043
}

0 commit comments

Comments
 (0)