Skip to content

Commit 1c23eae

Browse files
author
Luko Gjenero
committed
Updated the tests as well
1 parent 1ef097b commit 1c23eae

15 files changed

+114
-114
lines changed

CartographyTests/AlignSpec.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AlignSpec: QuickSpec {
2222
viewC = TestView(frame: CGRect.zero)
2323
window.addSubview(viewC)
2424

25-
constrain(viewA) { view in
25+
cg_constrain(viewA) { view in
2626
view.height == 200
2727
view.width == 200
2828

@@ -33,7 +33,7 @@ class AlignSpec: QuickSpec {
3333

3434
describe("for edges") {
3535
beforeEach {
36-
constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
36+
cg_constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
3737
align(top: viewA, viewB, viewC)
3838
align(right: viewA, viewB, viewC)
3939
align(bottom: viewA, viewB, viewC)
@@ -55,7 +55,7 @@ class AlignSpec: QuickSpec {
5555

5656
describe("for horizontal and vertical centers") {
5757
beforeEach {
58-
constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
58+
cg_constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
5959
viewA.size == viewB.size
6060
viewB.size == viewC.size
6161

@@ -78,7 +78,7 @@ class AlignSpec: QuickSpec {
7878

7979
describe("no constraints") {
8080
it("should have no constraints for a single view alignment") {
81-
constrain(viewA) { viewA in
81+
cg_constrain(viewA) { viewA in
8282
let constraints = align(top: [viewA])
8383

8484
expect(constraints.count).to(equal(0))

CartographyTests/ConstraintGroupSpec.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ class ConstraintGroupSpec: QuickSpec {
2020
var b: ConstraintGroup!
2121

2222
beforeEach {
23-
a = constrain(view1) { view in
23+
a = cg_constrain(view1) { view in
2424
view.width == 100
2525
view.height == 100
2626
}
2727

2828
a.active = false
2929

30-
b = constrain(view1) { view in
30+
b = cg_constrain(view1) { view in
3131
view.width == 200
3232
view.height == 200
3333
}
@@ -60,7 +60,7 @@ class ConstraintGroupSpec: QuickSpec {
6060
view2 = TestView(frame: CGRect.zero)
6161
window.addSubview(view2)
6262

63-
constrain(view1, view2) { view1, view2 in
63+
cg_constrain(view1, view2) { view1, view2 in
6464
view1.top == view1.superview!.top + 10
6565
view1.left == view1.superview!.left + 10
6666
view1.right == view1.superview!.right - 10
@@ -75,15 +75,15 @@ class ConstraintGroupSpec: QuickSpec {
7575
}
7676

7777
it("should update the view") {
78-
let group = constrain(view2) { view2 in
78+
let group = cg_constrain(view2) { view2 in
7979
view2.height == 100
8080
}
8181

8282
window.layoutIfNeeded()
8383

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

86-
constrain(view2, replace: group) { view2 in
86+
cg_constrain(view2, replace: group) { view2 in
8787
view2.bottom >= view2.superview!.bottom
8888
}
8989

CartographyTests/DimensionSpec.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class DimensionSpec: QuickSpec {
1717

1818
describe("LayoutProxy.width") {
1919
it("should support relative equalities") {
20-
constrain(view) { view in
20+
cg_constrain(view) { view in
2121
view.width == view.superview!.width
2222
}
2323

@@ -27,7 +27,7 @@ class DimensionSpec: QuickSpec {
2727
}
2828

2929
it("should support relative inequalities") {
30-
constrain(view) { view in
30+
cg_constrain(view) { view in
3131
view.width <= view.superview!.width
3232
view.width >= view.superview!.width
3333
}
@@ -38,7 +38,7 @@ class DimensionSpec: QuickSpec {
3838
}
3939

4040
it("should support addition") {
41-
constrain(view) { view in
41+
cg_constrain(view) { view in
4242
view.width == view.superview!.width + 100
4343
}
4444

@@ -48,7 +48,7 @@ class DimensionSpec: QuickSpec {
4848
}
4949

5050
it("should support subtraction") {
51-
constrain(view) { view in
51+
cg_constrain(view) { view in
5252
view.width == view.superview!.width - 100
5353
}
5454

@@ -58,7 +58,7 @@ class DimensionSpec: QuickSpec {
5858
}
5959

6060
it("should support multiplication") {
61-
constrain(view) { view in
61+
cg_constrain(view) { view in
6262
view.width == view.superview!.width * 2
6363
}
6464

@@ -68,7 +68,7 @@ class DimensionSpec: QuickSpec {
6868
}
6969

7070
it("should support division") {
71-
constrain(view) { view in
71+
cg_constrain(view) { view in
7272
view.width == view.superview!.width / 2
7373
}
7474

@@ -78,7 +78,7 @@ class DimensionSpec: QuickSpec {
7878
}
7979

8080
it("should support complex expressions") {
81-
constrain(view) { view in
81+
cg_constrain(view) { view in
8282
view.width == view.superview!.width / 2 + 100
8383
}
8484

@@ -88,7 +88,7 @@ class DimensionSpec: QuickSpec {
8888
}
8989

9090
it("should support numerical equalities") {
91-
constrain(view) { view in
91+
cg_constrain(view) { view in
9292
view.width == 200
9393
}
9494

@@ -100,7 +100,7 @@ class DimensionSpec: QuickSpec {
100100

101101
describe("LayoutProxy.height") {
102102
it("should support relative equalities") {
103-
constrain(view) { view in
103+
cg_constrain(view) { view in
104104
view.height == view.superview!.height
105105
}
106106

@@ -110,7 +110,7 @@ class DimensionSpec: QuickSpec {
110110
}
111111

112112
it("should support relative inequalities") {
113-
constrain(view) { view in
113+
cg_constrain(view) { view in
114114
view.height <= view.superview!.height
115115
view.height >= view.superview!.height
116116
}
@@ -121,7 +121,7 @@ class DimensionSpec: QuickSpec {
121121
}
122122

123123
it("should support addition") {
124-
constrain(view) { view in
124+
cg_constrain(view) { view in
125125
view.height == view.superview!.height + 100
126126
}
127127

@@ -131,7 +131,7 @@ class DimensionSpec: QuickSpec {
131131
}
132132

133133
it("should support subtraction") {
134-
constrain(view) { view in
134+
cg_constrain(view) { view in
135135
view.height == view.superview!.height - 100
136136
}
137137

@@ -141,7 +141,7 @@ class DimensionSpec: QuickSpec {
141141
}
142142

143143
it("should support multiplication") {
144-
constrain(view) { view in
144+
cg_constrain(view) { view in
145145
view.height == view.superview!.height * 2
146146
}
147147

@@ -151,7 +151,7 @@ class DimensionSpec: QuickSpec {
151151
}
152152

153153
it("should support division") {
154-
constrain(view) { view in
154+
cg_constrain(view) { view in
155155
view.height == view.superview!.height / 2
156156
}
157157

@@ -161,7 +161,7 @@ class DimensionSpec: QuickSpec {
161161
}
162162

163163
it("should support complex expressions") {
164-
constrain(view) { view in
164+
cg_constrain(view) { view in
165165
view.height == view.superview!.height / 2 + 100
166166
}
167167

@@ -171,7 +171,7 @@ class DimensionSpec: QuickSpec {
171171
}
172172

173173
it("should support numerical equalities") {
174-
constrain(view) { view in
174+
cg_constrain(view) { view in
175175
view.height == 200
176176
}
177177

CartographyTests/DistributeSpec.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class DistributeSpec: QuickSpec {
2424
viewC = TestView(frame: CGRect.zero)
2525
window.addSubview(viewC)
2626

27-
constrain(viewA, viewB, viewC, replace: constraintsGroup) { viewA, viewB, viewC in
27+
cg_constrain(viewA, viewB, viewC, replace: constraintsGroup) { viewA, viewB, viewC in
2828
viewA.width == 100
2929
viewA.height == 100
3030

@@ -38,7 +38,7 @@ class DistributeSpec: QuickSpec {
3838

3939
describe("from left to right") {
4040
beforeEach {
41-
constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
41+
cg_constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
4242
align(centerY: viewA, viewB, viewC)
4343
distribute(by: 10, leftToRight: viewA, viewB, viewC)
4444
}
@@ -61,7 +61,7 @@ class DistributeSpec: QuickSpec {
6161

6262
describe("vertically") {
6363
beforeEach {
64-
constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
64+
cg_constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
6565
align(centerX: viewA, viewB, viewC)
6666
distribute(by: 10, vertically: viewA, viewB, viewC)
6767
}
@@ -84,7 +84,7 @@ class DistributeSpec: QuickSpec {
8484

8585
describe("no constraints") {
8686
it("should have no constraints for a single view distribution") {
87-
constrain(viewA) { viewA in
87+
cg_constrain(viewA) { viewA in
8888
let constraints = distribute(horizontally: [viewA])
8989

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

100100
describe("When distributing width") {
101101
beforeEach {
102-
constrain(viewA, viewB, viewC, replace: constraintsGroup) {
102+
cg_constrain(viewA, viewB, viewC, replace: constraintsGroup) {
103103
viewA, viewB, viewC in
104104

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

120120
describe("When distributing height") {
121121
beforeEach {
122-
constrain(viewA, viewB, viewC, replace: constraintsGroup) {
122+
cg_constrain(viewA, viewB, viewC, replace: constraintsGroup) {
123123
viewA, viewB, viewC in
124124

125125
viewA.height == 50

0 commit comments

Comments
 (0)