rniwa@webkit.org | e551449 | 2017-09-12 23:31:14 +0000 | [diff] [blame] | 1 | <!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] --> |
timothy_horton@apple.com | a0be1e1 | 2016-06-16 01:14:02 +0000 | [diff] [blame] | 2 | <html> |
| 3 | <script src="../../resources/js-test-pre.js"></script> |
timothy_horton@apple.com | a0be1e1 | 2016-06-16 01:14:02 +0000 | [diff] [blame] | 4 | <body> |
| 5 | <attachment id="wideAttachment" subtitle="VERY LONG SUBTITLE THAT WILL MAKE THE ATTACHMENT VERY WIDE"></attachment> |
| 6 | <attachment id="skinnyAttachment" subtitle="skinny but wider than icon"></attachment> |
| 7 | <attachment id="resizedAttachment" subtitle="skinny but wider than icon"></attachment> |
| 8 | <script> |
| 9 | description("This tests that attachments which resize will only grow in width, never shrink."); |
| 10 | |
| 11 | var wideAttachmentEl = document.getElementById("wideAttachment"); |
| 12 | var skinnyAttachmentEl = document.getElementById("skinnyAttachment"); |
| 13 | var resizedAttachmentEl = document.getElementById("resizedAttachment"); |
| 14 | |
| 15 | var wideAttachmentWidth = wideAttachmentEl.offsetWidth; |
| 16 | var skinnyAttachmentWidth = skinnyAttachmentEl.offsetWidth; |
| 17 | |
| 18 | function assert(value, description) |
| 19 | { |
| 20 | if (value) |
| 21 | testPassed(description); |
| 22 | else |
| 23 | testFailed(description); |
| 24 | } |
| 25 | |
| 26 | assert(wideAttachmentWidth > skinnyAttachmentWidth, "wideAttachmentWidth > skinnyAttachmentWidth"); |
| 27 | |
| 28 | assert(resizedAttachmentEl.offsetWidth == skinnyAttachmentWidth, "Attachment starts out skinny."); |
| 29 | |
| 30 | resizedAttachmentEl.setAttribute("subtitle", "VERY LONG SUBTITLE THAT WILL MAKE THE ATTACHMENT VERY WIDE"); |
| 31 | assert(resizedAttachmentEl.offsetWidth == wideAttachmentWidth, "Attachment resized from skinny to wide becomes wide."); |
| 32 | |
| 33 | resizedAttachmentEl.setAttribute("subtitle", "skinny but wider than icon"); |
| 34 | assert(resizedAttachmentEl.offsetWidth == wideAttachmentWidth, "Attachment resized from wide to skinny remains wide."); |
| 35 | |
| 36 | </script> |
| 37 | <script src="../../resources/js-test-post.js"></script> |
| 38 | </body> |
| 39 | </html> |