Showing
11 changed files
with
91 additions
and
96 deletions
@@ -169,21 +169,21 @@ | @@ -169,21 +169,21 @@ | ||
169 | }; | 169 | }; |
170 | } | 170 | } |
171 | 171 | ||
172 | -- (id<MASConstraint> (^)(id))equal { | 172 | +- (id<MASConstraint> (^)(id))equalTo { |
173 | return [self equalityWithBlock:^id(id<MASConstraint> constraint, id attr) { | 173 | return [self equalityWithBlock:^id(id<MASConstraint> constraint, id attr) { |
174 | - return constraint.equal(attr); | 174 | + return constraint.equalTo(attr); |
175 | }]; | 175 | }]; |
176 | } | 176 | } |
177 | 177 | ||
178 | -- (id<MASConstraint> (^)(id))greaterThanOrEqual { | 178 | +- (id<MASConstraint> (^)(id))greaterThanOrEqualTo { |
179 | return [self equalityWithBlock:^id<MASConstraint>(id<MASConstraint> constraint, id attr) { | 179 | return [self equalityWithBlock:^id<MASConstraint>(id<MASConstraint> constraint, id attr) { |
180 | - return constraint.greaterThanOrEqual(attr); | 180 | + return constraint.greaterThanOrEqualTo(attr); |
181 | }]; | 181 | }]; |
182 | } | 182 | } |
183 | 183 | ||
184 | -- (id<MASConstraint> (^)(id))lessThanOrEqual { | 184 | +- (id<MASConstraint> (^)(id))lessThanOrEqualTo { |
185 | return [self equalityWithBlock:^id<MASConstraint>(id<MASConstraint> constraint, id attr) { | 185 | return [self equalityWithBlock:^id<MASConstraint>(id<MASConstraint> constraint, id attr) { |
186 | - return constraint.lessThanOrEqual(attr); | 186 | + return constraint.lessThanOrEqualTo(attr); |
187 | }]; | 187 | }]; |
188 | } | 188 | } |
189 | 189 |
@@ -28,9 +28,9 @@ typedef float MASLayoutPriority; | @@ -28,9 +28,9 @@ typedef float MASLayoutPriority; | ||
28 | @property (nonatomic, copy, readonly) id<MASConstraint> (^priorityLow)(); | 28 | @property (nonatomic, copy, readonly) id<MASConstraint> (^priorityLow)(); |
29 | @property (nonatomic, copy, readonly) id<MASConstraint> (^priorityMedium)(); | 29 | @property (nonatomic, copy, readonly) id<MASConstraint> (^priorityMedium)(); |
30 | @property (nonatomic, copy, readonly) id<MASConstraint> (^priorityHigh)(); | 30 | @property (nonatomic, copy, readonly) id<MASConstraint> (^priorityHigh)(); |
31 | -@property (nonatomic, copy, readonly) id<MASConstraint> (^equal)(id attr); | ||
32 | -@property (nonatomic, copy, readonly) id<MASConstraint> (^greaterThanOrEqual)(id attr); | ||
33 | -@property (nonatomic, copy, readonly) id<MASConstraint> (^lessThanOrEqual)(id attr); | 31 | +@property (nonatomic, copy, readonly) id<MASConstraint> (^equalTo)(id attr); |
32 | +@property (nonatomic, copy, readonly) id<MASConstraint> (^greaterThanOrEqualTo)(id attr); | ||
33 | +@property (nonatomic, copy, readonly) id<MASConstraint> (^lessThanOrEqualTo)(id attr); | ||
34 | 34 | ||
35 | - (void)commit; | 35 | - (void)commit; |
36 | 36 |
@@ -189,7 +189,7 @@ | @@ -189,7 +189,7 @@ | ||
189 | [self.delegate addConstraint:self]; | 189 | [self.delegate addConstraint:self]; |
190 | } | 190 | } |
191 | 191 | ||
192 | -- (id<MASConstraint> (^)(id))equal { | 192 | +- (id<MASConstraint> (^)(id))equalTo { |
193 | return ^id(id attr) { | 193 | return ^id(id attr) { |
194 | NSAssert(!self.hasBeenCommitted, | 194 | NSAssert(!self.hasBeenCommitted, |
195 | @"Cannot modify constraint equal relation after it has been committed"); | 195 | @"Cannot modify constraint equal relation after it has been committed"); |
@@ -201,7 +201,7 @@ | @@ -201,7 +201,7 @@ | ||
201 | }; | 201 | }; |
202 | } | 202 | } |
203 | 203 | ||
204 | -- (id<MASConstraint> (^)(id))greaterThanOrEqual { | 204 | +- (id<MASConstraint> (^)(id))greaterThanOrEqualTo { |
205 | return ^id(id attr) { | 205 | return ^id(id attr) { |
206 | NSAssert(!self.hasBeenCommitted, | 206 | NSAssert(!self.hasBeenCommitted, |
207 | @"Cannot modify constraint greaterThanOrEqual relation after it has been committed"); | 207 | @"Cannot modify constraint greaterThanOrEqual relation after it has been committed"); |
@@ -213,7 +213,7 @@ | @@ -213,7 +213,7 @@ | ||
213 | }; | 213 | }; |
214 | } | 214 | } |
215 | 215 | ||
216 | -- (id<MASConstraint> (^)(id))lessThanOrEqual { | 216 | +- (id<MASConstraint> (^)(id))lessThanOrEqualTo { |
217 | return ^id(id attr) { | 217 | return ^id(id attr) { |
218 | NSAssert(!self.hasBeenCommitted, | 218 | NSAssert(!self.hasBeenCommitted, |
219 | @"Cannot modify constraint lessThanOrEqual relation after it has been committed"); | 219 | @"Cannot modify constraint lessThanOrEqual relation after it has been committed"); |
@@ -24,6 +24,6 @@ | @@ -24,6 +24,6 @@ | ||
24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerY; | 24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerY; |
25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_baseline; | 25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_baseline; |
26 | 26 | ||
27 | -- (void)mas_buildConstraints:(void(^)(MASConstraintBuilder *constrain))block; | 27 | +- (void)mas_buildConstraints:(void(^)(MASConstraintBuilder *make))block; |
28 | 28 | ||
29 | @end | 29 | @end |
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | @property (nonatomic, strong, readonly) MASViewAttribute *centerY; | 25 | @property (nonatomic, strong, readonly) MASViewAttribute *centerY; |
26 | @property (nonatomic, strong, readonly) MASViewAttribute *baseline; | 26 | @property (nonatomic, strong, readonly) MASViewAttribute *baseline; |
27 | 27 | ||
28 | -- (void)buildConstraints:(void(^)(MASConstraintBuilder *constraints))block; | 28 | +- (void)buildConstraints:(void(^)(MASConstraintBuilder *make))block; |
29 | 29 | ||
30 | @end | 30 | @end |
31 | 31 |
@@ -45,38 +45,38 @@ | @@ -45,38 +45,38 @@ | ||
45 | 45 | ||
46 | self.animatableConstraints = NSMutableArray.new; | 46 | self.animatableConstraints = NSMutableArray.new; |
47 | 47 | ||
48 | - [view1 mas_buildConstraints:^(MASConstraintBuilder *constrain) { | 48 | + [view1 mas_buildConstraints:^(MASConstraintBuilder *make) { |
49 | [self.animatableConstraints addObjectsFromArray:@[ | 49 | [self.animatableConstraints addObjectsFromArray:@[ |
50 | - constrain.edges.equal(superview).insets(paddingInsets).priorityLow(), | ||
51 | - constrain.bottom.equal(view3.mas_top).offset(-padding), | ||
52 | - constrain.right.equal(view2.mas_left).offset(-padding), | 50 | + make.edges.equalTo(superview).insets(paddingInsets).priorityLow(), |
51 | + make.bottom.equalTo(view3.mas_top).offset(-padding), | ||
52 | + make.right.equalTo(view2.mas_left).offset(-padding), | ||
53 | ]]; | 53 | ]]; |
54 | 54 | ||
55 | - constrain.size.equal(view2); | ||
56 | - constrain.height.equal(view3.mas_height); | 55 | + make.size.equalTo(view2); |
56 | + make.height.equalTo(view3.mas_height); | ||
57 | }]; | 57 | }]; |
58 | 58 | ||
59 | - [view2 mas_buildConstraints:^(MASConstraintBuilder *constrain) { | 59 | + [view2 mas_buildConstraints:^(MASConstraintBuilder *make) { |
60 | [self.animatableConstraints addObjectsFromArray:@[ | 60 | [self.animatableConstraints addObjectsFromArray:@[ |
61 | - constrain.edges.equal(superview).insets(paddingInsets).priorityLow(), | ||
62 | - constrain.left.equal(view1.mas_right).offset(padding), | ||
63 | - constrain.bottom.equal(view3.mas_top).offset(-padding), | 61 | + make.edges.equalTo(superview).insets(paddingInsets).priorityLow(), |
62 | + make.left.equalTo(view1.mas_right).offset(padding), | ||
63 | + make.bottom.equalTo(view3.mas_top).offset(-padding), | ||
64 | ]]; | 64 | ]]; |
65 | 65 | ||
66 | - constrain.size.equal(view1); | ||
67 | - constrain.height.equal(view3.mas_height); | 66 | + make.size.equalTo(view1); |
67 | + make.height.equalTo(view3.mas_height); | ||
68 | }]; | 68 | }]; |
69 | 69 | ||
70 | - [view3 mas_buildConstraints:^(MASConstraintBuilder *constrain) { | 70 | + [view3 mas_buildConstraints:^(MASConstraintBuilder *make) { |
71 | [self.animatableConstraints addObjectsFromArray:@[ | 71 | [self.animatableConstraints addObjectsFromArray:@[ |
72 | - constrain.edges.equal(superview).insets(paddingInsets).priorityLow(), | ||
73 | - constrain.top.equal(view1.mas_bottom).offset(padding), | 72 | + make.edges.equalTo(superview).insets(paddingInsets).priorityLow(), |
73 | + make.top.equalTo(view1.mas_bottom).offset(padding), | ||
74 | ]]; | 74 | ]]; |
75 | 75 | ||
76 | //TODO or pass an array | 76 | //TODO or pass an array |
77 | //constraints.height.equal(superview.subviews); | 77 | //constraints.height.equal(superview.subviews); |
78 | - constrain.height.equal(view1.mas_height); | ||
79 | - constrain.height.equal(view2.mas_height); | 78 | + make.height.equalTo(view1.mas_height); |
79 | + make.height.equalTo(view2.mas_height); | ||
80 | }]; | 80 | }]; |
81 | 81 | ||
82 | UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapWithGestureRecognizer:)]; | 82 | UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapWithGestureRecognizer:)]; |
@@ -35,41 +35,41 @@ | @@ -35,41 +35,41 @@ | ||
35 | UIView *superview = self; | 35 | UIView *superview = self; |
36 | int padding = 10; | 36 | int padding = 10; |
37 | 37 | ||
38 | - [view1 mas_buildConstraints:^(MASConstraintBuilder *constrain) { | ||
39 | - constrain.top.greaterThanOrEqual(superview.mas_top).offset(padding); | ||
40 | - constrain.left.equal(superview.mas_left).offset(padding); | ||
41 | - constrain.bottom.equal(view3.mas_top).offset(-padding); | ||
42 | - constrain.right.equal(view2.mas_left).offset(-padding); | ||
43 | - constrain.width.equal(view2.mas_width); | 38 | + [view1 mas_buildConstraints:^(MASConstraintBuilder *make) { |
39 | + make.top.greaterThanOrEqualTo(superview.mas_top).offset(padding); | ||
40 | + make.left.equalTo(superview.mas_left).offset(padding); | ||
41 | + make.bottom.equalTo(view3.mas_top).offset(-padding); | ||
42 | + make.right.equalTo(view2.mas_left).offset(-padding); | ||
43 | + make.width.equalTo(view2.mas_width); | ||
44 | 44 | ||
45 | //you can chain same attribute | 45 | //you can chain same attribute |
46 | - constrain.height | ||
47 | - .equal(view2.mas_height) | ||
48 | - .equal(view3.mas_height); | 46 | + make.height |
47 | + .equalTo(view2.mas_height) | ||
48 | + .equalTo(view3.mas_height); | ||
49 | }]; | 49 | }]; |
50 | 50 | ||
51 | - [view2 mas_buildConstraints:^(MASConstraintBuilder *constrain) { | ||
52 | - constrain.top.equal(superview.mas_top).offset(padding); | ||
53 | - constrain.left.equal(view1.mas_right).offset(padding); | ||
54 | - constrain.bottom.equal(view3.mas_top).offset(-padding); | ||
55 | - constrain.right.equal(superview.mas_right).offset(-padding); | ||
56 | - constrain.width.equal(view1.mas_width); | 51 | + [view2 mas_buildConstraints:^(MASConstraintBuilder *make) { |
52 | + make.top.equalTo(superview.mas_top).offset(padding); | ||
53 | + make.left.equalTo(view1.mas_right).offset(padding); | ||
54 | + make.bottom.equalTo(view3.mas_top).offset(-padding); | ||
55 | + make.right.equalTo(superview.mas_right).offset(-padding); | ||
56 | + make.width.equalTo(view1.mas_width); | ||
57 | 57 | ||
58 | //or define it multiple times | 58 | //or define it multiple times |
59 | - constrain.height.equal(view1.mas_height); | ||
60 | - constrain.height.equal(view3.mas_height); | 59 | + make.height.equalTo(view1.mas_height); |
60 | + make.height.equalTo(view3.mas_height); | ||
61 | }]; | 61 | }]; |
62 | 62 | ||
63 | - [view3 mas_buildConstraints:^(MASConstraintBuilder *constrain) { | ||
64 | - constrain.top.equal(view1.mas_bottom).offset(padding); | ||
65 | - constrain.left.equal(superview.mas_left).offset(padding); | ||
66 | - constrain.bottom.equal(superview.mas_bottom).offset(-padding); | ||
67 | - constrain.right.equal(superview.mas_right).offset(-padding); | 63 | + [view3 mas_buildConstraints:^(MASConstraintBuilder *make) { |
64 | + make.top.equalTo(view1.mas_bottom).offset(padding); | ||
65 | + make.left.equalTo(superview.mas_left).offset(padding); | ||
66 | + make.bottom.equalTo(superview.mas_bottom).offset(-padding); | ||
67 | + make.right.equalTo(superview.mas_right).offset(-padding); | ||
68 | 68 | ||
69 | //TODO or pass an array | 69 | //TODO or pass an array |
70 | //constraints.height.equal(superview.subviews); | 70 | //constraints.height.equal(superview.subviews); |
71 | - constrain.height.equal(view1.mas_height); | ||
72 | - constrain.height.equal(view2.mas_height); | 71 | + make.height.equalTo(view1.mas_height); |
72 | + make.height.equalTo(view2.mas_height); | ||
73 | }]; | 73 | }]; |
74 | 74 | ||
75 | return self; | 75 | return self; |
@@ -28,18 +28,18 @@ | @@ -28,18 +28,18 @@ | ||
28 | 28 | ||
29 | //example of using constants | 29 | //example of using constants |
30 | 30 | ||
31 | - [view1 mas_buildConstraints:^(MASConstraintBuilder *constrain) { | ||
32 | - constrain.top.equal(@20); | ||
33 | - constrain.left.equal(@20); | ||
34 | - constrain.bottom.equal(@-20); | ||
35 | - constrain.right.equal(@-20); | 31 | + [view1 mas_buildConstraints:^(MASConstraintBuilder *make) { |
32 | + make.top.equalTo(@20); | ||
33 | + make.left.equalTo(@20); | ||
34 | + make.bottom.equalTo(@-20); | ||
35 | + make.right.equalTo(@-20); | ||
36 | }]; | 36 | }]; |
37 | 37 | ||
38 | - [view2 mas_buildConstraints:^(MASConstraintBuilder *constrain) { | ||
39 | - constrain.centerY.equal(@50); | ||
40 | - constrain.centerX.equal(@0); | ||
41 | - constrain.width.equal(@200); | ||
42 | - constrain.height.equal(@100); | 38 | + [view2 mas_buildConstraints:^(MASConstraintBuilder *make) { |
39 | + make.centerY.equalTo(@50); | ||
40 | + make.centerX.equalTo(@0); | ||
41 | + make.width.equalTo(@200); | ||
42 | + make.height.equalTo(@100); | ||
43 | }]; | 43 | }]; |
44 | 44 | ||
45 | return self; | 45 | return self; |
@@ -22,8 +22,8 @@ | @@ -22,8 +22,8 @@ | ||
22 | view.layer.borderWidth = 2; | 22 | view.layer.borderWidth = 2; |
23 | [self addSubview:view]; | 23 | [self addSubview:view]; |
24 | 24 | ||
25 | - [view mas_buildConstraints:^(MASConstraintBuilder *constrain) { | ||
26 | - constrain.edges.equal(lastView).insets(UIEdgeInsetsMake(5, 10, 15, 20)); | 25 | + [view mas_buildConstraints:^(MASConstraintBuilder *make) { |
26 | + make.edges.equalTo(lastView).insets(UIEdgeInsetsMake(5, 10, 15, 20)); | ||
27 | }]; | 27 | }]; |
28 | 28 | ||
29 | lastView = view; | 29 | lastView = view; |
@@ -45,17 +45,17 @@ beforeEach(^{ | @@ -45,17 +45,17 @@ beforeEach(^{ | ||
45 | describe(@"equality chaining", ^{ | 45 | describe(@"equality chaining", ^{ |
46 | 46 | ||
47 | it(@"should return same constraint when encountering equal for first time", ^{ | 47 | it(@"should return same constraint when encountering equal for first time", ^{ |
48 | - MASViewConstraint *newConstraint = constraint.equal(secondViewAttribute); | 48 | + MASViewConstraint *newConstraint = constraint.equalTo(secondViewAttribute); |
49 | 49 | ||
50 | [verify(delegate) addConstraint:(id)constraint]; | 50 | [verify(delegate) addConstraint:(id)constraint]; |
51 | expect(newConstraint).to.beIdenticalTo(constraint); | 51 | expect(newConstraint).to.beIdenticalTo(constraint); |
52 | expect(constraint.secondViewAttribute).to.beIdenticalTo(secondViewAttribute); | 52 | expect(constraint.secondViewAttribute).to.beIdenticalTo(secondViewAttribute); |
53 | - expect(constraint.layoutRelation).to.ex_equal(NSLayoutRelationEqual); | 53 | + expect(constraint.layoutRelation).to.equal(NSLayoutRelationEqual); |
54 | }); | 54 | }); |
55 | 55 | ||
56 | it(@"should start new constraint when encountering equal subsequently", ^{ | 56 | it(@"should start new constraint when encountering equal subsequently", ^{ |
57 | - constraint.greaterThanOrEqual(secondViewAttribute); | ||
58 | - MASViewConstraint *newConstraint = constraint.equal(secondViewAttribute); | 57 | + constraint.greaterThanOrEqualTo(secondViewAttribute); |
58 | + MASViewConstraint *newConstraint = constraint.equalTo(secondViewAttribute); | ||
59 | 59 | ||
60 | [verify(delegate) addConstraint:(id)constraint]; | 60 | [verify(delegate) addConstraint:(id)constraint]; |
61 | [verify(delegate) addConstraint:(id)newConstraint]; | 61 | [verify(delegate) addConstraint:(id)newConstraint]; |
@@ -63,17 +63,17 @@ describe(@"equality chaining", ^{ | @@ -63,17 +63,17 @@ describe(@"equality chaining", ^{ | ||
63 | }); | 63 | }); |
64 | 64 | ||
65 | it(@"should return same constraint when encountering greaterThanOrEqual for first time", ^{ | 65 | it(@"should return same constraint when encountering greaterThanOrEqual for first time", ^{ |
66 | - MASViewConstraint *newConstraint = constraint.greaterThanOrEqual(secondViewAttribute); | 66 | + MASViewConstraint *newConstraint = constraint.greaterThanOrEqualTo(secondViewAttribute); |
67 | 67 | ||
68 | [verify(delegate) addConstraint:(id)constraint]; | 68 | [verify(delegate) addConstraint:(id)constraint]; |
69 | expect(newConstraint).to.beIdenticalTo(constraint); | 69 | expect(newConstraint).to.beIdenticalTo(constraint); |
70 | expect(constraint.secondViewAttribute).to.beIdenticalTo(secondViewAttribute); | 70 | expect(constraint.secondViewAttribute).to.beIdenticalTo(secondViewAttribute); |
71 | - expect(constraint.layoutRelation).to.ex_equal(NSLayoutRelationGreaterThanOrEqual); | 71 | + expect(constraint.layoutRelation).to.equal(NSLayoutRelationGreaterThanOrEqual); |
72 | }); | 72 | }); |
73 | 73 | ||
74 | it(@"should start new constraint when encountering greaterThanOrEqual subsequently", ^{ | 74 | it(@"should start new constraint when encountering greaterThanOrEqual subsequently", ^{ |
75 | - constraint.lessThanOrEqual(secondViewAttribute); | ||
76 | - MASViewConstraint *newConstraint = constraint.greaterThanOrEqual(secondViewAttribute); | 75 | + constraint.lessThanOrEqualTo(secondViewAttribute); |
76 | + MASViewConstraint *newConstraint = constraint.greaterThanOrEqualTo(secondViewAttribute); | ||
77 | 77 | ||
78 | [verify(delegate) addConstraint:(id)constraint]; | 78 | [verify(delegate) addConstraint:(id)constraint]; |
79 | [verify(delegate) addConstraint:(id)newConstraint]; | 79 | [verify(delegate) addConstraint:(id)newConstraint]; |
@@ -81,17 +81,17 @@ describe(@"equality chaining", ^{ | @@ -81,17 +81,17 @@ describe(@"equality chaining", ^{ | ||
81 | }); | 81 | }); |
82 | 82 | ||
83 | it(@"should return same constraint when encountering lessThanOrEqual for first time", ^{ | 83 | it(@"should return same constraint when encountering lessThanOrEqual for first time", ^{ |
84 | - MASViewConstraint *newConstraint = constraint.lessThanOrEqual(secondViewAttribute); | 84 | + MASViewConstraint *newConstraint = constraint.lessThanOrEqualTo(secondViewAttribute); |
85 | 85 | ||
86 | [verify(delegate) addConstraint:(id)constraint]; | 86 | [verify(delegate) addConstraint:(id)constraint]; |
87 | expect(newConstraint).to.beIdenticalTo(constraint); | 87 | expect(newConstraint).to.beIdenticalTo(constraint); |
88 | expect(constraint.secondViewAttribute).to.beIdenticalTo(secondViewAttribute); | 88 | expect(constraint.secondViewAttribute).to.beIdenticalTo(secondViewAttribute); |
89 | - expect(constraint.layoutRelation).to.ex_equal(NSLayoutRelationLessThanOrEqual); | 89 | + expect(constraint.layoutRelation).to.equal(NSLayoutRelationLessThanOrEqual); |
90 | }); | 90 | }); |
91 | 91 | ||
92 | it(@"should start new constraint when encountering lessThanOrEqual subsequently", ^{ | 92 | it(@"should start new constraint when encountering lessThanOrEqual subsequently", ^{ |
93 | - constraint.equal(secondViewAttribute); | ||
94 | - MASViewConstraint *newConstraint = constraint.lessThanOrEqual(secondViewAttribute); | 93 | + constraint.equalTo(secondViewAttribute); |
94 | + MASViewConstraint *newConstraint = constraint.lessThanOrEqualTo(secondViewAttribute); | ||
95 | 95 | ||
96 | [verify(delegate) addConstraint:(id)constraint]; | 96 | [verify(delegate) addConstraint:(id)constraint]; |
97 | [verify(delegate) addConstraint:(id)newConstraint]; | 97 | [verify(delegate) addConstraint:(id)newConstraint]; |
@@ -102,7 +102,7 @@ describe(@"equality chaining", ^{ | @@ -102,7 +102,7 @@ describe(@"equality chaining", ^{ | ||
102 | [constraint commit]; | 102 | [constraint commit]; |
103 | 103 | ||
104 | expect(^{ | 104 | expect(^{ |
105 | - constraint.equal(secondViewAttribute); | 105 | + constraint.equalTo(secondViewAttribute); |
106 | }).to.raise(@"NSInternalInconsistencyException"); | 106 | }).to.raise(@"NSInternalInconsistencyException"); |
107 | }); | 107 | }); |
108 | 108 | ||
@@ -110,7 +110,7 @@ describe(@"equality chaining", ^{ | @@ -110,7 +110,7 @@ describe(@"equality chaining", ^{ | ||
110 | [constraint commit]; | 110 | [constraint commit]; |
111 | 111 | ||
112 | expect(^{ | 112 | expect(^{ |
113 | - constraint.lessThanOrEqual(secondViewAttribute); | 113 | + constraint.lessThanOrEqualTo(secondViewAttribute); |
114 | }).to.raise(@"NSInternalInconsistencyException"); | 114 | }).to.raise(@"NSInternalInconsistencyException"); |
115 | }); | 115 | }); |
116 | 116 | ||
@@ -118,7 +118,7 @@ describe(@"equality chaining", ^{ | @@ -118,7 +118,7 @@ describe(@"equality chaining", ^{ | ||
118 | [constraint commit]; | 118 | [constraint commit]; |
119 | 119 | ||
120 | expect(^{ | 120 | expect(^{ |
121 | - constraint.greaterThanOrEqual(secondViewAttribute); | 121 | + constraint.greaterThanOrEqualTo(secondViewAttribute); |
122 | }).to.raise(@"NSInternalInconsistencyException"); | 122 | }).to.raise(@"NSInternalInconsistencyException"); |
123 | }); | 123 | }); |
124 | 124 | ||
@@ -141,8 +141,8 @@ describe(@"multiplier & constant", ^{ | @@ -141,8 +141,8 @@ describe(@"multiplier & constant", ^{ | ||
141 | [constraint commit]; | 141 | [constraint commit]; |
142 | constraint.offset(10); | 142 | constraint.offset(10); |
143 | 143 | ||
144 | - expect(constraint.layoutConstant).to.ex_equal(10); | ||
145 | - expect(constraint.layoutConstraint.constant).to.ex_equal(10); | 144 | + expect(constraint.layoutConstant).to.equal(10); |
145 | + expect(constraint.layoutConstraint.constant).to.equal(10); | ||
146 | }); | 146 | }); |
147 | 147 | ||
148 | xit(@"should update sides only", ^{}); | 148 | xit(@"should update sides only", ^{}); |
@@ -155,20 +155,20 @@ describe(@"multiplier & constant", ^{ | @@ -155,20 +155,20 @@ describe(@"multiplier & constant", ^{ | ||
155 | describe(@"commit", ^{ | 155 | describe(@"commit", ^{ |
156 | 156 | ||
157 | it(@"should create layout constraint", ^{ | 157 | it(@"should create layout constraint", ^{ |
158 | - constraint.equal(secondViewAttribute); | 158 | + constraint.equalTo(secondViewAttribute); |
159 | constraint.percent(0.5); | 159 | constraint.percent(0.5); |
160 | constraint.offset(10); | 160 | constraint.offset(10); |
161 | constraint.priority(345); | 161 | constraint.priority(345); |
162 | [constraint commit]; | 162 | [constraint commit]; |
163 | 163 | ||
164 | - expect(constraint.layoutConstraint.firstAttribute).to.ex_equal(NSLayoutAttributeWidth); | ||
165 | - expect(constraint.layoutConstraint.secondAttribute).to.ex_equal(NSLayoutAttributeHeight); | 164 | + expect(constraint.layoutConstraint.firstAttribute).to.equal(NSLayoutAttributeWidth); |
165 | + expect(constraint.layoutConstraint.secondAttribute).to.equal(NSLayoutAttributeHeight); | ||
166 | expect(constraint.layoutConstraint.firstItem).to.beIdenticalTo(constraint.firstViewAttribute.view); | 166 | expect(constraint.layoutConstraint.firstItem).to.beIdenticalTo(constraint.firstViewAttribute.view); |
167 | expect(constraint.layoutConstraint.secondItem).to.beIdenticalTo(constraint.secondViewAttribute.view); | 167 | expect(constraint.layoutConstraint.secondItem).to.beIdenticalTo(constraint.secondViewAttribute.view); |
168 | - expect(constraint.layoutConstraint.relation).to.ex_equal(NSLayoutRelationEqual); | ||
169 | - expect(constraint.layoutConstraint.constant).to.ex_equal(10); | ||
170 | - expect(constraint.layoutConstraint.priority).to.ex_equal(345); | ||
171 | - expect(constraint.layoutConstraint.multiplier).to.ex_equal(0.5); | 168 | + expect(constraint.layoutConstraint.relation).to.equal(NSLayoutRelationEqual); |
169 | + expect(constraint.layoutConstraint.constant).to.equal(10); | ||
170 | + expect(constraint.layoutConstraint.priority).to.equal(345); | ||
171 | + expect(constraint.layoutConstraint.multiplier).to.equal(0.5); | ||
172 | 172 | ||
173 | [verify(superview) addConstraint:constraint.layoutConstraint]; | 173 | [verify(superview) addConstraint:constraint.layoutConstraint]; |
174 | }); | 174 | }); |
@@ -9,11 +9,6 @@ | @@ -9,11 +9,6 @@ | ||
9 | 9 | ||
10 | #define EXP_SHORTHAND | 10 | #define EXP_SHORTHAND |
11 | #import "Expecta.h" | 11 | #import "Expecta.h" |
12 | - #undef equal | ||
13 | - #define ex_equal(expected) _equal(EXPObjectify((expected))) | ||
14 | - | ||
15 | - #define HC_SHORTHAND | ||
16 | - #import <OCHamcrest/OCHamcrest.h> | ||
17 | 12 | ||
18 | #define MOCKITO_SHORTHAND | 13 | #define MOCKITO_SHORTHAND |
19 | #import <OCMockito/OCMockito.h> | 14 | #import <OCMockito/OCMockito.h> |
-
Please register or login to post a comment