Skip to content

Commit

Permalink
Updated the tests as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Luko Gjenero committed Oct 8, 2019
1 parent 1ef097b commit 1c23eae
Show file tree
Hide file tree
Showing 15 changed files with 114 additions and 114 deletions.
8 changes: 4 additions & 4 deletions CartographyTests/AlignSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AlignSpec: QuickSpec {
viewC = TestView(frame: CGRect.zero)
window.addSubview(viewC)

constrain(viewA) { view in
cg_constrain(viewA) { view in
view.height == 200
view.width == 200

Expand All @@ -33,7 +33,7 @@ class AlignSpec: QuickSpec {

describe("for edges") {
beforeEach {
constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
cg_constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
align(top: viewA, viewB, viewC)
align(right: viewA, viewB, viewC)
align(bottom: viewA, viewB, viewC)
Expand All @@ -55,7 +55,7 @@ class AlignSpec: QuickSpec {

describe("for horizontal and vertical centers") {
beforeEach {
constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
cg_constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
viewA.size == viewB.size
viewB.size == viewC.size

Expand All @@ -78,7 +78,7 @@ class AlignSpec: QuickSpec {

describe("no constraints") {
it("should have no constraints for a single view alignment") {
constrain(viewA) { viewA in
cg_constrain(viewA) { viewA in
let constraints = align(top: [viewA])

expect(constraints.count).to(equal(0))
Expand Down
10 changes: 5 additions & 5 deletions CartographyTests/ConstraintGroupSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ class ConstraintGroupSpec: QuickSpec {
var b: ConstraintGroup!

beforeEach {
a = constrain(view1) { view in
a = cg_constrain(view1) { view in
view.width == 100
view.height == 100
}

a.active = false

b = constrain(view1) { view in
b = cg_constrain(view1) { view in
view.width == 200
view.height == 200
}
Expand Down Expand Up @@ -60,7 +60,7 @@ class ConstraintGroupSpec: QuickSpec {
view2 = TestView(frame: CGRect.zero)
window.addSubview(view2)

constrain(view1, view2) { view1, view2 in
cg_constrain(view1, view2) { view1, view2 in
view1.top == view1.superview!.top + 10
view1.left == view1.superview!.left + 10
view1.right == view1.superview!.right - 10
Expand All @@ -75,15 +75,15 @@ class ConstraintGroupSpec: QuickSpec {
}

it("should update the view") {
let group = constrain(view2) { view2 in
let group = cg_constrain(view2) { view2 in
view2.height == 100
}

window.layoutIfNeeded()

expect(view2.frame.height).to(equal(100))

constrain(view2, replace: group) { view2 in
cg_constrain(view2, replace: group) { view2 in
view2.bottom >= view2.superview!.bottom
}

Expand Down
32 changes: 16 additions & 16 deletions CartographyTests/DimensionSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DimensionSpec: QuickSpec {

describe("LayoutProxy.width") {
it("should support relative equalities") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == view.superview!.width
}

Expand All @@ -27,7 +27,7 @@ class DimensionSpec: QuickSpec {
}

it("should support relative inequalities") {
constrain(view) { view in
cg_constrain(view) { view in
view.width <= view.superview!.width
view.width >= view.superview!.width
}
Expand All @@ -38,7 +38,7 @@ class DimensionSpec: QuickSpec {
}

it("should support addition") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == view.superview!.width + 100
}

Expand All @@ -48,7 +48,7 @@ class DimensionSpec: QuickSpec {
}

it("should support subtraction") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == view.superview!.width - 100
}

Expand All @@ -58,7 +58,7 @@ class DimensionSpec: QuickSpec {
}

it("should support multiplication") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == view.superview!.width * 2
}

Expand All @@ -68,7 +68,7 @@ class DimensionSpec: QuickSpec {
}

it("should support division") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == view.superview!.width / 2
}

Expand All @@ -78,7 +78,7 @@ class DimensionSpec: QuickSpec {
}

it("should support complex expressions") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == view.superview!.width / 2 + 100
}

Expand All @@ -88,7 +88,7 @@ class DimensionSpec: QuickSpec {
}

it("should support numerical equalities") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == 200
}

Expand All @@ -100,7 +100,7 @@ class DimensionSpec: QuickSpec {

describe("LayoutProxy.height") {
it("should support relative equalities") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == view.superview!.height
}

Expand All @@ -110,7 +110,7 @@ class DimensionSpec: QuickSpec {
}

it("should support relative inequalities") {
constrain(view) { view in
cg_constrain(view) { view in
view.height <= view.superview!.height
view.height >= view.superview!.height
}
Expand All @@ -121,7 +121,7 @@ class DimensionSpec: QuickSpec {
}

it("should support addition") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == view.superview!.height + 100
}

Expand All @@ -131,7 +131,7 @@ class DimensionSpec: QuickSpec {
}

it("should support subtraction") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == view.superview!.height - 100
}

Expand All @@ -141,7 +141,7 @@ class DimensionSpec: QuickSpec {
}

it("should support multiplication") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == view.superview!.height * 2
}

Expand All @@ -151,7 +151,7 @@ class DimensionSpec: QuickSpec {
}

it("should support division") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == view.superview!.height / 2
}

Expand All @@ -161,7 +161,7 @@ class DimensionSpec: QuickSpec {
}

it("should support complex expressions") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == view.superview!.height / 2 + 100
}

Expand All @@ -171,7 +171,7 @@ class DimensionSpec: QuickSpec {
}

it("should support numerical equalities") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == 200
}

Expand Down
12 changes: 6 additions & 6 deletions CartographyTests/DistributeSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DistributeSpec: QuickSpec {
viewC = TestView(frame: CGRect.zero)
window.addSubview(viewC)

constrain(viewA, viewB, viewC, replace: constraintsGroup) { viewA, viewB, viewC in
cg_constrain(viewA, viewB, viewC, replace: constraintsGroup) { viewA, viewB, viewC in
viewA.width == 100
viewA.height == 100

Expand All @@ -38,7 +38,7 @@ class DistributeSpec: QuickSpec {

describe("from left to right") {
beforeEach {
constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
cg_constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
align(centerY: viewA, viewB, viewC)
distribute(by: 10, leftToRight: viewA, viewB, viewC)
}
Expand All @@ -61,7 +61,7 @@ class DistributeSpec: QuickSpec {

describe("vertically") {
beforeEach {
constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
cg_constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
align(centerX: viewA, viewB, viewC)
distribute(by: 10, vertically: viewA, viewB, viewC)
}
Expand All @@ -84,7 +84,7 @@ class DistributeSpec: QuickSpec {

describe("no constraints") {
it("should have no constraints for a single view distribution") {
constrain(viewA) { viewA in
cg_constrain(viewA) { viewA in
let constraints = distribute(horizontally: [viewA])

expect(constraints.count).to(equal(0))
Expand All @@ -99,7 +99,7 @@ class DistributeSpec: QuickSpec {

describe("When distributing width") {
beforeEach {
constrain(viewA, viewB, viewC, replace: constraintsGroup) {
cg_constrain(viewA, viewB, viewC, replace: constraintsGroup) {
viewA, viewB, viewC in

viewA.width == 50
Expand All @@ -119,7 +119,7 @@ class DistributeSpec: QuickSpec {

describe("When distributing height") {
beforeEach {
constrain(viewA, viewB, viewC, replace: constraintsGroup) {
cg_constrain(viewA, viewB, viewC, replace: constraintsGroup) {
viewA, viewB, viewC in

viewA.height == 50
Expand Down
Loading

0 comments on commit 1c23eae

Please sign in to comment.