Переглянути джерело

Added tests for composite constraint deactivation

Pavel Mazurin 11 роки тому
батько
коміт
838cea8016
1 змінених файлів з 21 додано та 0 видалено
  1. 21 0
      Tests/Specs/MASCompositeConstraintSpec.m

+ 21 - 0
Tests/Specs/MASCompositeConstraintSpec.m

@@ -152,6 +152,27 @@ SpecBegin(MASCompositeConstraint) {
     expect(superview.constraints).to.haveCountOf(0);
 }
 
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0
+- (void)testDeactivate
+{
+    NSArray *children = @[
+        [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_leading],
+        [[MASViewConstraint alloc] initWithFirstViewAttribute:view.mas_trailing]
+    ];
+    composite = [[MASCompositeConstraint alloc] initWithChildren:children];
+    composite.delegate = delegate;
+    MAS_VIEW *newView = MAS_VIEW.new;
+    [superview addSubview:newView];
+    
+    //first equality statement
+    composite.equalTo(newView);
+    [composite install];
+    
+    expect(superview.constraints).to.haveCountOf(2);
+    [composite deactivate];
+    expect(superview.constraints).to.haveCountOf(0);}
+#endif
+
 
 - (void)testAttributeChainingShouldCallDelegate {
     NSArray *children = @[