discourse/spec/system/page_objects/pages/admin_theme_site_settings.rb
Martin Brennan 2ff2389812
UX: Use d-table classes instead of legacy d-admin-table (#38048)
In https://github.com/discourse/discourse/pull/33531 we
introduced the d-table class as a generic alternative to
d-admin-table, meant to replace it. However we didn't
update
https://meta.discourse.org/t/creating-consistent-admin-interfaces/326780
properly, nor did we update all places in the code that used
the old CSS classes, so over time we've ended up with a mix of both.

This commit updates all admin tables to use the new d-table classes, and
removes the old d-admin-table classes, updating templates, CSS, and
system specs as necessary.

We will remove the admin_table.scss file in a followup PR, since
other plugins may be using these classes.
2026-02-26 09:37:56 +10:00

40 lines
1.4 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class AdminThemeSiteSettings < PageObjects::Pages::AdminBase
def has_setting_with_default?(setting_name)
setting_row(setting_name).has_css?(
".admin-theme-site-settings-row__setting .setting-label",
text: SiteSetting.humanized_name(setting_name),
)
setting_row(setting_name).has_css?(
".admin-theme-site-settings-row__setting .setting-description",
text: SiteSetting.description(setting_name),
)
setting_row(setting_name).has_css?(
".admin-theme-site-settings-row__default",
text: SiteSetting.defaults[setting_name],
)
end
def has_theme_overriding?(setting_name, theme, overrride_value)
setting_row(setting_name).has_css?(theme_overriding_css(theme), text: theme.name)
find(theme_overriding_css(theme)).hover
find(".fk-d-tooltip__content.-content.-expanded").has_content?(
I18n.t("admin_js.admin.theme_site_settings.overridden_value", value: overrride_value),
)
end
def theme_overriding_css(theme)
".admin-theme-site-settings-row__overridden .theme-link[data-theme-id='#{theme.id}']"
end
def setting_row(setting_name)
page.find(
".d-table__row.admin-theme-site-settings-row[data-setting-name='#{setting_name}']",
)
end
end
end
end