Yahoo! UI Library

yuitest  2.8.0r4

Yahoo! UI Library > yuitest > YAHOO.util.ArrayAssert
Search:
 
Filters

static Class YAHOO.util.ArrayAssert

The ArrayAssert object provides functions to test JavaScript array objects for a variety of cases.

Methods

contains

static void contains ( needle , haystack , message )
Asserts that a value is present in an array. This uses the triple equals sign so no type cohersion may occur.
Parameters:
needle <Object> The value that is expected in the array.
haystack <Array> An array of values.
message <String> (Optional) The message to display if the assertion fails.
Returns: void

containsItems

static void containsItems ( needles , haystack , message )
Asserts that a set of values are present in an array. This uses the triple equals sign so no type cohersion may occur. For this assertion to pass, all values must be found.
Parameters:
needles <Object[]> An array of values that are expected in the array.
haystack <Array> An array of values to check.
message <String> (Optional) The message to display if the assertion fails.
Returns: void

containsMatch

static void containsMatch ( matcher , haystack , message )
Asserts that a value matching some condition is present in an array. This uses a function to determine a match.
Parameters:
matcher <Function> A function that returns true if the items matches or false if not.
haystack <Array> An array of values.
message <String> (Optional) The message to display if the assertion fails.
Returns: void

doesNotContain

static void doesNotContain ( needle , haystack , message )
Asserts that a value is not present in an array. This uses the triple equals sign so no type cohersion may occur.
Parameters:
needle <Object> The value that is expected in the array.
haystack <Array> An array of values.
message <String> (Optional) The message to display if the assertion fails.
Returns: void

doesNotContainItems

static void doesNotContainItems ( needles , haystack , message )
Asserts that a set of values are not present in an array. This uses the triple equals sign so no type cohersion may occur. For this assertion to pass, all values must not be found.
Parameters:
needles <Object[]> An array of values that are not expected in the array.
haystack <Array> An array of values to check.
message <String> (Optional) The message to display if the assertion fails.
Returns: void

doesNotContainMatch

static void doesNotContainMatch ( matcher , haystack , message )
Asserts that no values matching a condition are present in an array. This uses a function to determine a match.
Parameters:
matcher <Function> A function that returns true if the items matches or false if not.
haystack <Array> An array of values.
message <String> (Optional) The message to display if the assertion fails.
Returns: void

indexOf

static void indexOf ( needle , haystack , index , message )
Asserts that the given value is contained in an array at the specified index. This uses the triple equals sign so no type cohersion will occur.
Parameters:
needle <Object> The value to look for.
haystack <Array> The array to search in.
index <int> The index at which the value should exist.
message <String> (Optional) The message to display if the assertion fails.
Returns: void

isEmpty

static void isEmpty ( actual , message )
Asserts that an array is empty.
Parameters:
actual <Array> The array to test.
message <String> (Optional) The message to display if the assertion fails.
Returns: void

isNotEmpty

static void isNotEmpty ( actual , message )
Asserts that an array is not empty.
Parameters:
actual <Array> The array to test.
message <String> (Optional) The message to display if the assertion fails.
Returns: void

itemsAreEqual

static void itemsAreEqual ( expected , actual , message )
Asserts that the values in an array are equal, and in the same position, as values in another array. This uses the double equals sign so type cohersion may occur. Note that the array objects themselves need not be the same for this test to pass.
Parameters:
expected <Array> An array of the expected values.
actual <Array> Any array of the actual values.
message <String> (Optional) The message to display if the assertion fails.
Returns: void

itemsAreEquivalent

static Void itemsAreEquivalent ( expected , actual , comparator , message )
Asserts that the values in an array are equivalent, and in the same position, as values in another array. This uses a function to determine if the values are equivalent. Note that the array objects themselves need not be the same for this test to pass.
Parameters:
expected <Array> An array of the expected values.
actual <Array> Any array of the actual values.
comparator <Function> A function that returns true if the values are equivalent or false if not.
message <String> (Optional) The message to display if the assertion fails.
Returns: Void

itemsAreSame

static void itemsAreSame ( expected , actual , message )
Asserts that the values in an array are the same, and in the same position, as values in another array. This uses the triple equals sign so no type cohersion will occur. Note that the array objects themselves need not be the same for this test to pass.
Parameters:
expected <Array> An array of the expected values.
actual <Array> Any array of the actual values.
message <String> (Optional) The message to display if the assertion fails.
Returns: void

lastIndexOf

static void lastIndexOf ( needle , haystack , index , message )
Asserts that the given value is contained in an array at the specified index, starting from the back of the array. This uses the triple equals sign so no type cohersion will occur.
Parameters:
needle <Object> The value to look for.
haystack <Array> The array to search in.
index <int> The index at which the value should exist.
message <String> (Optional) The message to display if the assertion fails.
Returns: void


Copyright © 2009 Yahoo! Inc. All rights reserved.