Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Latest commit

 

History

History
43 lines (34 loc) · 1.06 KB

false.md

File metadata and controls

43 lines (34 loc) · 1.06 KB
layout title excerpt groups redirect_from version_added
page-api
assert.false()
A strict boolean false comparison.
assert
/assert/false/
2.11.0

false( actual, message = "" )

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

name description
actual Expression being tested
message (string) Short 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.

assert.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');
});