Skip to content

Commit

Permalink
update ObjectiveCSpec.m
Browse files Browse the repository at this point in the history
  • Loading branch information
protosse committed May 18, 2021
1 parent 07be46d commit a4dcf31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions Tests/Common/ObjectiveCSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,29 @@
});

it(@"basic pinlayout calls", ^{
[[[aView pinObjc] top:10] layout];
aView.pinObjc.topValue(10).layout();
expect(@(aView.frame)).to(equal(@(CGRectMake(40, 10, 100, 60))));
});

it(@"using Pin.logMissingLayoutCalls", ^{
Pin.logMissingLayoutCalls = true;
[[aView pinObjc] top:10];
aView.pinObjc.topValue(10);
//expect(Pin.lastWarningText).to(contain(@"PinLayout commands have been issued without calling the 'layout()' method to complete the layout"));
});

it(@"using Pin.logMissingLayoutCalls set to false", ^{
Pin.logMissingLayoutCalls = false;
[[[aView pinObjc] top:10] layout];
aView.pinObjc.topValue(10).layout();
expect(@(aView.frame)).to(equal(@(CGRectMake(40, 10, 100, 60))));
expect(Pin.lastWarningText).to(beNil());
});

it(@"check the access to PinLayout methods from objective-c", ^{
[[[rootView pinObjc] wrapContent] layout];
[[[rootView pinObjc] wrapContentWithType:WrapTypeVertically] layout];
[[[rootView pinObjc] wrapContentWithInsets:UIEdgeInsetsMake(0, 0, 0, 0)] layout];
[[[rootView pinObjc] wrapContentWithType:WrapTypeAll insets:UIEdgeInsetsMake(0, 0, 0, 0)] layout];
[[[rootView pinObjc] wrapContentWithPadding:10] layout];
[[[rootView pinObjc] wrapContentWithType:WrapTypeHorizontally padding:10] layout];
rootView.pinObjc.wrapContent().layout();
rootView.pinObjc.wrapContentInsets(UIEdgeInsetsMake(0, 0, 0, 0)).layout();
rootView.pinObjc.wrapContentTypeInsets(WrapTypeAll, UIEdgeInsetsMake(0, 0, 0, 0)).layout();
rootView.pinObjc.wrapContentPadding(10).layout();
rootView.pinObjc.wrapContentTypePadding(WrapTypeHorizontally, 10).layout();
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion docs/objective_c.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ When using the Objective-c interface, the `layout` method must be called explici
view.pin.width(100)
// Objective-c
view.pinObjc.width().layout();
view.pinObjc.width(100).layout();
```

0 comments on commit a4dcf31

Please sign in to comment.