Skip to content

Commit 6905497

Browse files
committed
implement comprehensive test suites for HTML element types
Add complete test coverage for fundamental HTML elements: - <a> Anchor: link attributes, targets, security, use cases - <abbr> Abbreviation: basic element creation and protocol conformance - <address> Contact Address: contact information semantics and usage - <area> Image Map Area: shapes, coordinates, image map functionality - <article> Article: standalone content, nesting, semantic structure - <aside> Aside: complementary content, sidebars, accessibility - <audio> Audio: media controls, preload options, CORS configuration - <b> Bring Attention To: stylistic emphasis without importance - <base> Document Base URL: URL resolution, target configuration - <bdi> Bidirectional Isolate: text direction isolation - <bdo> Bidirectional Override: explicit text direction control - <big> Bigger Text: deprecated styling element - <blockquote> Block Quotation: citation sources and semantic quotations Each test suite includes: - HTMLElement protocol conformance validation - Comprehensive attribute and property testing - Common use cases and semantic usage patterns - Integration tests and accessibility considerations - Element-specific functionality (enums, convenience creators) All tests use Swift Testing framework with @Suite/@test annotations. Establishes consistent testing patterns for remaining element types. Enhanced type safety with Hashable conformance for Input variants and improved attribute type definitions across HTMLAttributeTypes.
1 parent 5474a3e commit 6905497

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3968
-138
lines changed

Sources/HTMLAttributeTypes/Attributes/Accept.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ extension Accept {
101101

102102
extension Accept {
103103
/// Represents a file type specifier for the Accept attribute
104-
public struct FileType: Sendable, Equatable, CustomStringConvertible, ExpressibleByStringLiteral {
104+
public struct FileType: Sendable, Hashable, CustomStringConvertible, ExpressibleByStringLiteral {
105105
/// The string value for the file type
106106
public var value: String
107107

Sources/HTMLAttributeTypes/Attributes/AttributionSrc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public struct AttributionSrc: HTMLAttribute, CustomStringConvertible {
6565
@inlinable public static var attribute: String { "attributionsrc" }
6666

6767
/// The type of attribute value
68-
public enum Value: Sendable, Equatable {
68+
public enum Value: Sendable, Hashable {
6969
/// Boolean form (presence/absence of the attribute)
7070
case boolean(Bool)
7171

Sources/HTMLAttributeTypes/Attributes/CharSet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
// ===----------------------------------------------------------------------===//
1212

13-
public struct CharSet: Sendable, Equatable, ExpressibleByStringLiteral, CustomStringConvertible {
13+
public struct CharSet: Sendable, Hashable, ExpressibleByStringLiteral, CustomStringConvertible {
1414

1515
public var value: String
1616

Sources/HTMLAttributeTypes/Attributes/ControlsList.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,9 @@ extension ControlsList {
3939
return Self(values.map(\.rawValue).joined(separator: " "))
4040
}
4141
}
42+
43+
extension ControlsList: ExpressibleByArrayLiteral {
44+
public init(arrayLiteral elements: ControlsList...) {
45+
self = Self.combine(elements)
46+
}
47+
}

Sources/HTMLAttributeTypes/Attributes/Download.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public struct Download: HTMLAttribute, CustomStringConvertible {
6868
@inlinable public static var attribute: String { "download" }
6969

7070
/// The type of attribute value
71-
public enum Value: Sendable, Equatable {
71+
public enum Value: Sendable, Hashable {
7272
/// Boolean form (presence/absence of the attribute)
7373
case boolean(Bool)
7474

Sources/HTMLAttributeTypes/Attributes/Elementtiming.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ extension Elementtiming {
8181
}
8282

8383
/// Common predefined timing categories for semantic naming
84-
public struct Category: Sendable, Equatable, ExpressibleByStringLiteral, CustomStringConvertible {
84+
public struct Category: Sendable, Hashable, ExpressibleByStringLiteral, CustomStringConvertible {
8585
public var value: String
8686

8787
public init(_ value: String) {

Sources/HTMLAttributeTypes/Attributes/Form.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
// ===----------------------------------------------------------------------===//
1212

13-
public struct Form: Sendable, Equatable {
13+
public struct Form: Sendable, Hashable {
1414
/// A string specifying the character encodings that are to be used for the form submission.
1515
///
1616
/// The value is a space-separated list of one or more character encodings. The server must be able to handle all the specified encodings. If this attribute is not specified, the submission uses the character encoding of the page.

Sources/HTMLAttributeTypes/Attributes/Global/Exportparts.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public struct Exportparts: HTMLAttribute {
8484
}
8585

8686
/// A mapping from original part name to exposed part name
87-
public struct PartMapping: Sendable, Equatable {
87+
public struct PartMapping: Sendable, Hashable {
8888
/// The original part name in the shadow DOM
8989
public let originalName: String
9090

Sources/HTMLAttributeTypes/Attributes/SourceType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public struct SourceType: HTMLStringAttribute {
6060
}
6161

6262
extension SourceType {
63-
public struct Codecs: Sendable, Equatable, ExpressibleByBooleanLiteral {
63+
public struct Codecs: Sendable, Hashable, ExpressibleByBooleanLiteral {
6464
public var rawValue: Bool
6565

6666
public init(_ value: Bool) {

Sources/HTMLAttributeTypes/Attributes/Value.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
/// <option value="mx">Mexico</option>
7474
/// </select>
7575
/// ```
76-
public struct Value<Element: Sendable & Equatable>: HTMLAttribute {
76+
public struct Value<Element: Sendable & Hashable>: HTMLAttribute {
7777
/// The name of the HTML attribute
7878
public static var attribute: String { "value" }
7979

0 commit comments

Comments
 (0)