discourse/spec/system/page_objects/components/review/topic_link.rb
Kris 92c9d43b9a
DEV: add additional icon aliases for lock (#33547)
This adds some new icon aliases so the lock icon can be overridden in
specific scenarios without applying globally to all locks:

* "topic.closed"
* "topic.opened"
* "category.restricted"

This enables customizations like:


![image](https://github.com/user-attachments/assets/e7dc62ce-98ed-49ad-b127-97cf928f3371)

```
import { apiInitializer } from "discourse/lib/api";

export default apiInitializer((api) => {
  api.replaceIcon("topic.closed", "xmark");
  api.replaceIcon("category.restricted", "shield-halved");
});
```

More documentation on this feature in
https://meta.discourse.org/t/change-icons-globally/87751
2025-07-10 14:11:03 -04:00

29 lines
837 B
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Components
module Review
class TopicLink < PageObjects::Components::Base
WRAPPER_CSS = ".post-topic"
def has_closed_topic_status?
within(WRAPPER_CSS) { has_css?(".topic-status [class*='d-icon-topic.closed']") }
end
def has_topic_link?(topic_title:, post_url:)
within(WRAPPER_CSS) { expect(page).to have_link(topic_title, href: post_url) }
end
def has_category_badge?(category_name)
within(WRAPPER_CSS) do
expect(page).to have_css(".badge-category__name", text: category_name)
end
end
def has_tag_link?(tag_name:, tag_url:)
within(WRAPPER_CSS) { expect(page).to have_link(tag_name, href: tag_url) }
end
end
end
end
end