Changeset 2200:0b1f90d5bb2a
- Timestamp:
- 10/02/13 12:05:46 (12 years ago)
- Branch:
- default
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/common.js
r2187 r2200 280 280 $(e).append(document.createTextNode(' ')); 281 281 282 target = target || $(e).parents('form').find('input[type="checkbox"]'); 283 284 var a = document.createElement('a'); 285 a.href='#'; 286 $(a).append(document.createTextNode(dotclear.msg.select_all)); 287 a.onclick = function() { 282 $('<a href="#">'+dotclear.msg.select_all+'</a>').click(function() { 283 if (target === undefined) { 284 target = $(e).parents('form').find('input[type="checkbox"]'); 285 } 288 286 target.check(); 289 287 return false; 290 }; 291 $(e).append(a); 292 288 }).appendTo($(e)); 293 289 $(e).append(document.createTextNode(' | ')); 294 290 295 a = document.createElement('a');296 a.href='#';297 $(a).append(document.createTextNode(dotclear.msg.no_selection));298 a.onclick = function() {291 $('<a href="#">'+dotclear.msg.no_selection+'</a>').click(function() { 292 if (target === undefined) { 293 target = $(e).parents('form').find('input[type="checkbox"]'); 294 } 299 295 target.unCheck(); 300 296 return false; 301 }; 302 $(e).append(a); 303 297 }).appendTo($(e)); 304 298 $(e).append(document.createTextNode(' - ')); 305 299 306 a = document.createElement('a');307 a.href='#';308 $(a).append(document.createTextNode(dotclear.msg.invert_sel));309 a.onclick = function() {300 $('<a href="#">'+dotclear.msg.invert_sel+'</a>').click(function() { 301 if (target === undefined) { 302 target = $(e).parents('form').find('input[type="checkbox"]'); 303 } 310 304 target.toggleCheck(); 311 305 return false; 312 }; 313 $(e).append(a); 306 }).appendTo($(e)); 314 307 }, 315 308 -
tests/functional/js/fix_include.js
r1724 r2200 20 20 dotclear.msg.enhanced_uploader_disable = 'Temporarily disable enhanced uploader'; 21 21 22 dotclear.msg.to_select = 'Select:'; 23 dotclear.msg.select_all = 'select all'; 24 dotclear.msg.no_selection = 'no selection'; 25 dotclear.msg.invert_sel = 'invert selection'; -
tests/functional/spec/common.js
r1724 r2200 81 81 }); 82 82 }); 83 84 describe("checkboxesHelpers", function() { 85 it("Must add links to select all,none or invert selection", function() { 86 loadFixtures('entries_list.html'); 87 dotclear.checkboxesHelpers($('.checkboxes-helpers', '#form-entries')); 88 89 expect($('.checkboxes-helpers a', '#form-entries').length).toBe(3); 90 expect($('.checkboxes-helpers a:eq(0)', '#form-entries').text()).toBe(dotclear.msg.select_all); 91 expect($('.checkboxes-helpers a:eq(1)', '#form-entries').text()).toBe(dotclear.msg.no_selection); 92 expect($('.checkboxes-helpers a:eq(2)', '#form-entries').text()).toBe(dotclear.msg.invert_sel); 93 }); 94 95 it("Click all must select all checkboxes", function() { 96 loadFixtures('entries_list.html'); 97 dotclear.checkboxesHelpers($('.checkboxes-helpers', '#form-entries')); 98 99 $('.checkboxes-helpers a:eq(0)').click(); 100 expect($('#form-entries input[name="entries[]"]:checked').length).toBe(4); 101 }); 102 103 it("Click 'no selection' must uncheck all checkboxes", function() { 104 loadFixtures('entries_list.html'); 105 dotclear.checkboxesHelpers($('.checkboxes-helpers', '#form-entries')); 106 107 $('input[name="entries[]"]:eq(1)').click(); 108 $('input[name="entries[]"]:eq(3)').click(); 109 $('.checkboxes-helpers a:eq(1)').click(); 110 expect($('#form-entries input[name="entries[]"]:checked').length).toBe(0); 111 }); 112 113 it("Click invert must select all uncheck checkboxes", function() { 114 loadFixtures('entries_list.html'); 115 dotclear.checkboxesHelpers($('.checkboxes-helpers', '#form-entries')); 116 117 $('input[name="entries[]"]:eq(1)').click(); 118 $('.checkboxes-helpers a:eq(2)').click(); 119 expect($('#form-entries input[name="entries[]"]:checked').length).toBe(3); 120 expect($('input[name="entries[]"]:eq(0)')).toBeChecked(); 121 expect($('input[name="entries[]"]:eq(1)')).not.toBeChecked(); 122 expect($('input[name="entries[]"]:eq(2)')).toBeChecked(); 123 expect($('input[name="entries[]"]:eq(3)')).toBeChecked(); 124 }); 125 126 it("Must take in consideration checkbox added dynamically", function() { 127 loadFixtures('entries_list.html'); 128 dotclear.checkboxesHelpers($('.checkboxes-helpers', '#form-entries')); 129 130 $('<li><input type="checkbox" name="entries[]" value="5"/><p>title 5</p></li>').appendTo('#form-entries ul'); 131 132 $('.checkboxes-helpers a:eq(0)').click(); 133 expect($('#form-entries input[name="entries[]"]:checked').length).toBe(5); 134 }); 135 }); 83 136 });
Note: See TracChangeset
for help on using the changeset viewer.