File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,17 @@ export class ElementAssertion<T extends Element> extends Assertion<T> {
91
91
} ) ;
92
92
}
93
93
94
+ /**
95
+ * Check if the element has a specific class or classes.
96
+ *
97
+ * Validates that the provided element contains specified classes.
98
+ * Allows checking for one or more class names and supports exact matching.
99
+ *
100
+ * @param classNames - A single class name or an array of class names to check.
101
+ * @param options - Optional settings for matching:
102
+ * - `exact` (boolean): When true, checks for an exact match of all classes.
103
+ * @returns the assertion instance.
104
+ */
94
105
public toHaveClass ( classNames : string | string [ ] , options : { exact ?: boolean ; } = { } ) : this {
95
106
const actualClassList = this . actual . className . split ( / \s + / ) . filter ( Boolean ) ;
96
107
const expectedClassList = Array . isArray ( classNames ) ? classNames : [ classNames ] ;
You can’t perform that action at this time.
0 commit comments