Authored by Pavel Mazurin

Added tests for composite constraint deactivation

@@ -152,6 +152,27 @@ SpecBegin(MASCompositeConstraint) { @@ -152,6 +152,27 @@ SpecBegin(MASCompositeConstraint) {
152 expect(superview.constraints).to.haveCountOf(0); 152 expect(superview.constraints).to.haveCountOf(0);
153 } 153 }
154 154
  155 +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0
  156 +- (void)testDeactivate
  157 +{
  158 + NSArray *children = @[
  159 + [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_leading],
  160 + [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_trailing]
  161 + ];
  162 + composite = [[MASCompositeConstraint alloc] initWithChildren:children];
  163 + composite.delegate = delegate;
  164 + MAS_VIEW *newView = MAS_VIEW.new;
  165 + [superview addSubview:newView];
  166 +
  167 + //first equality statement
  168 + composite.equalTo(newView);
  169 + [composite install];
  170 +
  171 + expect(superview.constraints).to.haveCountOf(2);
  172 + [composite deactivate];
  173 + expect(superview.constraints).to.haveCountOf(0);}
  174 +#endif
  175 +
155 176
156 - (void)testAttributeChainingShouldCallDelegate { 177 - (void)testAttributeChainingShouldCallDelegate {
157 NSArray *children = @[ 178 NSArray *children = @[