Sha256: 588c53f049d622734325af7da3159c0c316e6da0933be5b79cff92a40278fa53

Contents?: true

Size: 1.43 KB

Versions: 5

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'
require 'features_helper'

describe 'resize', type: :feature, js: true do
  before(:each) do 
    visit images_path
    page.first('a[rel="hermitage"]').click
    page.should have_css('img.current')
  end

  shared_examples 'resize' do
    before(:each) do
      page.driver.resize(window_width, window_height)
      sleep(1) # Wait for animation complete
    end

    it 'adjusts image' do
      width('.current').should == expected_width
      height('.current').should == expected_height
      top('.current').should == expected_top
      left('.current').should == expected_left
    end

    it 'adjusts navigation buttons' do
      css('#navigation-left', 'line-height').should == expected_line_height
      css('#navigation-right', 'line-height').should == expected_line_height
    end    
  end

  describe 'make window smaller' do
    let(:window_width) { 300 }
    let(:window_height) { 300 }
    let(:expected_width) { 200 }
    let(:expected_height) { 200 }
    let(:expected_top) { 50 }
    let(:expected_left) { 50 }
    let(:expected_line_height) { '300px' }
    it_behaves_like 'resize'

    describe 'then make window larger' do
      let(:window_width) { 500 }
      let(:window_height) { 500 }
      let(:expected_width) { 256 }
      let(:expected_height) { 256 }
      let(:expected_top) { 122 }
      let(:expected_left) { 122 }
      let(:expected_line_height) { '500px' }
      it_behaves_like 'resize'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hermitage-0.0.7 spec/features/resize_spec.rb
hermitage-0.0.6 spec/features/resize_spec.rb
hermitage-0.0.5.2 spec/features/resize_spec.rb
hermitage-0.0.4.1 spec/features/resize_spec.rb
hermitage-0.0.3 spec/features/resize_spec.rb