All Projects → workmanw → ember-qunit-assert-helpers

workmanw / ember-qunit-assert-helpers

Licence: MIT license
An ember-addon that provides additional QUnit 2.0 assertions specific to Ember.js.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to ember-qunit-assert-helpers

ember-airtable
Boilerplate for quickly prototyping apps with Airtable, Node & Ember
Stars: ✭ 21 (+75%)
Mutual labels:  ember, ember-addon
Ember Service Worker
A pluggable approach to Service Workers for Ember.js
Stars: ✭ 227 (+1791.67%)
Mutual labels:  ember, ember-addon
Ember Models Table
Table with pagination, sorting, filtering and much more
Stars: ✭ 212 (+1666.67%)
Mutual labels:  ember, ember-addon
Ember Tooltips
Easy and extendible tooltips for Ember components - http://sir-dunxalot.github.io/ember-tooltips/
Stars: ✭ 205 (+1608.33%)
Mutual labels:  ember, ember-addon
ember-pipeline
Railway oriented programming in Ember
Stars: ✭ 17 (+41.67%)
Mutual labels:  ember, ember-addon
ember-emojione
EmojiOne helper and components for your Ember App
Stars: ✭ 16 (+33.33%)
Mutual labels:  ember, ember-addon
Ember Font Awesome
ember-cli addon for using Font Awesome icons in Ember apps
Stars: ✭ 225 (+1775%)
Mutual labels:  ember, ember-addon
Ember Cli Addon Docs
Easy, beautiful docs for your OSS Ember addons
Stars: ✭ 162 (+1250%)
Mutual labels:  ember, ember-addon
ember-cli-nouislider
{{range-slider}} component for ember-cli powered by noUiSlider
Stars: ✭ 43 (+258.33%)
Mutual labels:  ember, ember-addon
Ember Graphql Adapter
GraphQL adapter for Ember Data
Stars: ✭ 244 (+1933.33%)
Mutual labels:  ember, ember-addon
ember-template-inspector
An ember add-on which opens the template file in the code editor while inspecting an element.
Stars: ✭ 15 (+25%)
Mutual labels:  ember, ember-addon
ember-right-click-menu
An easy and flexible addon to add context menus anywhere in your application
Stars: ✭ 14 (+16.67%)
Mutual labels:  ember, ember-addon
Emberx Select
Select component for Ember based on the native html select element.
Stars: ✭ 202 (+1583.33%)
Mutual labels:  ember, ember-addon
ember-cli-qunit
QUnit testing package for ember-cli applications
Stars: ✭ 29 (+141.67%)
Mutual labels:  ember, qunit
Ember Cli Notifications
⚛ Atom inspired notification messages for ember-cli
Stars: ✭ 168 (+1300%)
Mutual labels:  ember, ember-addon
Ember Cli Document Title
Adding document title behaviour to your ember app
Stars: ✭ 220 (+1733.33%)
Mutual labels:  ember, ember-addon
Ember Form For
Stars: ✭ 136 (+1033.33%)
Mutual labels:  ember, ember-addon
Ember Table
opensource.addepar.com/ember-table/
Stars: ✭ 1,695 (+14025%)
Mutual labels:  ember, ember-addon
Ember Lifeline
An Ember addon for managing the lifecyle of asynchronous behavior in your objects
Stars: ✭ 241 (+1908.33%)
Mutual labels:  ember, ember-addon
ember-data-contentful
Ember Data adapter for contentful.com
Stars: ✭ 33 (+175%)
Mutual labels:  ember, ember-addon

ember-qunit-assert-helpers

This addon provides additional QUnit 2.0 assertions that are specific to Ember.js. It is meant to be a replacement for ember-dev which only supports QUnit 1.0.

Can be use in your application or an addon.

Installation

ember install ember-qunit-assert-helpers

Compatibility

This addon relies on functionality introduced in Ember 2.1. If you need support for Ember 2.0 and old, please also include ember-debug-handlers-polyfill.

Usage

Ember.assert Assertions

assert.expectAssertion(callback, matcher)

Asserts that Ember.assert did throw an error. An optional string or regular expression matcher can be provided to match a specific error message.

test('triggers Ember.assert', function(assert) {
  assert.expectAssertion(() => {
    // Code triggers Ember.assert
  });

  assert.expectAssertion(() => {
    Ember.assert('You forgot "bar", the required parameter');
  }, /You forgot "\w+", the required parameter/);
})

Ember.run Assertions

assert.expectNoRunLoop()

Asserts that there is not a current run loop running and there are no scheduled timers. If there are, they will be cleaned up.

test('`Ember.deprecate` was called anytime during the test and matched', function(assert) {
  Ember.run.later(() => { });
  assert.expectNoRunLoop(); // Fail
});

Ember.deprecate Assertions

assert.expectDeprecation(callback, matcher)

Asserts that Ember.deprecate was called. An optional callback can be provided. An optional string or regular expression matcher can also be provided.

test('`Ember.deprecate` was called anytime during the test', function(assert) {
  // ...

  // One or more deprecations were triggered since the start of this test
  assert.expectDeprecation();
});

test('`Ember.deprecate` was called in a callback', function(assert) {
  assert.expectDeprecation(() => {
    // Code triggers one or more Ember.deprecate
  });
});

test('`Ember.deprecate` was called anytime during the test and matched', function(assert) {
  // ...

  // One or more deprecations matching a specific message were triggered since the start of this test
  assert.expectDeprecation(/expected deprecation message/);
});

test('`Ember.deprecate` was called in a callback', function(assert) {
  assert.expectDeprecation(() => {
    Ember.deprecate('API is deprecated', false, {
      id: 'old-api',
      until: '3.0.0'
    })
  }, 'API is deprecated');
});

assert.expectNoDeprecation(callback, matcher)

Asserts that Ember.deprecate was not called. An optional callback can be provided. An optional matcher can also be provided.

test('`Ember.deprecate` was not called anytime during the test', function(assert) {
  // ...

  // No deprecations were triggered since the start of this test
  assert.expectNoDeprecation();
});

Ember.warn Assertions

Same as Ember.deprecate, but for warnings. Above code samples can be applied here.

assert.expectWarning(callback, matcher)

Asserts that Ember.warn was called. An optional callback can be provided. An optional matcher can also be provided.

assert.expectNoWarning(callback, matcher)

Asserts that Ember.warn was not called. An optional callback can be provided. An optional matcher can also be provided.

afterEach asserting

You can easily use these asserts in your afterEach.

moduleForComponent('x-foo', {
  integration: true,
  afterEach(assert) {
    assert.expectNoDeprecation();
    assert.expectNoRunLoop();
    assert.expectNoWarning();
  }
});

Thanks and Credit

Thanks to Robert Jackson (@rwjblue) for providing guidance on the implementation.

Credit goes ember-dev and CrowdStrike for the overall concept and much the API provided by this addon.

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].