1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actiontext/CHANGELOG.md
Kyohei Toyoda 07533a3d2f Add method to confirm rich text content existence by adding ? after content name
This change introduces a rich text object to make
it easier to confirm it context is existing or not.

If we have a class like below.

class Information < ApplicationRecord
  has_rich_text :notes
end

Before:
i = Information.new
i.notes? => NoMethodError
i.notes = "Some sample text"
i.notes.present? => true

After:
i = Information.new
i.notes? => false

i.notes = "Some sample text"
i.notes? => true
2019-12-13 12:58:42 +09:00

1,018 B

  • Add method to confirm rich text content existence by adding ? after content name.

    Kyohei Toyoda

  • The fill_in_rich_text_area system test helper locates a Trix editor and fills it in with the given HTML:

    # <trix-editor id="message_content" ...></trix-editor>
    fill_in_rich_text_area "message_content", with: "Hello <em>world!</em>"
    
    # <trix-editor placeholder="Your message here" ...></trix-editor>
    fill_in_rich_text_area "Your message here", with: "Hello <em>world!</em>"
    
    # <trix-editor aria-label="Message content" ...></trix-editor>
    fill_in_rich_text_area "Message content", with: "Hello <em>world!</em>"
    
    # <input id="trix_input_1" name="message[content]" type="hidden">
    # <trix-editor input="trix_input_1"></trix-editor>
    fill_in_rich_text_area "message[content]", with: "Hello <em>world!</em>"
    

    George Claghorn

Please check 6-0-stable for previous changes.