Sha256: cc800013949a2f829440975747f3af79f86b4599ec4e2283ea7df935d55b8a49

Contents?: true

Size: 1.86 KB

Versions: 3

Compression:

Stored size: 1.86 KB

Contents

# encoding: utf-8
require 'spec_helper'

feature 'china city', js: true do
  scenario 'select' do
    visit '/clwy_china_city'
    within '.rails-helper' do
      select '广东省'
      select '深圳市'
      select '南山区'
    end
    within '.html-tag' do
      select '广东省'
      select '深圳市'
      select '南山区'
    end
  end

  describe 'clean' do
    before do
      visit '/clwy_china_city'
      within '.rails-helper' do
        select '广东省'
        select '深圳市'
        select '南山区'
      end
    end
    context 'select empty parent' do
      scenario 'city and district' do
        within '.rails-helper' do
          select '--省份--'
          expect(find('.city-city').value).to be_blank
          expect(find('.city-district').value).to be_blank
          sleep 2
          expect(all('.city-city option').size).to eql 1
          expect(all('.city-district option').size).to eql 1
        end
      end
      scenario 'district' do
        within '.rails-helper' do
          select '--城市--'
          expect(find('.city-district').value).to be_blank
          sleep 2
          expect(all('.city-district option').size).to eql 1
        end
      end
    end
    context 'select other parent' do
      scenario 'city and district' do
        within '.rails-helper' do
          select '江苏省'
          expect(find('.city-city').value).to be_blank
          expect(find('.city-district').value).to be_blank
          sleep 2
          expect(all('.city-city option').size).to eql 14
          expect(all('.city-district option').size).to eql 1
        end
      end
      scenario 'district' do
        within '.rails-helper' do
          select '广州市'
          expect(find('.city-district').value).to be_blank
          sleep 2
          expect(all('.city-district option').size).to eql 14
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
clwy_china_city-0.0.9 spec/features/china_city_spec.rb
clwy_china_city-0.0.8 spec/features/china_city_spec.rb
clwy_china_city-0.0.7 spec/features/china_city_spec.rb