All Projects → simplabs → Qunit Dom

simplabs / Qunit Dom

Licence: mit
High Level DOM Assertions for QUnit

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Qunit Dom

Ember Inspector
Adds an Ember tab to the browser's Developer Tools that allows you to inspect Ember objects in your application.
Stars: ✭ 936 (+541.1%)
Mutual labels:  ember, emberjs
Ember Octane Vs Classic Cheat Sheet
A cheat sheet for converting classic Ember app to Octane
Stars: ✭ 48 (-67.12%)
Mutual labels:  ember, emberjs
Ember Accessibility
An EmberJS addon to help identify accessibility violations during development
Stars: ✭ 29 (-80.14%)
Mutual labels:  ember, emberjs
Ember Runloop Handbook
A deep dive into the Ember JS runloop.
Stars: ✭ 367 (+151.37%)
Mutual labels:  ember, emberjs
Ember Styleguide
This is a UI addon that intends to help standardize the Ember family of websites and make it easier to make the Ember website an Ember app.
Stars: ✭ 69 (-52.74%)
Mutual labels:  ember, emberjs
Rfcs
RFCs for changes to Ember
Stars: ✭ 731 (+400.68%)
Mutual labels:  ember, emberjs
Docfy
Build fully personalized documentation sites; write content and demos in Markdown.
Stars: ✭ 48 (-67.12%)
Mutual labels:  ember, emberjs
ember-website
The emberjs.com website.
Stars: ✭ 61 (-58.22%)
Mutual labels:  ember, emberjs
Guides Source
This repository contains the Ember.js Guides
Stars: ✭ 130 (-10.96%)
Mutual labels:  ember, emberjs
Ember Cli Foundation 6 Sass
Stars: ✭ 65 (-55.48%)
Mutual labels:  ember, emberjs
Ember Apollo Client
🚀 An ember-cli addon for Apollo Client and GraphQL
Stars: ✭ 257 (+76.03%)
Mutual labels:  ember, emberjs
Super Rentals
Codebase for the Super Rentals official tutorial
Stars: ✭ 134 (-8.22%)
Mutual labels:  ember, emberjs
ember-render-helpers
Complimentary render template helpers to the render modifiers
Stars: ✭ 19 (-86.99%)
Mutual labels:  ember, emberjs
Pretzel
Javascript full-stack framework for Big Data visualisation and analysis
Stars: ✭ 26 (-82.19%)
Mutual labels:  ember, emberjs
ember-gridstack
Ember components to build drag-and-drop multi-column grids powered by gridstack.js
Stars: ✭ 31 (-78.77%)
Mutual labels:  ember, emberjs
Mber
Fast and minimal Ember.js CLI alternative, without broccoli.
Stars: ✭ 30 (-79.45%)
Mutual labels:  ember, emberjs
ember-deep-tracked
Deep auto-tracking for when you just don't care, and want things to work (at the cost of performance in some situtations)
Stars: ✭ 20 (-86.3%)
Mutual labels:  ember, emberjs
chat-app-v2
Shorter Chat App Demo
Stars: ✭ 14 (-90.41%)
Mutual labels:  ember, emberjs
Ember Api Docs
Ember API Docs viewer
Stars: ✭ 55 (-62.33%)
Mutual labels:  ember, emberjs
Ember Cli Bundle Analyzer
Analyze the size and contents of your Ember app's bundles
Stars: ✭ 78 (-46.58%)
Mutual labels:  ember, emberjs

qunit-dom

TravisCI Build Status Latest NPM release

High Level DOM Assertions for QUnit

assert.dom('h1').exists();
assert.dom('h1').hasClass('title');
assert.dom('h1').hasText('Welcome to Ember, John Doe!');

assert.dom('input').isFocused();
assert.dom('input').hasValue(/.+ Doe/);
assert.dom('input').hasAttribute('type', 'text');

Install

npm

npm install --save-dev qunit-dom

or using yarn:

yarn add --dev qunit-dom

Ember projects using ember-qunit v5.x and above

Import and run the setup function in your test-helper.js file:

// tests/test-helper.js
import * as QUnit from 'qunit';
import { setup } from 'qunit-dom';

//...

setup(QUnit.assert);

setApplication(Application.create(config.APP));

start();

//...

This will attach the APIs to QUnit's assert object.

Ember projects using ember-qunit v4.x and below

qunit-dom will automatically attach the APIs to QUnit's assert object. No extra setup required 🎉.

<script> Tag

Load qunit-dom.js after qunit.js:

<script src="https://unpkg.com/qunitjs/qunit/qunit.js"></script>
<script src="https://unpkg.com/qunit-dom/dist/qunit-dom.js"></script>

Usage

Once installed the DOM element assertions are available at assert.dom(...).*:

test('the title is welcoming', function(assert) {
  assert.dom('#title').hasText('Welcome to QUnit');
});

All available assertions are documented in API.md.

A basic codemod to automatically convert your assertions is available at https://github.com/simplabs/qunit-dom-codemod.

TypeScript

qunit-dom includes type definition files, but the way it extends QUnit means that you need import it somewhere so that TS and your editor can pick up the types. It is recommended to add the following line to your tests/test-helper.ts file:

import 'qunit-dom';

Rename your tests/test-helper.js to .ts if you do not have such a file yet.

Contributing

See CONTRIBUTING.md.

Related

  • chai-dom – DOM assertions for the Chai assertion library using vanilla JavaScript
  • chai-jquery – jQuery assertions for chai

License

qunit-dom is developed by and © simplabs GmbH and contributors. It is released under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].