|
|
@@ -441,6 +441,28 @@ class SnapKitTests: XCTestCase {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ func testEdgesToEdges() {
|
|
|
+ var fromAttributes = Set<NSLayoutAttribute>()
|
|
|
+ var toAttributes = Set<NSLayoutAttribute>()
|
|
|
+
|
|
|
+ let view = View()
|
|
|
+ self.container.addSubview(view)
|
|
|
+
|
|
|
+ view.snp.remakeConstraints { (make) -> Void in
|
|
|
+ make.edges.equalTo(self.container.snp.edges)
|
|
|
+ }
|
|
|
+
|
|
|
+ XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints")
|
|
|
+
|
|
|
+ for constraint in (container.snp_constraints as! [NSLayoutConstraint]) {
|
|
|
+ fromAttributes.insert(constraint.firstAttribute)
|
|
|
+ toAttributes.insert(constraint.secondAttribute)
|
|
|
+ }
|
|
|
+
|
|
|
+ XCTAssert(fromAttributes == [.top, .left, .bottom, .right])
|
|
|
+ XCTAssert(toAttributes == [.top, .left, .bottom, .right])
|
|
|
+ }
|
|
|
+
|
|
|
func testLayoutGuideConstraints() {
|
|
|
let vc = UIViewController()
|
|
|
vc.view = UIView(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
|