Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

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

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
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
trueBoolean_global.hasOwnProperty(key) == trueThe key is defined on the global object.1.0
falseBoolean_global.hasOwnProperty(key) == falseThe key is missing from the global object.1.0

Example

Code Block
themeRDark
languagejavascript
linenumberstrue
Test("InequalityNative checks", Test.ANY( ), function() {
	// assertion will pass
	hasNative( "Math", "Math exists?" );
	// assertion will fail (case-sensitive)
	equalhasNative( "math", "math exists?" );
});
Div
classbox
Availability
Status
colourGreen
titleStable

Requires:

Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

Test API

Topics:

Child pages (Children Display)
alltrue
depthall
pageTest API
excerpttrue