Assert presence of a native property on the global object...

 

Syntax

hasNative( key, message );

Parameters

ParameterTypeMandatoryNotesAPI Version
keyString(tick)The name of the property to inspect.1.0
messageString

(tick) (<v1.4)

(error) (v1.4+)

A message stating what the assertion is testing.

As of v1.4, message defaults to: key+" defined"

1.0

1.4

Return Values

ValueTypeNotesAPI Version
<error>ErrorMost likely the parameters are wrong.1.0
trueBooleanThe key is defined on the global object.1.0
falseBooleanThe key is missing from the global object.1.0

Example

Test("Native checks", Test.ANY( ), function() {
	// assertion will pass
	hasNative( "Math", "Math exists?" );
	// assertion will fail (case-sensitive)
	hasNative( "math", "math exists?" );
});
Availability

Requires:

Contents

Jump to:

Test API

Topics: