setupRenderingTest()

Configures a test that renders components into a test DOM container.

Since Ember 4/5 (Octane) Spec ↗

Syntax

setupRenderingTest(hooks)

Parameters

NameTypeRequiredDescription
hooks NestedHooks No The QUnit module hooks object.

Returns

void — Enables render() and DOM helpers for the module.

Examples

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, click } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Integration | Component | counter', function (hooks) {
  setupRenderingTest(hooks);

  test('it increments', async function (assert) {
    await render(hbs`<Counter />`);
    await click('button');
    assert.dom('button').hasText('Count: 1');
  });
});

Notes

Use for component integration tests. Provides render() and the assert.dom assertions. It is lighter than setupApplicationTest because no routing or full app boot occurs.