qunit-assert-nodes

A QUnit plugin providing a convenient API for batch acceptance assertions

npm install qunit-assert-nodes
8 downloads in the last month

QUnit Nodes assertion plugin

Build Status NPM version

The plugin provides a convenient API for batch acceptance assertions

Usage

assert.nodes( batch );

Where batch is an array of assertion request objects, each of the following structure:

{
    node: node /* node reference */,
    assert: "exists" /*  one of exists, visible, hidden, checked */,
    message: "success" /* Assertion result message */
}

Example

test( "Components availability", function( assert ) {
    assert.nodes([
        {node: $("section.example"),
            assert: "exists",
            message: "Body contains section.example"
        },
        {node: $("#save-btn"),
            assert: "visible",
            message: "Save button is visible"
        },
        {node: $("#save-as-xml"),
            assert: "checked",
            message: "'Save as XML' option is checked"
        }
    ]);
});

For more examples, refer to the unit tests.

githalytics.com alpha

npm loves you