discourse/spec/system/page_objects/modals/base.rb
chapoi f72899401d
UX: refactor .d-modal to use BEM and improve styling (#23967)
This PR refactors the following:
* leaving all the CSS applied to the old `modal-body` classes in their respective files
* made  new clean styling for `.d-modal` and refactored the template to use the new BEM classes
  * `inner-`, `middle-`, `outer-` container classes are gone and replaced with simplified `wrapper` and `container` classes  
  * use standardised max-sizes with modifiers `-large` and `-max`
  * lighter backdrop,
  * min-width to prevent puny modals
  * other styling changes regarding padding, close button,…
* pulled out all modal overrides into a general `modal-overrides` file + cleanup of outdated CSS
* pulled out login and create account modal styling into their own file, cause it's such a big override 
* removed old general login.scss file for mobile & desktop
* only kept some remainders I don't want to touch in `app/assets/stylesheets/common/base/login.scss`
2023-11-15 10:14:47 +00:00

49 lines
823 B
Ruby

# frozen_string_literal: true
module PageObjects
module Modals
class Base
include Capybara::DSL
include RSpec::Matchers
BODY_SELECTOR = ""
def body
find(".d-modal__body#{BODY_SELECTOR}")
end
def footer
find(".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__wrapper").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")
end
def closed?
has_no_css?(".modal.d-modal")
end
end
end
end