assert.false()

version added: 2.11

false( actual [, message ] )

A strict comparison that passes if the first argument is boolean false.

name description
actual Expression being tested
message (string) A short description of the assertion

Description

false() requires just one argument. If the argument evaluates to false, the assertion passes; otherwise, it fails.

This method is similar to the assertFalse() method found in xUnit-style frameworks.

true() can be used to explicitly test for a true value.

Examples

QUnit.test( "example", assert => {
  // success
  assert.false( false, "boolean false" );

  // failure
  assert.false( "foo", "non-empty string" );
  assert.false( "", "empty string" );
  assert.false( 0, "number zero" );
  assert.false( true, "boolean true" );
  assert.false( NaN, "NaN value" );
  assert.false( null, "null value" );
  assert.false( undefined, "undefined value" );
});