test: Added inset property
Showing
1 changed file
with
23 additions
and
1 deletions
@@ -133,6 +133,28 @@ SpecBegin(MASCompositeConstraint) { | @@ -133,6 +133,28 @@ SpecBegin(MASCompositeConstraint) { | ||
133 | expect([children[5] layoutConstant]).to.equal(0); | 133 | expect([children[5] layoutConstant]).to.equal(0); |
134 | }; | 134 | }; |
135 | 135 | ||
136 | +- (void)testModifyInsetOnAppropriateChildren { | ||
137 | + NSArray *children = @[ | ||
138 | + [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_right], | ||
139 | + [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_top], | ||
140 | + [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_bottom], | ||
141 | + [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_left], | ||
142 | + [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_baseline], | ||
143 | + [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_width], | ||
144 | + ]; | ||
145 | + composite = [[MASCompositeConstraint alloc] initWithChildren:children]; | ||
146 | + composite.delegate = delegate; | ||
147 | + | ||
148 | + composite.with.inset(1); | ||
149 | + | ||
150 | + expect([children[0] layoutConstant]).to.equal(-1); | ||
151 | + expect([children[1] layoutConstant]).to.equal(1); | ||
152 | + expect([children[2] layoutConstant]).to.equal(-1); | ||
153 | + expect([children[3] layoutConstant]).to.equal(1); | ||
154 | + expect([children[4] layoutConstant]).to.equal(0); | ||
155 | + expect([children[5] layoutConstant]).to.equal(0); | ||
156 | +}; | ||
157 | + | ||
136 | - (void)testUninstall { | 158 | - (void)testUninstall { |
137 | NSArray *children = @[ | 159 | NSArray *children = @[ |
138 | [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_leading], | 160 | [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_leading], |
@@ -193,4 +215,4 @@ SpecBegin(MASCompositeConstraint) { | @@ -193,4 +215,4 @@ SpecBegin(MASCompositeConstraint) { | ||
193 | expect(newChild.delegate).to.beIdenticalTo(composite); | 215 | expect(newChild.delegate).to.beIdenticalTo(composite); |
194 | } | 216 | } |
195 | 217 | ||
196 | -SpecEnd | ||
218 | +SpecEnd |
-
Please register or login to post a comment