Add extended configuration method with self as argument.

This commit is contained in:
Anton Sergeev
2019-10-10 10:01:07 +03:00
parent 293b657aef
commit d34631e508
3 changed files with 37 additions and 0 deletions

View File

@@ -22,6 +22,13 @@
XCTAssertNoThrow([view configureLayoutWithBlock:block]);
}
- (void)testConfigureContainerLayoutIsNoOpWithNilBlock
{
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
id block = nil;
XCTAssertNoThrow([view configureLayoutWithContainerBlock:block]);
}
- (void)testConfigureLayoutBlockWorksWithValidBlock
{
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
@@ -35,6 +42,20 @@
XCTAssertEqual(view.yoga.width.value, 25);
}
- (void)testConfigureContainerLayoutBlockWorksWithValidBlock
{
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
[view configureLayoutWithContainerBlock:^(YGLayout *layout, UIView *container){
XCTAssertNotNil(layout);
XCTAssertTrue(view == container);
layout.isEnabled = YES;
layout.width = YGPointValue(25);
}];
XCTAssertTrue(view.yoga.isEnabled);
XCTAssertEqual(view.yoga.width.value, 25);
}
- (void)testNodesAreDeallocedWithSingleView
{
__weak YGLayout *layoutRef = nil;