kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.3 KiB
69 lines
1.3 KiB
5 years ago
|
require_relative './edit_field'
|
||
7 years ago
|
|
||
5 years ago
|
class TextEditorField < EditField
|
||
6 years ago
|
def ckeditor
|
||
|
@ckeditor ||= ::Components::WysiwygEditor.new @selector
|
||
|
end
|
||
|
|
||
7 years ago
|
def input_selector
|
||
6 years ago
|
'.ck-content'
|
||
7 years ago
|
end
|
||
|
|
||
|
def expect_save_button(enabled: true)
|
||
|
if enabled
|
||
|
expect(field_container).to have_no_selector("#{control_link}[disabled]")
|
||
|
else
|
||
|
expect(field_container).to have_selector("#{control_link}[disabled]")
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def expect_value(value)
|
||
6 years ago
|
expect(input_element.text).to eq(value)
|
||
7 years ago
|
end
|
||
|
|
||
|
def save!
|
||
|
submit_by_click
|
||
|
end
|
||
|
|
||
6 years ago
|
def set_value(text)
|
||
|
ckeditor.set_markdown text
|
||
|
end
|
||
7 years ago
|
|
||
6 years ago
|
def clear
|
||
|
ckeditor.clear
|
||
|
end
|
||
|
|
||
|
def click_and_type_slowly(text)
|
||
|
ckeditor.click_and_type_slowly text
|
||
|
end
|
||
|
|
||
|
def type(text)
|
||
|
click_and_type_slowly text
|
||
7 years ago
|
end
|
||
|
|
||
7 years ago
|
def submit_by_click
|
||
|
target = field_container.find(control_link)
|
||
|
scroll_to_element(target)
|
||
|
target.click
|
||
|
end
|
||
|
|
||
|
def submit_by_keyboard
|
||
|
input_element.native.send_keys :tab
|
||
|
end
|
||
|
|
||
|
def cancel_by_click
|
||
|
target = field_container.find(control_link(:cancel))
|
||
|
scroll_to_element(target)
|
||
|
target.click
|
||
|
end
|
||
|
|
||
|
def field_type
|
||
|
input_selector
|
||
|
end
|
||
|
|
||
|
def control_link(action = :save)
|
||
|
raise 'Invalid link' unless [:save, :cancel].include?(action)
|
||
|
".inplace-edit--control--#{action}"
|
||
|
end
|
||
|
end
|