mirror of
https://github.com/discourse/discourse.git
synced 2024-12-19 11:54:19 +08:00
3019bb577b
This commit modernizes the post menu by migrating it from the existing widget-based implementation to Glimmer components. This transition aims to improve the maintainability, performance, and overall developer experience. It also introduces a new DAG-based transformer API for customizations that aims to be more flexible than the widget base one. --------- Co-authored-by: David Taylor <david@taylorhq.com>
62 lines
1.1 KiB
Ruby
62 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Modals
|
|
class Base
|
|
include Capybara::DSL
|
|
include RSpec::Matchers
|
|
|
|
BODY_SELECTOR = ""
|
|
MODAL_SELECTOR = ""
|
|
|
|
def header
|
|
find(".d-modal__header")
|
|
end
|
|
|
|
def body
|
|
find(".d-modal__body#{BODY_SELECTOR}")
|
|
end
|
|
|
|
def footer
|
|
find(".d-modal__footer")
|
|
end
|
|
|
|
def has_footer?
|
|
has_css?(".d-modal__footer")
|
|
end
|
|
|
|
def has_no_footer?
|
|
has_no_css?(".d-modal__footer")
|
|
end
|
|
|
|
def close
|
|
find(".modal-close").click
|
|
end
|
|
|
|
def cancel
|
|
find(".d-modal-cancel").click
|
|
end
|
|
|
|
def click_outside
|
|
find(".d-modal").click(x: 0, y: 0)
|
|
end
|
|
|
|
def click_primary_button
|
|
footer.find(".btn-primary").click
|
|
end
|
|
|
|
def has_content?(content)
|
|
body.has_content?(content)
|
|
end
|
|
|
|
def open?
|
|
has_css?(".modal.d-modal#{MODAL_SELECTOR}")
|
|
end
|
|
|
|
def closed?
|
|
has_no_css?(".modal.d-modal#{MODAL_SELECTOR}")
|
|
end
|
|
end
|
|
end
|
|
end
|