Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustdoc/html/templates/print_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h1>
{% if !notable_trait_badges.is_empty() %}
<div class="notable-trait-badge-container">
{% for badge in notable_trait_badges.iter() %}
<a class="notable-trait-badge notable-trait-badge-{{badge.color_index}}"
<a class="badge-{{badge.color_index}}"
{% if let Some(href) = badge.href %}href="{{href|safe}}" {%+ endif %}
title="{{badge.full_path}}">{{badge.name}}</a>
{% endfor %}
Expand Down
14 changes: 14 additions & 0 deletions tests/rustdoc-gui/notable-traits.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This test ensures that the notable trait badges are correctly rendered.
go-to: "file://" + |DOC_PATH| + "/test_docs/notable/struct.Wrapper.html"
show-text: true
store-css: (".notable-trait-badge-container", {"background-color": background_color})
// The background color should be different.
assert-css-false: (".notable-trait-badge-container > a", {"background-color": |background_color|})

store-css: ("#trait-implementations", {"color": text_color})
assert-css: (".notable-trait-badge-container > a", {
// The color should be the same as the "main color".
"color": |text_color|,
// Checking some additional CSS values.
"border-radius": "12px",
})
9 changes: 9 additions & 0 deletions tests/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#![feature(macro_attr)]
#![feature(macro_derive)]
#![feature(negative_impls)]
#![feature(doc_notable_trait)]

/*!
Enable the feature <span class="stab portability"><code>some-feature</code></span> to enjoy
Expand Down Expand Up @@ -813,3 +814,11 @@ pub mod tyalias {

pub type Y = X<u8>;
}

pub mod notable {
#[doc(notable_trait)]
pub trait Labeled {}

pub struct Wrapper;
impl Labeled for Wrapper {}
}
Loading