spec/unit/view_helper_spec.rb in ProMotion-1.0.4 vs spec/unit/view_helper_spec.rb in ProMotion-1.1.0.rc1

- old
+ new

@@ -77,49 +77,49 @@ describe "set_easy_attributes" do before do @dummy = UIView.alloc.initWithFrame CGRectZero @dummy.extend ProMotion::Styling - + @parent = UIView.alloc.initWithFrame(CGRectMake(0, 0, 320, 480)) @child = UIView.alloc.initWithFrame(CGRectZero) end it "Should set the autoresizingMask for all" do @dummy.set_easy_attributes @parent, @child, { resize: [:left, :right, :top, :bottom, :width, :height] } - mask = UIViewAutoresizingFlexibleLeftMargin | - UIViewAutoresizingFlexibleRightMargin | - UIViewAutoresizingFlexibleTopMargin | - UIViewAutoresizingFlexibleBottomMargin | - UIViewAutoresizingFlexibleWidth | + mask = UIViewAutoresizingFlexibleLeftMargin | + UIViewAutoresizingFlexibleRightMargin | + UIViewAutoresizingFlexibleTopMargin | + UIViewAutoresizingFlexibleBottomMargin | + UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight @child.autoresizingMask.should == mask end it "Should set the autoresizingMask for half" do @dummy.set_easy_attributes @parent, @child, { resize: [:left, :right, :top] } - mask = UIViewAutoresizingFlexibleLeftMargin | - UIViewAutoresizingFlexibleRightMargin | + mask = UIViewAutoresizingFlexibleLeftMargin | + UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin @child.autoresizingMask.should == mask end it "Should set the autoresizingMask for the second half" do @dummy.set_easy_attributes @parent, @child, { resize: [:bottom, :width, :height] } - mask = UIViewAutoresizingFlexibleBottomMargin | - UIViewAutoresizingFlexibleWidth | + mask = UIViewAutoresizingFlexibleBottomMargin | + UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight @child.autoresizingMask.should == mask end @@ -133,9 +133,20 @@ it "Should create a frame" do @dummy.set_easy_attributes @parent, @child, { left: 10, top: 20, + width: 100, + height: 50 + } + + @child.frame.should == CGRectMake(10, 20, 100, 50) + end + + it "Should create a frame with x & y" do + @dummy.set_easy_attributes @parent, @child, { + x: 10, + y: 20, width: 100, height: 50 } @child.frame.should == CGRectMake(10, 20, 100, 50)