qunit-dom icon indicating copy to clipboard operation
qunit-dom copied to clipboard

High Level DOM Assertions for QUnit

Results 60 qunit-dom issues
Sort by recently updated
recently updated
newest added

For readability it would be awesome, if we could chain `.dom()` method calls: ```js assert .dom('h1") .exists('renders a first-level headline') .hasText('My Blog Post', 'renders title of blog post as headline')...

I verified this works by testing against a local codebase with failing and passing test cases.

enhancement

`hasAria()` currently delegates to `hasAttribute()`, but the `arguments.length` check in `hasAttribute()` does not work correctly, which makes `hasAria('disabled')` crash.

bug

I found a need for this, as the existing apis felt cumbersome for testing multiple classes. Thoughts?

## The bug Consider this element: ```html ``` The following assertion does not work: ```js assert.dom('div').hasStyle({ '--my-var': 123 }); ``` Since `hasStyle` is implemented with `getComputedStyle` and `getComputedStyle` returns styles...

we often write assertions in ember-land like this: ```js const i18n = this.owner.lookup('service:i18n') assert.dom('[data-test-foo'] .hasText(i18n.t('Some.Key')) ``` This test fails because `i18n.t('Some.Key')` is not a string and a TypeError is thrown:...

As suggested in https://github.com/simplabs/qunit-dom/issues/915#issuecomment-868330633, this PR adds a `withAriaSupport` option, so that [`aria-*`](https://www.w3.org/TR/wai-aria-1.1/#state_prop_def) options are considered. If not explicitly set, it defaults to `false` for all assertions, except for `isChecked`...

A `doesNotHaveProperty` method is referenced in the doc for `hasProperty`[1], but an implementation for it does not appear to exist anywhere. --- [1] https://github.com/simplabs/qunit-dom/blob/master/API.md#hasproperty

bug

The current isVisible considers elements with `opacity: 0` to be visible. This seems wrong.

bug

Extend `qunit.dom()` to accept an object with an `elements` property so external objects that have their own DOM querying implementation like page objects can be plugged into `qunit-dom`'s assertion API....

enhancement