Search code examples
dartdart-unittest

Is there a regex matcher in the test package


I have an element like <span class="percent-complete-bar" style="width: 85%; background: green;"></span> and I want to check if the style attribute contains width: xx%; with a regex like r'width: \d{1,3}%;'

await bar.attributes['style']

returns width: 85%; background: green;


Solution

  • expect(await bar.attributes['style'], matches(r'width: \d{1,3}%;'));