mirror of
https://github.com/discourse/discourse.git
synced 2025-01-10 03:53:47 +08:00
380910aedd
This PR involves cleaning up the codebase from my (@keegangeorge's) todos. In particular: - Remove Form Template related todos (these are no longer in the roadmap) - Remove old left-over AI summarization related code after moving to AI (https://github.com/discourse/discourse-ai/pull/658) - Update one form template related spec
37 lines
905 B
Ruby
37 lines
905 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Components
|
|
class AceEditor < PageObjects::Components::Base
|
|
def type_input(content)
|
|
editor_input.send_keys(content)
|
|
self
|
|
end
|
|
|
|
def fill_input(content)
|
|
# Clear the input before filling it in because capybara's fill_in method doesn't seem to replace existing content
|
|
# unless the content is a blank string.
|
|
editor_input.fill_in(with: "")
|
|
editor_input.fill_in(with: content)
|
|
self
|
|
end
|
|
|
|
def clear_input
|
|
fill_input("")
|
|
end
|
|
|
|
def editor_input
|
|
find(".ace-wrapper .ace:not(.hidden)", visible: true).find(
|
|
".ace_text-input",
|
|
visible: false,
|
|
)
|
|
end
|
|
|
|
def has_content?(content)
|
|
editor_content = all(".ace_line").map(&:text).join("\n")
|
|
editor_content == content
|
|
end
|
|
end
|
|
end
|
|
end
|