Skip to content

Commit 114c2eb

Browse files
author
Luc Dion
committed
Add more unit tests
1 parent 6f14abe commit 114c2eb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Tests/MinMaxWidthHeightSpec.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ class MinMaxWidthHeightSpec: QuickSpec {
7575
aView.pin.left().minWidth(50)
7676
expect(aView.frame).to(equal(CGRect(x: 0.0, y: 100.0, width: 50.0, height: 60.0)))
7777
}
78+
79+
it("should adjust the width of aView") {
80+
aView.frame = CGRect(x: 40, y: 100, width: 25, height: 60)
81+
aView.pin.left().minWidth(25%)
82+
expect(aView.frame).to(equal(CGRect(x: 0.0, y: 100.0, width: 100.0, height: 60.0)))
83+
}
7884

7985
it("should adjust the width of aView") {
8086
aView.pin.left().width(100).minWidth(150) // width < minWidth
@@ -143,6 +149,13 @@ class MinMaxWidthHeightSpec: QuickSpec {
143149
aView.pin.left().maxWidth(150)
144150
expect(aView.frame).to(equal(CGRect(x: 0.0, y: 100.0, width: 150.0, height: 60.0)))
145151
}
152+
153+
it("should adjust the width of aView") {
154+
aView.frame = CGRect(x: 40, y: 100, width: 200, height: 60)
155+
156+
aView.pin.left().maxWidth(25%)
157+
expect(aView.frame).to(equal(CGRect(x: 0.0, y: 100.0, width: 100.0, height: 60.0)))
158+
}
146159

147160
it("should adjust the width of aView") {
148161
aView.pin.left().maxWidth(150).marginLeft(50)
@@ -325,6 +338,13 @@ class MinMaxWidthHeightSpec: QuickSpec {
325338
expect(aView.frame).to(equal(CGRect(x: 40.0, y: 0.0, width: 25.0, height: 50.0)))
326339
}
327340

341+
it("should adjust the height of aView") {
342+
aView.frame = CGRect(x: 40, y: 100, width: 25, height: 30)
343+
344+
aView.pin.top().minHeight(25%)
345+
expect(aView.frame).to(equal(CGRect(x: 40.0, y: 0.0, width: 25.0, height: 100.0)))
346+
}
347+
328348
it("should adjust the height of aView") {
329349
aView.pin.top().height(100).minHeight(150) // height < minHeight
330350
expect(aView.frame).to(equal(CGRect(x: 40.0, y: 0.0, width: 100.0, height: 150.0)))
@@ -392,6 +412,13 @@ class MinMaxWidthHeightSpec: QuickSpec {
392412
aView.pin.top().maxHeight(150)
393413
expect(aView.frame).to(equal(CGRect(x: 40.0, y: 0.0, width: 100.0, height: 150.0)))
394414
}
415+
416+
it("should adjust the height of aView") {
417+
aView.frame = CGRect(x: 40, y: 100, width: 100, height: 200)
418+
419+
aView.pin.top().maxHeight(25%)
420+
expect(aView.frame).to(equal(CGRect(x: 40.0, y: 0.0, width: 100.0, height: 100.0)))
421+
}
395422

396423
it("should adjust the height of aView") {
397424
aView.pin.top().maxHeight(150).marginTop(50)

0 commit comments

Comments
 (0)