Documentation

QUnit/ok

From jQuery JavaScript Library

Jump to: navigation, search

« Back to QUnit

ok( state, [message] )

A boolean assertion, equivalent to JUnit's assertTrue.
Arguments:
stateBoolean
A boolean expression, can be a boolean or any other type, its boolean default is evaluated.
message (Optional)String
A message to output with the assertion result.

Examples:
Add a test that contains a single assertions that is always true.

test("a test", function() {
  ok(true, "always fine");
  ok("", "empty string defaults to false, so this assertion fails");
});

NameType