hasAttribute function

Matcher hasAttribute(
  1. String selector,
  2. String attribute,
  3. dynamic value
)

Matches if an element matching selector has attribute with value.

value can be a String for exact match, or a Matcher for flexible matching.

expect(html, hasAttribute('a', 'href', '/home'));
expect(html, hasAttribute('img', 'alt', contains('photo')));

Implementation

Matcher hasAttribute(String selector, String attribute, dynamic value) =>
    _HasAttributeMatcher(selector, attribute, value);