Sha256: 45711b7b0a86a2020ceca9b6372f41f1a9e62d4c8ecf970e384408903c02496f

Contents?: true

Size: 1.39 KB

Versions: 18

Compression:

Stored size: 1.39 KB

Contents

describe "FormController/TextRow" do
  tests Formotion::FormController

  # By default, `tests` uses @controller.init
  # this isn't ideal for our case, so override.
  def controller
    row_settings = {
      title: "Text",
      key: :text,
      type: :text
    }
    @form ||= Formotion::Form.new(
      sections: [{
        rows:[row_settings]
    }])

    @controller ||= Formotion::FormController.alloc.initWithForm(@form)
  end

  def text_row
    @form.sections.first.rows.first
  end

  after do
    text_row.object.dismissKeyboard
  end

  it "should pop open the keyboard when tapped" do
    @notif = App.notification_center.observe UIKeyboardDidShowNotification do |notification|
      @did_show = true
    end
    tap("Text")
    wait 1 do
      @did_show.should == true
      App.notification_center.unobserve @notif
    end
  end

  it "should close the keyboard when tapped again" do
    @notif = App.notification_center.observe UIKeyboardDidHideNotification do |notification|
      @did_hide = true
    end

    tap("Text")
    wait 1 do
      tap("Text")
      wait 1 do
        @did_hide.should == true
        App.notification_center.unobserve @notif
      end
    end
  end

  it "should change value of row when typing" do
    tap("Text")
    text_row.object.field.text = "Hello"
    text_row.object.field.delegate.textViewDidChange(text_row.object.field)
    text_row.value.should == "Hello"
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
formotion-1.8 spec/functional/text_row_spec.rb
formotion-1.7 spec/functional/text_row_spec.rb
formotion-1.6 spec/functional/text_row_spec.rb
formotion-1.5.1 spec/functional/text_row_spec.rb
formotion-1.5.0 spec/functional/text_row_spec.rb
formotion-1.4.0 spec/functional/text_row_spec.rb
formotion-1.3.1 spec/functional/text_row_spec.rb
formotion-1.3 spec/functional/text_row_spec.rb
formotion-1.2 spec/functional/text_row_spec.rb
formotion-1.1.5 spec/functional/text_row_spec.rb
formotion-1.1.4 spec/functional/text_row_spec.rb
formotion-1.1.3 spec/functional/text_row_spec.rb
formotion-1.1.2 spec/functional/text_row_spec.rb
formotion-1.1.1 spec/functional/text_row_spec.rb
formotion-1.1 spec/functional/text_row_spec.rb
formotion-1.0 spec/functional/text_row_spec.rb
formotion-0.5.1 spec/functional/text_row_spec.rb
formotion-0.5 spec/functional/text_row_spec.rb