Added tests for composite constraint activation
Showing
1 changed file
with
24 additions
and
1 deletions
@@ -170,7 +170,30 @@ SpecBegin(MASCompositeConstraint) { | @@ -170,7 +170,30 @@ SpecBegin(MASCompositeConstraint) { | ||
170 | 170 | ||
171 | expect(superview.constraints).to.haveCountOf(2); | 171 | expect(superview.constraints).to.haveCountOf(2); |
172 | [composite deactivate]; | 172 | [composite deactivate]; |
173 | - expect(superview.constraints).to.haveCountOf(0);} | 173 | + expect(superview.constraints).to.haveCountOf(0); |
174 | +} | ||
175 | + | ||
176 | +- (void)testActivate | ||
177 | +{ | ||
178 | + NSArray *children = @[ | ||
179 | + [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_leading], | ||
180 | + [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_trailing] | ||
181 | + ]; | ||
182 | + composite = [[MASCompositeConstraint alloc] initWithChildren:children]; | ||
183 | + composite.delegate = delegate; | ||
184 | + MAS_VIEW *newView = MAS_VIEW.new; | ||
185 | + [superview addSubview:newView]; | ||
186 | + | ||
187 | + //first equality statement | ||
188 | + composite.equalTo(newView); | ||
189 | + [composite install]; | ||
190 | + | ||
191 | + expect(superview.constraints).to.haveCountOf(2); | ||
192 | + [composite deactivate]; | ||
193 | + expect(superview.constraints).to.haveCountOf(0); | ||
194 | + [composite activate]; | ||
195 | + expect(superview.constraints).to.haveCountOf(2); | ||
196 | +} | ||
174 | #endif | 197 | #endif |
175 | 198 | ||
176 | 199 |
-
Please register or login to post a comment