Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 6312

Show
Ignore:
Timestamp:
03/04/07 18:04:35 (2 years ago)
Author:
mislav
Message:

illustrate a point because of #6900

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinoffs/prototype/branches/form/test/unit/form.html

    r6309 r6312  
    7070  <input type="text" name="twin" value="" /> 
    7171  <input type="text" name="twin" value="siamese" /> 
     72  <!-- Rails checkbox hack with hidden input: --> 
     73  <input type="checkbox" id="checkbox_hack" name="checky" value="1" /> 
     74  <input name="checky" type="hidden" value="0" /> 
    7275</form> 
    7376 
     
    282285      assertEqual('vu=1&vm%5B%5D=1&vm%5B%5D=3&nvu=One&nvm%5B%5D=One&nvm%5B%5D=Three&evu=&evm%5B%5D=&evm%5B%5D=Three', Form.serialize('form_selects')); 
    283286       
    284       // should not eat empty values for duplicate names  
    285       assertEnumEqual(['', 'siamese'], Form.serialize('form_array', true)['twin']) 
     287      // should not eat empty values for duplicate names 
     288      $('checkbox_hack').checked = false 
     289      var data = Form.serialize('form_array', true) 
     290      assertEnumEqual(['', 'siamese'], data['twin']) 
     291      assertEqual('0', data['checky']) 
     292      $('checkbox_hack').checked = true 
     293      assertEnumEqual($w('1 0'), Form.serialize('form_array', true)['checky']) 
    286294    }}, 
    287295