teacup 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- teacup (2.1.0)
4
+ teacup (2.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -138,7 +138,7 @@ constraints. Teacup can also integrate with the [motion-layout][] gem!
138
138
  * [Using and re-using styles in a Stylesheet](#using-and-re-using-styles-in-a-stylesheet)
139
139
  * [Style via Stylename](#style-via-stylename)
140
140
  * [Extending Styles](#extending-styles)
141
- * [Style via UIView Class](#style-via-uiview-class)
141
+ * [Style via View Class](#style-via-view-class)
142
142
  * [Importing stylesheets](#importing-stylesheets)
143
143
  * [Style via UIAppearance](#style-via-uiappearance) (iOS only)
144
144
  * [UITableViews](#uitableviews) - This is important if you are using styles and
@@ -19,6 +19,12 @@ module Teacup
19
19
  # Enable debug messages for this object
20
20
  attr_accessor :debug
21
21
 
22
+ # Subviews or empty collection of views to cater for issue with iOS7 dp3
23
+ def teacup_subviews
24
+ subviews || []
25
+ end
26
+
27
+
22
28
  # Alter the stylename of this view.
23
29
  #
24
30
  # This will cause new styles to be applied from the stylesheet.
@@ -122,7 +128,7 @@ module Teacup
122
128
  end
123
129
  style(stylesheet.query(self.stylename, self, orientation))
124
130
  end
125
- subviews.each { |subview| subview.restyle!(orientation) }
131
+ teacup_subviews.each { |subview| subview.restyle!(orientation) }
126
132
  end
127
133
  end
128
134
 
@@ -199,7 +205,7 @@ module Teacup
199
205
  end
200
206
 
201
207
  # now add all che child constraints
202
- subviews.each do |subview|
208
+ teacup_subviews.each do |subview|
203
209
  my_constraints.concat(subview.get_ns_constraints)
204
210
  end
205
211
 
@@ -1,5 +1,5 @@
1
1
  module Teacup
2
2
 
3
- VERSION = '2.1.0'
3
+ VERSION = '2.1.1'
4
4
 
5
5
  end
@@ -50,6 +50,7 @@ class DummyTextField < NSTextField
50
50
  private
51
51
  def dummy
52
52
  setAdjustsFontSizeToFitWidth(nil)
53
+ setFormatter(nil)
53
54
  end
54
55
  end
55
56
 
@@ -8,36 +8,70 @@ describe "TableViewCells" do
8
8
  @padding = @cell.contentView.subviews[0]
9
9
  end
10
10
 
11
- it "should have styled padding" do
11
+ it "should have styled padding (backgroundColor.should)" do
12
12
  @padding.backgroundColor.should == UIColor.greenColor
13
- @padding.center.x.should == @padding.superview.bounds.size.width / 2
14
- @padding.center.y.should == @padding.superview.bounds.size.height / 2
13
+ end
14
+ it "should have styled padding (center.x.should)" do
15
+ @padding.center.x.round.should == (@padding.superview.bounds.size.width / 2).round
16
+ end
17
+ it "should have styled padding (center.y.should)" do
18
+ @padding.center.y.round.should == (@padding.superview.bounds.size.height / 2).round
19
+ end
20
+ it "should have styled padding (frame.size.width.should)" do
15
21
  @padding.frame.size.width.should < @padding.superview.bounds.size.width
22
+ end
23
+ it "should have styled padding (frame.size.height.should)" do
16
24
  @padding.frame.size.height.should < @padding.superview.bounds.size.height
17
25
  end
18
26
 
19
- it "should have styled title" do
27
+ it "should have styled title (text)" do
20
28
  @cell.title_label.text.should =~ /^title/
29
+ end
30
+ it "should have styled title (frame.origin.x)" do
21
31
  @cell.title_label.frame.origin.x.should == 0
32
+ end
33
+ it "should have styled title (frame.origin.y)" do
22
34
  @cell.title_label.frame.origin.y.should == 0
35
+ end
36
+ it "should have styled title (frame.size.height)" do
23
37
  @cell.title_label.frame.size.height.should == 20
38
+ end
39
+ it "should have styled title (frame.size.width)" do
24
40
  @cell.title_label.frame.size.width.should == @padding.frame.size.width
41
+ end
42
+ it "should have styled title (textColor)" do
25
43
  @cell.title_label.textColor.should == UIColor.blueColor
26
44
  end
27
45
 
28
- it "should have styled details" do
46
+ it "should have styled details (text)" do
29
47
  @cell.details_label.text.should =~ /^details/
48
+ end
49
+ it "should have styled details (frame.origin.x)" do
30
50
  @cell.details_label.frame.origin.x.should == 0
51
+ end
52
+ it "should have styled details (frame.origin.y)" do
31
53
  @cell.details_label.frame.origin.y.should == CGRectGetMaxY(@cell.title_label.frame) + 5
54
+ end
55
+ it "should have styled details (frame.size.height)" do
32
56
  @cell.details_label.frame.size.height.should == 17
57
+ end
58
+ it "should have styled details (frame.size.width)" do
33
59
  @cell.details_label.frame.size.width.should == @padding.frame.size.width
34
60
  end
35
61
 
36
- it "should have styled other" do
62
+ it "should have styled other (text)" do
37
63
  @cell.other_label.text.should =~ /^other/
64
+ end
65
+ it "should have styled other (frame.origin.x)" do
38
66
  @cell.other_label.frame.origin.x.should == 0
67
+ end
68
+ it "should have styled other (frame.origin.y)" do
39
69
  @cell.other_label.frame.origin.y.should == CGRectGetMaxY(@cell.details_label.frame) + 5
70
+ end
71
+ it "should have styled other (frame.size.height)" do
40
72
  @cell.other_label.frame.size.height.should == 17
73
+ end
74
+ it "should have styled other (frame.size.width)" do
41
75
  @cell.other_label.frame.size.width.should == @padding.frame.size.width
42
76
  end
43
77
 
@@ -55,36 +89,70 @@ describe "TableViewCells" do
55
89
  @cell.is_reused.should == true
56
90
  end
57
91
 
58
- it "should have styled padding" do
92
+ it "should have styled padding (backgroundColor)" do
59
93
  @padding.backgroundColor.should == UIColor.greenColor
60
- @padding.center.x.should == @padding.superview.bounds.size.width / 2
61
- @padding.center.y.should == @padding.superview.bounds.size.height / 2
94
+ end
95
+ it "should have styled padding (center.x)" do
96
+ @padding.center.x.round.should == (@padding.superview.bounds.size.width / 2).round
97
+ end
98
+ it "should have styled padding (center.y)" do
99
+ @padding.center.y.round.should == (@padding.superview.bounds.size.height / 2).round
100
+ end
101
+ it "should have styled padding (frame.size.width)" do
62
102
  @padding.frame.size.width.should < @padding.superview.bounds.size.width
103
+ end
104
+ it "should have styled padding (frame.size.height)" do
63
105
  @padding.frame.size.height.should < @padding.superview.bounds.size.height
64
106
  end
65
107
 
66
- it "should have styled title" do
108
+ it "should have styled title (text)" do
67
109
  @cell.title_label.text.should =~ /^title/
110
+ end
111
+ it "should have styled title (frame.origin.x)" do
68
112
  @cell.title_label.frame.origin.x.should == 0
113
+ end
114
+ it "should have styled title (frame.origin.y)" do
69
115
  @cell.title_label.frame.origin.y.should == 0
116
+ end
117
+ it "should have styled title (frame.size.height)" do
70
118
  @cell.title_label.frame.size.height.should == 20
119
+ end
120
+ it "should have styled title (frame.size.width)" do
71
121
  @cell.title_label.frame.size.width.should == @padding.frame.size.width
122
+ end
123
+ it "should have styled title (textColor)" do
72
124
  @cell.title_label.textColor.should == UIColor.blueColor
73
125
  end
74
126
 
75
- it "should have styled details" do
127
+ it "should have styled details (text)" do
76
128
  @cell.details_label.text.should =~ /^details/
129
+ end
130
+ it "should have styled details (frame.origin.x)" do
77
131
  @cell.details_label.frame.origin.x.should == 0
132
+ end
133
+ it "should have styled details (frame.origin.y)" do
78
134
  @cell.details_label.frame.origin.y.should == CGRectGetMaxY(@cell.title_label.frame) + 5
135
+ end
136
+ it "should have styled details (frame.size.height)" do
79
137
  @cell.details_label.frame.size.height.should == 17
138
+ end
139
+ it "should have styled details (frame.size.width)" do
80
140
  @cell.details_label.frame.size.width.should == @padding.frame.size.width
81
141
  end
82
142
 
83
- it "should have styled other" do
143
+ it "should have styled other (text)" do
84
144
  @cell.other_label.text.should =~ /^other/
145
+ end
146
+ it "should have styled other (frame.origin.x)" do
85
147
  @cell.other_label.frame.origin.x.should == 0
148
+ end
149
+ it "should have styled other (frame.origin.y)" do
86
150
  @cell.other_label.frame.origin.y.should == CGRectGetMaxY(@cell.details_label.frame) + 5
151
+ end
152
+ it "should have styled other (frame.size.height)" do
87
153
  @cell.other_label.frame.size.height.should == 17
154
+ end
155
+ it "should have styled other (frame.size.width)" do
88
156
  @cell.other_label.frame.size.width.should == @padding.frame.size.width
89
157
  end
90
158
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teacup
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-28 00:00:00.000000000 Z
12
+ date: 2013-07-12 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'Teacup is a community-driven DSL for making CSS-like styling, and
15
15
  layouts for