Sorry unit tests are busted at the moment... :'  (

<<  BACK to main table of contents.

Run all unit tests

Contents:

Notes





TOP [err stats] [reset]     Demonstrations of utility.js functions and capabilities

These tests either "crsh", give an alert box (due to a fundamental error, beyond even a crash), or do nothing (when "successful" according to the function).

Test crsh

Message:
Error code: 0 and [nothing] are unallowed. Try them and see. Note that an code of "undefined" is a string and not truly undefined.
            (You must press the BACK button to return)

Test ciMissing

Is provided:
Value to provide: Ignored if "Is provided" is unchecked.
Calling file-plus-function:
Parameter name:
            (You must press the BACK button to return)




TOP     Test my sanity

Thanks to Laurent Vallis, I realize I fundametally erred in regards to the differences between null, undefined, zero, empty string, 'undefined', 'null', and [anything else which is defined]. Check out the source for runAllSanityTests() to see how I've tried to verify the differences.

Run all sanity tests

0, '', ""

Zero, single and double quotes are all defined and equal to false but do not equal each other. Makes no sense, right? I thought so, too.

Uncreated and undefined

I distinguish between 'uncreated' and 'undefined'. 'Undefined' is simply not enough to describe all situations. To say that sMyVariable is "uncreated", means that neither 'var sMyVariable;' or 'var sMyVariable = 'whatever';' exist in your code. To say that a variable is "undefined" means the variable has been created, but has not yet been assigned a value.

Take this entire html file, which crashes with 'Error: sMyVariable is not defined':

<HTML><BODY>
   View the source
   <SCRIPT LANGUAGE="JavaScript1.3">
   //<!---
      alert("sMyVariable='" + sMyVariable + "'");
   //--->
   </SCRIPT>
</BODY></HTML>

However, when 'var sMyVariable...' exists in your code, before or after (regardless if a value is defined), then you can reference sMyVariable anywhere else, even before the 'var' line. Take the following HTML files, neither of which crash. They both successfully output "sMyVariable='undefined'" in an alert box:

<HTML><BODY>
   View the source
   <SCRIPT LANGUAGE="JavaScript1.3">
   //<!---
      var sMyVariable;
      alert("sMyVariable='" + sMyVariable + "'");
   //--->
   </SCRIPT>
</BODY></HTML>

<HTML><BODY>
   View the source
   <SCRIPT LANGUAGE="JavaScript1.3">
   //<!---
      alert("sMyVariable='" + sMyVariable + "'");
      var sMyVariable;
   //--->
   </SCRIPT>
</BODY></HTML>





TOP [err stats] [reset]     Demonstrations and tests of SIFmt-attributes (sMsgTxt*)





TOP     Attribute and Object compatibility

Each validate_form.js attribute has restrictions to which object types (form, text, ...) they may be associated; this is called Object Compatibility. Each attribute also has restrictions to which other attributes may be associated to that element at the same time; this is called Attribute Compatibility.

All 'x'-s, 'X'-s and 'c'-s are clickable, triggering a single unit test.

# Attribute Object Compatibility
Run every possible test
  Attribute Compatibility (#)
Run every possible test
0 1 2 3 4 5 6 7 8 9 10 11 12 13..
0 sMsgRequired X c c c c n/a c c c c c x c c c x c c c
1 sMsgTxtDec X c X X X c n/a X X c x x c c c x c c X
2 sMsgTxtEmail X c X X X c X n/a X c x x c c c x c c X
3 sMsgTxtInt X c X X X c X X n/a X x x c c c x c c X
4 sMsgBadLength X c c X X c c c X n/a x x c c c x c c X
5 sMsgMCRange X X X X c c x x x x n/a x x x x x x x x
6 asGlobalBadSubStrs c X X X X x x x x x x n/a x x x c x x x
7 bsNoBadSubStrs X c c X X c c c c c x x n/a X X x c c c
8 asBadSubStrs X c c X X c c c c c x x X n/a c x c c c
9 sMsgBadSubStr X c c X X c c c c c x x X c n/a x c c c
10 bsGlobalTrimSpaces c X X X X x x x x x x c x x x n/a x x x
11 bsTrimSpaces X c c X X c c c X c x x c c c x n/a X X
12 bsDontTrimSpaces X c c X X c c c X c x x c c c x X n/a X
13.. sMsgTxt* X c X X X c X X X X x x c c c x X X n/a

Key for Object Compatibility

What crsh() Code Notes
X vf.ciai1 The attribute may not be associated to this object type.
c none The attribute may be associated to this object type.

Key for Attribute Compatibility

What crsh() Code Notes
x vf.ciai1 Exactly one of the attributes is associated to an object type that it should not be.
X vf.ciai2 Both attributes, individually, are object-compatible with the object's type, but it is illegal for both these attributes to be associated to it at the same time..
c none The attributes are both object- and attribute-compatible.

Notes:




TOP     Test util_string.js





TOP [err stats] [reset]     validate_form.cibSprWSbRng() main developer errors

For further information on the issues dealt with in this section, see the header documentation for validate_form.cibSprWSbRng(), located at the bottom of the "PRIVATE FUNCTIONS" section in that file.

Unit test everything in this table

DEVELOPER ERROR Bound Provided? Super attribute tested
sMsgBadLength sMsgTxtInt sMsgTxtDec sMsgMCRange
min max txt txa txt txt chk slm
Bound exists, but super attribute does not x   go go go go go go
  x go go go go go go
x x go go go go go go
Super attribute exists (as it does for all the below tests in this table), but sub bounds don't.     go go n/a n/a go go
Minimum bound is greater than maximum bound. x x go go go go go go
Bound is a string. x   go go go go go go
  x go go go go go go
x x go go go go go go
Bound is a decimal. x   go go go n/a go go
  x go go go n/a go go
x x go go go n/a go go
Bound is zero (one too low). x   n/a n/a n/a n/a go go
  x n/a n/a n/a n/a go go
x x n/a n/a n/a n/a go go
Bound is negative one (two too low). x   n/a n/a n/a n/a go go
  x n/a n/a n/a n/a go go
x x n/a n/a n/a n/a go go
Bound is negative ten. x   n/a n/a n/a n/a go go
  x n/a n/a n/a n/a go go
x x n/a n/a n/a n/a go go
Bound is six (one too high). x   n/a n/a n/a n/a go go
  x n/a n/a n/a n/a go go
x x n/a n/a n/a n/a go go
Bound is fifty (way too high). x   n/a n/a n/a n/a go go
  x n/a n/a n/a n/a go go
x x n/a n/a n/a n/a go go




TOP [err stats] [reset]     Special validate_form.cibSprWSbRng() errors: text.sMsgBadLength and sanity checks

For further information on the issues dealt with in this section, see the header documentation for validate_form.cibSprWSbRng(), located at the bottom of the "PRIVATE FUNCTIONS" section in that file.

Unit test everything in this section

text.sMsgBadLength

Note that text and password elements are special because they also can have the default HTML MAXLENGTH attribute, in addition to iMaxLength When both iMinLength and MAXLENGTH are provided, iMinLength may not be greater than MAXLENGTH.

Sanity checks

The following list demonstrates sanity checks only, there is nothing here a developer should ever encounter:


Demo forms for testing

form_oneofeach






form_textarea
form_text

form_checkbox
form_selectmultiple