Sha256: 864d5593f7b9284b02b3a3559d5a33fd6e29fc9ce0acb0d799634afbd83790c0

Contents?: true

Size: 1.66 KB

Versions: 1

Compression:

Stored size: 1.66 KB

Contents

describe UnderOs::UI::Scroll do
  before do
    @scroll = UnderOs::UI::Scroll.new
  end

  describe '#initialize' do
    it 'should build an UI:Scroll object' do
      @scroll.class.should == UnderOs::UI::Scroll
    end

    it "should wrap an UIScrollView instance" do
      @scroll._.class.should == UIScrollView
    end

    it "should have the SCROLL tag" do
      @scroll.tagName.should == 'SCROLL'
    end

    it "should accept the 'paging' option" do
      scroll = UnderOs::UI::Scroll.new(paging: true)
      scroll.paging.should == true
    end
  end

  describe '#paging' do
    it "should return 'false' by default" do
      @scroll.paging.should == false
    end

    it "should to switch it on" do
      @scroll.paging = true
      @scroll.paging.should == true
    end

    it "should fallback to false" do
      @scroll.paging = 'weird stuff'
      @scroll.paging.should == false
    end
  end

  describe "#scale" do
    it "should allow to read it" do
      @scroll.scale.should == 1.0
    end

    it "should allow to set it" do
      @scroll.scale = 2.4
      @scroll._.zoomScale.should == 1.0 # it will fall back to it
    end
  end

  describe "#minScale" do
    it "should allow to read it" do
      @scroll._.minimumZoomScale = 1.8
      @scroll.minScale.should == 1.8
    end

    it "should allow to set it" do
      @scroll.minScale = 2.7
      @scroll._.minimumZoomScale.should == 2.7
    end
  end

  describe "#maxScale" do
    it "should allow to read it" do
      @scroll._.maximumZoomScale = 1.8
      @scroll.maxScale.should == 1.8
    end

    it "should allow to set it" do
      @scroll.maxScale = 2.7
      @scroll._.maximumZoomScale.should == 2.7
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
under-os-ui-1.4.0 spec/under_os/ui/scroll_spec.rb