Authored by Monte Hurd

Added support and tests for leading and trailing insets.

@@ -235,6 +235,7 @@ static char kInstalledConstraintsKey; @@ -235,6 +235,7 @@ static char kInstalledConstraintsKey;
235 NSLayoutAttribute layoutAttribute = self.firstViewAttribute.layoutAttribute; 235 NSLayoutAttribute layoutAttribute = self.firstViewAttribute.layoutAttribute;
236 switch (layoutAttribute) { 236 switch (layoutAttribute) {
237 case NSLayoutAttributeLeft: 237 case NSLayoutAttributeLeft:
  238 + case NSLayoutAttributeLeading:
238 self.layoutConstant = insets.left; 239 self.layoutConstant = insets.left;
239 break; 240 break;
240 case NSLayoutAttributeTop: 241 case NSLayoutAttributeTop:
@@ -244,6 +245,7 @@ static char kInstalledConstraintsKey; @@ -244,6 +245,7 @@ static char kInstalledConstraintsKey;
244 self.layoutConstant = -insets.bottom; 245 self.layoutConstant = -insets.bottom;
245 break; 246 break;
246 case NSLayoutAttributeRight: 247 case NSLayoutAttributeRight:
  248 + case NSLayoutAttributeTrailing:
247 self.layoutConstant = -insets.right; 249 self.layoutConstant = -insets.right;
248 break; 250 break;
249 default: 251 default:
@@ -168,6 +168,10 @@ SpecBegin(MASViewConstraint) { @@ -168,6 +168,10 @@ SpecBegin(MASViewConstraint) {
168 left.equalTo(value); 168 left.equalTo(value);
169 expect(left.layoutConstant).to.equal(20); 169 expect(left.layoutConstant).to.equal(20);
170 170
  171 + MASViewConstraint *leading = [[MASViewConstraint alloc] initWithFirstViewAttribute:otherView.mas_leading];
  172 + leading.equalTo(value);
  173 + expect(leading.layoutConstant).to.equal(20);
  174 +
171 MASViewConstraint *bottom = [[MASViewConstraint alloc] initWithFirstViewAttribute:otherView.mas_bottom]; 175 MASViewConstraint *bottom = [[MASViewConstraint alloc] initWithFirstViewAttribute:otherView.mas_bottom];
172 bottom.equalTo(value); 176 bottom.equalTo(value);
173 expect(bottom.layoutConstant).to.equal(-30); 177 expect(bottom.layoutConstant).to.equal(-30);
@@ -175,6 +179,10 @@ SpecBegin(MASViewConstraint) { @@ -175,6 +179,10 @@ SpecBegin(MASViewConstraint) {
175 MASViewConstraint *right = [[MASViewConstraint alloc] initWithFirstViewAttribute:otherView.mas_right]; 179 MASViewConstraint *right = [[MASViewConstraint alloc] initWithFirstViewAttribute:otherView.mas_right];
176 right.equalTo(value); 180 right.equalTo(value);
177 expect(right.layoutConstant).to.equal(-40); 181 expect(right.layoutConstant).to.equal(-40);
  182 +
  183 + MASViewConstraint *trailing = [[MASViewConstraint alloc] initWithFirstViewAttribute:otherView.mas_trailing];
  184 + trailing.equalTo(value);
  185 + expect(trailing.layoutConstant).to.equal(-40);
178 186
179 MASViewConstraint *centerX = [[MASViewConstraint alloc] initWithFirstViewAttribute:otherView.mas_centerX]; 187 MASViewConstraint *centerX = [[MASViewConstraint alloc] initWithFirstViewAttribute:otherView.mas_centerX];
180 centerX.equalTo(value); 188 centerX.equalTo(value);