Sha256: 7019c3d3dd6cd55042591ee728a52b548895fc2f0e9f7ad8eed71a14d7b7f62f

Contents?: true

Size: 1.47 KB

Versions: 9

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'

describe 'JavaScript Behavior', :js => true do
  include Capybara::DSL

  [:jquery].each do |js_framework|

    url = case js_framework
    when :jquery then '/projects/new'
    end

    context "with #{js_framework}" do
      context 'when field was added' do
        it 'emits general add event' do
          visit url
          click_link 'Add new task'

          page.should have_content 'Added some field'
        end

        it 'emits add event for current association' do
          visit url
          click_link 'Add new task'

          page.should have_content 'Added task field'
          page.should_not have_content 'Added milestone field'

          click_link 'Add new milestone'

          page.should have_content 'Added milestone field'
        end
      end

      context 'when field was removed' do
        it 'emits general remove event' do
          visit url
          click_link 'Add new task'
          click_link 'Remove'

          page.should have_content 'Removed some field'
        end

        it 'emits remove event for current association' do
          visit url
          2.times { click_link 'Add new task' }
          click_link 'Remove'

          page.should have_content 'Removed task field'
          page.should_not have_content 'Removed milestone field'

          click_link 'Add new milestone'
          click_link 'Remove milestone'

          page.should have_content 'Removed milestone field'
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
freeform-2.0.3 spec/javascript_spec.rb
freeform-2.0.2 spec/javascript_spec.rb
freeform-2.0.1 spec/javascript_spec.rb
freeform-2.0.0 spec/javascript_spec.rb
freeform-1.0.11 spec/javascript_spec.rb
freeform-1.0.9 spec/javascript_spec.rb
freeform-1.0.8 spec/javascript_spec.rb
freeform-1.0.6 spec/javascript_spec.rb
freeform-1.0.5 spec/javascript_spec.rb