Defect #44556 » 7.0-stable.patch
| app/assets/javascripts/attachments.js | ||
|---|---|---|
| 350 | 350 |
// get input file in the closest form |
| 351 | 351 |
var inputEl = $(this).closest("form").find('input:file.filedrop');
|
| 352 | 352 |
handleFileDropEvent.target = e.target; |
| 353 |
addFile(inputEl, new File([file], filename, { type: file.type }), true);
|
|
| 353 |
if (addFile(inputEl, new File([file], filename, { type: file.type }), true) == null) {
|
|
| 354 |
window.alert(inputEl.data('max-number-of-files-message'));
|
|
| 355 |
break; |
|
| 356 |
} |
|
| 354 | 357 |
} |
| 355 | 358 |
} |
| 356 | 359 |
} |
| test/system/issues_test.rb | ||
|---|---|---|
| 174 | 174 |
assert_equal 'Some description', issue.attachments.first.description |
| 175 | 175 |
end |
| 176 | 176 | |
| 177 |
def test_pasting_image_beyond_max_attachments_at_once_should_show_error |
|
| 178 |
set_tmp_attachments_directory |
|
| 179 |
log_user('jsmith', 'jsmith')
|
|
| 180 | ||
| 181 |
visit '/projects/ecookbook/issues/new' |
|
| 182 |
paste_image = lambda do |
|
| 183 |
page.execute_script(<<~JS) |
|
| 184 |
// 1x1 1-bit grayscale PNG image |
|
| 185 |
const png = Uint8Array.from(atob('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQAAAAA3bvkkAAAACklEQVR42mNgAAAAAgAB5Sfe/AAAAABJRU5ErkJggg=='), c => c.charCodeAt(0));
|
|
| 186 |
const clipboardData = new DataTransfer(); |
|
| 187 |
clipboardData.items.add(new File([png], 'image.png', { type: 'image/png' }));
|
|
| 188 |
const event = new Event('paste', { bubbles: true, cancelable: true });
|
|
| 189 |
Object.defineProperty(event, 'clipboardData', { value: clipboardData });
|
|
| 190 |
document.getElementById('issue_description').dispatchEvent(event);
|
|
| 191 |
JS |
|
| 192 |
end |
|
| 193 |
10.times { paste_image.call }
|
|
| 194 |
assert_selector '.attachments_fields > span', :count => 10 |
|
| 195 |
accept_alert(/maximum number of files that can be attached simultaneously \(10\)/) do |
|
| 196 |
paste_image.call |
|
| 197 |
end |
|
| 198 |
assert_selector '.attachments_fields > span', :count => 10 |
|
| 199 |
end |
|
| 200 | ||
| 177 | 201 |
def test_create_issue_with_new_target_version |
| 178 | 202 |
log_user('jsmith', 'jsmith')
|
| 179 | 203 | |
- « Previous
- 1
- 2
- Next »