             orientation: .vertical,
             gutter: spacing)
 
+        let maxHeight = max(
+            l1.sideLength + l1.verticalMargins,
+            l2.sideLength + l2.verticalMargins,
+            l3.sideLength + l3.verticalMargins)
+        let maxWidth = max(
+            l1.sideLength + l1.horizontalMargins,
+            l2.sideLength + l2.horizontalMargins,
+            l3.sideLength + l3.horizontalMargins)
+        
         let targetSize = CGSize(
-            width: l3.sideLength + l3.horizontalMargins,
-            height: (l3.sideLength + l3.verticalMargins) * 3
-                + spacing * 2)  // largest element
+            width: maxWidth,
+            height: maxHeight * 3 + spacing * 2)
         let size1 = layout.sizeThatFits(CGSize(width: 400, height: 300))
         let size2 = layout.sizeThatFits(CGSize(width: 10, height: 30))
 

        layout.startLayout(with: layoutRectTooSmall)
        let availableSideLength = (layoutRectTooSmall.width - spacing * 2) / 3 // Rect now dictates the size
        
        XCTAssertEqual(l1.frame, CGRect(
            x: layoutRectTooSmall.origin.x + l1.layoutMargins.left,
            y: layoutRectTooSmall.origin.y + l1.layoutMargins.top,
            width: l1.sideLength,
            height: l1.sideLength))
        XCTAssertEqual(l2.frame, CGRect(
            x: layoutRectTooSmall.origin.x
                + availableSideLength
                + spacing
                + l2.layoutMargins.left,
            y: layoutRectTooSmall.origin.y + l2.layoutMargins.top,
            width: l2.sideLength,
            height: l2.sideLength))
        XCTAssertEqual(l3.frame,CGRect(
            x: layoutRectTooSmall.origin.x
                + availableSideLength * 2
                + spacing * 2
                + l3.layoutMargins.left,
            y: layoutRectTooSmall.origin.y + l3.layoutMargins.top,
            width: l3.sideLength,
            height: l3.sideLength))
    }

    func testVertical() {

            orientation: .horizontal,
            gutter: spacing)

        let maxHeight = max(
            l1.sideLength + l1.verticalMargins,
            l2.sideLength + l2.verticalMargins,
            l3.sideLength + l3.verticalMargins)
        let maxWidth = max(
            l1.sideLength + l1.horizontalMargins,
            l2.sideLength + l2.horizontalMargins,
            l3.sideLength + l3.horizontalMargins)

        let targetSize = CGSize(
            width: maxWidth * 3 + spacing * 2,
            height: maxHeight)
        let size1 = layout.sizeThatFits(CGSize(width: 400, height: 300))
        let size2 = layout.sizeThatFits(CGSize(width: 200, height: 30))

