teacup 2.1.8 → 2.1.9

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.8)
4
+ teacup (2.1.9)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -940,6 +940,11 @@ in you chuckle with glee. In this example you could go completely with just
940
940
  frame calculation formulas and springs and struts. Your frame code would still
941
941
  be cluttered, just cluttered in a different way.
942
942
 
943
+ If you need to reset the list of constraints managed by Teacup, you can call
944
+ `reset_constraints` before you add the new styles to a UIView. This can be
945
+ useful when you need to define a new set of layout constraints for a dynamic
946
+ set of views.
947
+
943
948
  This works on OS X and iOS, and you don't have to go changing the idea of "top"
944
949
  and "bottom" even though OS X uses reversed frames.
945
950
 
@@ -308,6 +308,13 @@ module Teacup
308
308
  Teacup.apply_hash self, properties
309
309
  end
310
310
 
311
+ def reset_constraints
312
+ @teacup_constraints = nil
313
+ subviews.each do |subview|
314
+ subview.reset_constraints
315
+ end
316
+ end
317
+
311
318
  def add_uniq_constraints(constraint)
312
319
  @teacup_constraints ||= {}
313
320
 
@@ -1,5 +1,5 @@
1
1
  module Teacup
2
2
 
3
- VERSION = '2.1.8'
3
+ VERSION = '2.1.9'
4
4
 
5
5
  end
@@ -21,9 +21,34 @@ describe "Teacup::View" do
21
21
 
22
22
  style :new_style,
23
23
  text: 'new style'
24
+
25
+ style :constrained,
26
+ constraints: [
27
+ [:full]
28
+ ]
29
+
24
30
  end
25
31
  end
26
32
 
33
+ describe 'reset_constraints' do
34
+
35
+ before do
36
+ @outer = UIView.new
37
+ @outer.addSubview @view
38
+ end
39
+
40
+ it "forgets the list of constraints that may have been set" do
41
+ @view.stylesheet = @stylesheet
42
+ @view.add_style_class :constrained
43
+ @view.apply_constraints
44
+ @view.constraints.should.not.be.empty
45
+ @outer.reset_constraints
46
+ @view.apply_constraints
47
+ @view.constraints.should.be.empty
48
+ end
49
+
50
+ end
51
+
27
52
  describe 'stylename=' do
28
53
  it 'should work' do
29
54
  @view.stylename = :label
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.8
4
+ version: 2.1.9
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-08-05 00:00:00.000000000 Z
12
+ date: 2013-08-06 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