1212
1313import Quick
1414import Nimble
15+ import FlexLayout
1516
1617class PaddingSpec : QuickSpec {
1718 override func spec( ) {
@@ -41,6 +42,15 @@ class PaddingSpec: QuickSpec {
4142 rootFlexContainer. flex. layout ( )
4243 expect ( aView. frame) . to ( equal ( CGRect ( x: 0.0 , y: 10.0 , width: 400.0 , height: 390.0 ) ) )
4344 }
45+
46+ it ( " adjust the aView size and position " ) {
47+ rootFlexContainer. flex. paddingTop ( 10 % ) . define { ( flex) in
48+ flex. addItem ( aView) . grow ( 1 )
49+ }
50+
51+ rootFlexContainer. flex. layout ( )
52+ expect ( aView. frame) . to ( equal ( CGRect ( x: 0.0 , y: 40.0 , width: 400.0 , height: 360.0 ) ) )
53+ }
4454
4555 it ( " adjust the aView size and position " ) {
4656 rootFlexContainer. flex. paddingLeft ( 10 ) . define { ( flex) in
@@ -49,6 +59,14 @@ class PaddingSpec: QuickSpec {
4959 rootFlexContainer. flex. layout ( )
5060 expect ( aView. frame) . to ( equal ( CGRect ( x: 10.0 , y: 0.0 , width: 390.0 , height: 400.0 ) ) )
5161 }
62+
63+ it ( " adjust the aView size and position " ) {
64+ rootFlexContainer. flex. paddingLeft ( 10 % ) . define { ( flex) in
65+ flex. addItem ( aView) . grow ( 1 )
66+ }
67+ rootFlexContainer. flex. layout ( )
68+ expect ( aView. frame) . to ( equal ( CGRect ( x: 40.0 , y: 0.0 , width: 360.0 , height: 400.0 ) ) )
69+ }
5270
5371 it ( " adjust the aView size and position " ) {
5472 rootFlexContainer. flex. paddingBottom ( 10 ) . define { ( flex) in
@@ -57,6 +75,14 @@ class PaddingSpec: QuickSpec {
5775 rootFlexContainer. flex. layout ( )
5876 expect ( aView. frame) . to ( equal ( CGRect ( x: 0.0 , y: 0.0 , width: 400.0 , height: 390.0 ) ) )
5977 }
78+
79+ it ( " adjust the aView size and position " ) {
80+ rootFlexContainer. flex. paddingBottom ( 10 % ) . define { ( flex) in
81+ flex. addItem ( aView) . grow ( 1 )
82+ }
83+ rootFlexContainer. flex. layout ( )
84+ expect ( aView. frame) . to ( equal ( CGRect ( x: 0.0 , y: 0.0 , width: 400.0 , height: 360.0 ) ) )
85+ }
6086
6187 it ( " adjust the aView size and position " ) {
6288 rootFlexContainer. flex. paddingRight ( 10 ) . define { ( flex) in
@@ -65,6 +91,14 @@ class PaddingSpec: QuickSpec {
6591 rootFlexContainer. flex. layout ( )
6692 expect ( aView. frame) . to ( equal ( CGRect ( x: 0.0 , y: 0.0 , width: 390.0 , height: 400.0 ) ) )
6793 }
94+
95+ it ( " adjust the aView size and position " ) {
96+ rootFlexContainer. flex. paddingRight ( 10 % ) . define { ( flex) in
97+ flex. addItem ( aView) . grow ( 1 )
98+ }
99+ rootFlexContainer. flex. layout ( )
100+ expect ( aView. frame) . to ( equal ( CGRect ( x: 0.0 , y: 0.0 , width: 360.0 , height: 400.0 ) ) )
101+ }
68102
69103 it ( " adjust the aView size and position " ) {
70104 rootFlexContainer. flex. padding ( 10 ) . define { ( flex) in
@@ -73,6 +107,14 @@ class PaddingSpec: QuickSpec {
73107 rootFlexContainer. flex. layout ( )
74108 expect ( aView. frame) . to ( equal ( CGRect ( x: 10.0 , y: 10.0 , width: 380.0 , height: 380.0 ) ) )
75109 }
110+
111+ it ( " adjust the aView size and position " ) {
112+ rootFlexContainer. flex. padding ( 10 % ) . define { ( flex) in
113+ flex. addItem ( aView) . grow ( 1 )
114+ }
115+ rootFlexContainer. flex. layout ( )
116+ expect ( aView. frame) . to ( equal ( CGRect ( x: 40.0 , y: 40.0 , width: 320.0 , height: 320.0 ) ) )
117+ }
76118
77119 it ( " adjust the aView size and position " ) {
78120 rootFlexContainer. flex. padding ( 10 , 20 , 30 , 40 ) . define { ( flex) in
@@ -81,6 +123,14 @@ class PaddingSpec: QuickSpec {
81123 rootFlexContainer. flex. layout ( )
82124 expect ( aView. frame) . to ( equal ( CGRect ( x: 20.0 , y: 10.0 , width: 340.0 , height: 360.0 ) ) )
83125 }
126+
127+ it ( " adjust the aView size and position " ) {
128+ rootFlexContainer. flex. padding ( 10 % , 20 % , 30 % , 40 % ) . define { ( flex) in
129+ flex. addItem ( aView) . grow ( 1 )
130+ }
131+ rootFlexContainer. flex. layout ( )
132+ expect ( aView. frame) . to ( equal ( CGRect ( x: 80.0 , y: 40.0 , width: 160.0 , height: 240.0 ) ) )
133+ }
84134
85135 it ( " adjust the aView size and position " ) {
86136 rootFlexContainer. flex. paddingStart ( 10 ) . define { ( flex) in
@@ -89,6 +139,14 @@ class PaddingSpec: QuickSpec {
89139 rootFlexContainer. flex. layout ( )
90140 expect ( aView. frame) . to ( equal ( CGRect ( x: 10.0 , y: 0.0 , width: 390.0 , height: 400.0 ) ) )
91141 }
142+
143+ it ( " adjust the aView size and position " ) {
144+ rootFlexContainer. flex. paddingStart ( 10 % ) . define { ( flex) in
145+ flex. addItem ( aView) . grow ( 1 )
146+ }
147+ rootFlexContainer. flex. layout ( )
148+ expect ( aView. frame) . to ( equal ( CGRect ( x: 40.0 , y: 0.0 , width: 360.0 , height: 400.0 ) ) )
149+ }
92150
93151 it ( " adjust the aView size and position " ) {
94152 rootFlexContainer. flex. paddingEnd ( 10 ) . define { ( flex) in
@@ -97,6 +155,14 @@ class PaddingSpec: QuickSpec {
97155 rootFlexContainer. flex. layout ( )
98156 expect ( aView. frame) . to ( equal ( CGRect ( x: 0.0 , y: 0.0 , width: 390.0 , height: 400.0 ) ) )
99157 }
158+
159+ it ( " adjust the aView size and position " ) {
160+ rootFlexContainer. flex. paddingEnd ( 10 % ) . define { ( flex) in
161+ flex. addItem ( aView) . grow ( 1 )
162+ }
163+ rootFlexContainer. flex. layout ( )
164+ expect ( aView. frame) . to ( equal ( CGRect ( x: 0.0 , y: 0.0 , width: 360.0 , height: 400.0 ) ) )
165+ }
100166
101167 it ( " adjust the aView size and position " ) {
102168 rootFlexContainer. flex. paddingVertical ( 10 ) . define { ( flex) in
@@ -105,6 +171,14 @@ class PaddingSpec: QuickSpec {
105171 rootFlexContainer. flex. layout ( )
106172 expect ( aView. frame) . to ( equal ( CGRect ( x: 0.0 , y: 10.0 , width: 400.0 , height: 380.0 ) ) )
107173 }
174+
175+ it ( " adjust the aView size and position " ) {
176+ rootFlexContainer. flex. paddingVertical ( 10 % ) . define { ( flex) in
177+ flex. addItem ( aView) . grow ( 1 )
178+ }
179+ rootFlexContainer. flex. layout ( )
180+ expect ( aView. frame) . to ( equal ( CGRect ( x: 0.0 , y: 40.0 , width: 400.0 , height: 320.0 ) ) )
181+ }
108182
109183 it ( " adjust the aView size and position " ) {
110184 rootFlexContainer. flex. paddingHorizontal ( 10 ) . define { ( flex) in
@@ -113,6 +187,15 @@ class PaddingSpec: QuickSpec {
113187 rootFlexContainer. flex. layout ( )
114188 expect ( aView. frame) . to ( equal ( CGRect ( x: 10.0 , y: 0.0 , width: 380.0 , height: 400.0 ) ) )
115189 }
190+
191+ it ( " adjust the aView size and position " ) {
192+ rootFlexContainer. flex. paddingHorizontal ( 10 % ) . define { ( flex) in
193+ flex. addItem ( aView) . grow ( 1 )
194+ }
195+ rootFlexContainer. flex. layout ( )
196+ expect ( aView. frame) . to ( equal ( CGRect ( x: 40.0 , y: 0.0 , width: 320.0 , height: 400.0 ) ) )
197+ }
198+
116199 }
117200 }
118201}
0 commit comments