2023-02-09 03:21:39 +08:00
|
|
|
# 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)
|
2024-03-11 08:42:12 +08:00
|
|
|
# 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: "")
|
2023-02-09 03:21:39 +08:00
|
|
|
editor_input.fill_in(with: content)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def clear_input
|
|
|
|
fill_input("")
|
|
|
|
end
|
|
|
|
|
|
|
|
def editor_input
|
2024-03-11 08:42:12 +08:00
|
|
|
find(".ace-wrapper .ace:not(.hidden)", visible: true).find(
|
|
|
|
".ace_text-input",
|
|
|
|
visible: false,
|
|
|
|
)
|
2023-02-09 03:21:39 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|