Changeset 4921
- Timestamp:
- 09/03/06 18:52:33 (2 years ago)
- Files:
-
- spinoffs/scriptaculous/CHANGELOG (modified) (1 diff)
- spinoffs/scriptaculous/src/dragdrop.js (modified) (2 diffs)
- spinoffs/scriptaculous/test/unit/sortable_test.html (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinoffs/scriptaculous/CHANGELOG
r4889 r4921 1 1 *SVN* 2 3 * Make Sortable.serialize handle DOM IDs like "some_element_1" correctly, fixes #5324 2 4 3 5 * Add assertRespondsTo and shouldRespondTo assertions spinoffs/scriptaculous/src/dragdrop.js
r4855 r4921 575 575 576 576 var Sortable = { 577 SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, 578 577 579 sortables: {}, 578 580 … … 621 623 scrollSensitivity: 20, 622 624 scrollSpeed: 15, 623 format: /^[^_]*_(.*)$/,625 format: this.SERIALIZE_RULE, 624 626 onChange: Prototype.emptyFunction, 625 627 onUpdate: Prototype.emptyFunction spinoffs/scriptaculous/test/unit/sortable_test.html
r4101 r4921 38 38 </div> 39 39 40 <!-- 41 By default, _ is the only valid seperator 42 for the DOM ids. Complex element ids as in 43 the form of "some_element_id_1" should also 44 be parsed correctly (only the last part should 45 be serialized) 46 --> 47 <ul id="sortable_complex"> 48 <li id="a_b_item_1" class="a">item 1</li> 49 <li id="ab_item_2" class="c b">item 1 50 <ul> 51 <li id="item_99">!!!</li> 52 </ul> 53 </li> 54 <li id="a-b-item_3z_33" class="b">item 1</li> 55 <li id="a-item-xy" class="x y">item 1</li> 56 <!-- a comment --> 57 </ul> 58 59 40 60 <ul id="sortable_specialcreate"> 41 61 <li id="y1item">item 1</li> … … 60 80 Sortable.create('sortable_specialcreate',{ format:/(\d+)/ }); 61 81 Sortable.create('sortable_specialformat'); 82 Sortable.create('sortable_complex'); 62 83 }}, 63 84 … … 68 89 Sortable.destroy('sortable_specialformat'); 69 90 Sortable.destroy('sortable_specialcreate'); 91 Sortable.destroy('sortable_complex'); 70 92 }}, 71 93 72 94 testSortableSerializeSequenceBasics: function() { with(this) { 73 95 assertEqual('sortable1[]=1&sortable1[]=2&sortable1[]=3', Sortable.serialize('sortable1')); 96 74 97 // test empty sortable 75 98 assertEqual('', Sortable.serialize('sortable3')); … … 82 105 83 106 testSortableSerializeFormat: function() { with(this) { 84 // sh auld correctly serialize from option given to Sortable.create()107 // should correctly serialize from option given to Sortable.create() 85 108 assertEqual('sortable_specialcreate[]=1&sortable_specialcreate[]=2', 86 109 Sortable.serialize('sortable_specialcreate')); … … 101 124 assertEqual('sortable1[]=1&sortable1[]=2&sortable1[]=3', 102 125 Sortable.serialize('sortable1',{format:/^[^_]*_(.*)$/})); 126 127 // Ensure default options.format handles longer, more complex list 128 // item IDs 129 assertEqual('sortable_complex[]=1&sortable_complex[]=2&sortable_complex[]=33&sortable_complex[]=', 130 Sortable.serialize('sortable_complex')); 131 }}, 132 133 testSortableSerializeRule: function() { with(this) { 134 var ids = ['x','x-y','test_test','x_y_z','x_y-x_z']; 135 ids.each(function(id){ 136 assertEqual('1', 137 (id+'_1').match(Sortable.SERIALIZE_RULE)[1]); 138 }); 139 140 assertNull('x'.match(Sortable.SERIALIZE_RULE)); 103 141 }}, 104 142