| 191 |
191 |
assert_no_selector '.add_attachment', :visible => true
|
| 192 |
192 |
end
|
| 193 |
193 |
|
|
194 |
def test_pasting_image_beyond_max_attachments_at_once_should_show_error
|
|
195 |
set_tmp_attachments_directory
|
|
196 |
log_user('jsmith', 'jsmith')
|
|
197 |
|
|
198 |
Redmine::Configuration.with('max_attachments_at_once' => 2) do
|
|
199 |
visit '/projects/ecookbook/issues/new'
|
|
200 |
end
|
|
201 |
paste_image = lambda do
|
|
202 |
page.execute_script(<<~JS)
|
|
203 |
// 1x1 1-bit grayscale PNG image
|
|
204 |
const png = Uint8Array.from(atob('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQAAAAA3bvkkAAAACklEQVR42mNgAAAAAgAB5Sfe/AAAAABJRU5ErkJggg=='), c => c.charCodeAt(0));
|
|
205 |
const clipboardData = new DataTransfer();
|
|
206 |
clipboardData.items.add(new File([png], 'image.png', { type: 'image/png' }));
|
|
207 |
const event = new Event('paste', { bubbles: true, cancelable: true });
|
|
208 |
Object.defineProperty(event, 'clipboardData', { value: clipboardData });
|
|
209 |
document.getElementById('issue_description').dispatchEvent(event);
|
|
210 |
JS
|
|
211 |
end
|
|
212 |
2.times { paste_image.call }
|
|
213 |
assert_selector '.attachments_fields > span', :count => 2
|
|
214 |
accept_alert(/maximum number of files that can be attached simultaneously \(2\)/) do
|
|
215 |
paste_image.call
|
|
216 |
end
|
|
217 |
assert_selector '.attachments_fields > span', :count => 2
|
|
218 |
end
|
|
219 |
|
| 194 |
220 |
def test_create_issue_with_new_target_version
|
| 195 |
221 |
log_user('jsmith', 'jsmith')
|
| 196 |
222 |
|