Assert that an element matches the given selector.

var element = createElement(`
  <button data-test-id="publish" class="primary" disabled>
    Publish
  </button>
`);
 
expect(element, 'to match', 'button:disabled');
expect(element, 'to match', '[data-test-id=publish]');
expect(element, 'to match', '.primary');

In case of a failing expectation you get the following output:

expect(element, 'to match', '[data-test-id=approve]');
expected
<button data-test-id="publish" class="primary" disabled>
  
Publish
</button>
to match '[data-test-id=approve]'

You can also assert that an element does not match a given selector:

expect(element, 'not to match', '.default');