blob: c9c4e0b7e0feac0e3f111275a810a79a1177390c [file] [log] [blame]
rniwa@webkit.orge5514492017-09-12 23:31:14 +00001<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
timothy_horton@apple.coma0be1e12016-06-16 01:14:02 +00002<html>
3<script src="../../resources/js-test-pre.js"></script>
timothy_horton@apple.coma0be1e12016-06-16 01:14:02 +00004<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>
9description("This tests that attachments which resize will only grow in width, never shrink.");
10
11var wideAttachmentEl = document.getElementById("wideAttachment");
12var skinnyAttachmentEl = document.getElementById("skinnyAttachment");
13var resizedAttachmentEl = document.getElementById("resizedAttachment");
14
15var wideAttachmentWidth = wideAttachmentEl.offsetWidth;
16var skinnyAttachmentWidth = skinnyAttachmentEl.offsetWidth;
17
18function assert(value, description)
19{
20 if (value)
21 testPassed(description);
22 else
23 testFailed(description);
24}
25
26assert(wideAttachmentWidth > skinnyAttachmentWidth, "wideAttachmentWidth > skinnyAttachmentWidth");
27
28assert(resizedAttachmentEl.offsetWidth == skinnyAttachmentWidth, "Attachment starts out skinny.");
29
30resizedAttachmentEl.setAttribute("subtitle", "VERY LONG SUBTITLE THAT WILL MAKE THE ATTACHMENT VERY WIDE");
31assert(resizedAttachmentEl.offsetWidth == wideAttachmentWidth, "Attachment resized from skinny to wide becomes wide.");
32
33resizedAttachmentEl.setAttribute("subtitle", "skinny but wider than icon");
34assert(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>