Changeset 1888


Ignore:
Timestamp:
2011-04-18 14:41:40 (13 months ago)
Author:
mpo
Message:

tests that falsify the claims in #453

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-basic-validators.js

    r1864 r1888  
    132132test("isEmail", function() { 
    133133 
    134     expect(10); 
     134    expect(13); 
    135135 
    136136    var v = getValidator("isEmail"); 
     
    145145    valueCheck(v, "root@localhost.localdomain", true); 
    146146    valueCheck(v, "INFO@EXAMPLE.ORG", true); 
     147    valueCheck(v, "sdf@…@sdf....sdfsdf----+++564|@@@@99;;;;;", false); 
     148    valueCheck(v, ".@", false); 
     149    valueCheck(v, "@.", false); 
    147150}); 
    148151 
     
    167170test("remote", function() { 
    168171 
    169         $.ajaxSetup({  
    170             async: false // testing execution mode never allows for parallel threads 
    171         });  
    172      
    173         // request security clearing for remote loading test on firefox 3 
    174         if (jQuery.browser.version == "1.9") // TODO see if we can test in some other way 
    175         { 
    176             try { 
    177                 netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); 
    178             } catch (e) { 
    179             } 
     172    $.ajaxSetup({  
     173        async: false // testing execution mode never allows for parallel threads 
     174    });  
     175 
     176    // request security clearing for remote loading test on firefox 3 
     177    if (jQuery.browser.version == "1.9") // TODO see if we can test in some other way 
     178    { 
     179        try { 
     180            netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); 
     181        } catch (e) { 
    180182        } 
    181  
    182         expect(9); 
    183  
    184         var v; 
    185         v = getValidator("remote", { 
    186             location :"bogus" 
    187         }); 
    188         valueCheck(v, undefined, true); 
    189         valueCheck(v, "", true); 
    190         valueCheck(v, 0, false, "Error while connecting to remote validation."); 
    191  
    192         v = getValidator("remote", { 
    193             async :false, 
    194             location :"./valid/ok.json" 
    195         }); 
    196         valueCheck(v, undefined, true); 
    197         valueCheck(v, "", true); 
    198         valueCheck(v, 0, true); 
    199  
    200         v = getValidator("remote", { 
    201             async :false, 
    202             location :"./valid/nok.json" 
    203         }); 
    204         valueCheck(v, undefined, true); 
    205         valueCheck(v, "", true); 
    206         valueCheck(v, 0, false); 
    207  
    208         $.ajaxSetup({async: true}); // reset 
    209  
    210     }); 
     183    } 
     184 
     185    expect(9); 
     186 
     187    var v; 
     188    v = getValidator("remote", { 
     189        location :"bogus" 
     190    }); 
     191    valueCheck(v, undefined, true); 
     192    valueCheck(v, "", true); 
     193    valueCheck(v, 0, false, "Error while connecting to remote validation."); 
     194 
     195    v = getValidator("remote", { 
     196        async :false, 
     197        location :"./valid/ok.json" 
     198    }); 
     199    valueCheck(v, undefined, true); 
     200    valueCheck(v, "", true); 
     201    valueCheck(v, 0, true); 
     202 
     203    v = getValidator("remote", { 
     204        async :false, 
     205        location :"./valid/nok.json" 
     206    }); 
     207    valueCheck(v, undefined, true); 
     208    valueCheck(v, "", true); 
     209    valueCheck(v, 0, false); 
     210 
     211    $.ajaxSetup({async: true}); // reset 
     212 
     213}); 
    211214 
    212215function valueCheck( comp, val, expectValue, expectMessage) { // value-checking component can be validator or field, ... 
Note: See TracChangeset for help on using the changeset viewer.