31 lines
727 B
Swift
31 lines
727 B
Swift
import Elementary
|
|
import Testing
|
|
|
|
@testable import WebsiteLibrary
|
|
|
|
@Suite(
|
|
"Icon component",
|
|
.tags(.component)
|
|
)
|
|
struct IconTests {
|
|
|
|
// MARK: Functional tests
|
|
|
|
@Test
|
|
func `renders a decorative icon at the given size`() {
|
|
let html = Icon(.search, size: 16).render()
|
|
|
|
#expect(html.hasPrefix("<svg"))
|
|
#expect(html.contains(#"width="16" height="16""#))
|
|
#expect(html.contains(#"aria-hidden="true""#))
|
|
#expect(html.contains(#"stroke="currentColor""#))
|
|
}
|
|
|
|
@Test
|
|
func `renders no inline styles`() {
|
|
// The Content-Security-Policy blocks `style` attributes, inside an SVG as anywhere else.
|
|
#expect(!Icon(.key).render().contains("style="))
|
|
}
|
|
|
|
}
|