Sha256: 54067e7b2dd52bfa85b8c5d1ac46215b160fe2c1f11448ba690f1feaf12d7e20

Contents?: true

Size: 1.8 KB

Versions: 2

Compression:

Stored size: 1.8 KB

Contents

require 'spec_helper'
require 'action_view'

describe 'dt_picker_tag spec:' do

  before do
    ExtForm.setup do |e|
      e.layout = 'BootstrapLayout'
      e.default_wrapper = :ext_bootstrap
      e.default_layout = {
          layout: '1:1',
          spacing: '1',
          label_width: '2',
          max_width: '12'
      }
    end
  end

  let(:order_header) { FactoryGirl.create(:order_header) }

  context 'date options' do

    subject {
      helper.dt_picker_tag('test', '2013-3-3', data: {pick_time: false, format: 'yyyy-MM-dd', language: 'zh-CN'})
    }

    it 'order_date should render date_picker' do
      expect(subject).to match /<input.*data-format="yyyy-MM-dd" data-language="zh-CN" data-pick-time="false"/
      expect(subject).to match /<span class="add-on"><i data-date-icon="icon-calendar" data-time-icon="icon-time"/
    end

  end

  context 'time options' do

    subject {
      helper.dt_picker_tag('test', '2013-3-3',
                           data: {pick_date: false,
                                  format: 'hh:mm:ss',
                                  language: 'zh-CN',
                                  start_date: '2012-2-2',
                                  end_date: '2012-3-3'})
    }

    it 'order_date should render time_picker' do
      expect(subject).to match /<input.*data-format="hh:mm:ss" data-language="zh-CN" data-pick-date="false"/
      expect(subject).to match /data-start-date="2012-2-2"/
      expect(subject).to match /data-end-date="2012-3-3"/
    end

  end

  context 'datetime options' do

    subject {
      helper.dt_picker_tag('test', '2013-3-3', data: {format: 'yyyy-MM-dd hh:mm:ss', language: 'zh-CN'})
    }

    it 'order_date should render dt_picker' do
      expect(subject).to match /<input.*data-format="yyyy-MM-dd hh:mm:ss" data-language="zh-CN"/
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ext_form-0.1.5 spec/helpers/dt_picker_tag_spec.rb
ext_form-0.1.4 spec/helpers/dt_picker_tag_spec.rb