4 <script src=
"../../resources/js-test.js"></script>
9 border:
5px solid blue;
13 <body onload=
"runTest()">
14 <p id=
"description"></p>
15 <div contenteditable=true
id=
"target"></div>
16 <div><img id=
"source" src=
"resources/apple.gif" alt=
"alt-text" itemprop=
"somedata" arbitrary=
"green"></div>
17 <div id=
"console"></div>
20 description('This test verify dragging an image in the page keeps its attributes. To test manually, drag the image and drop it in the rect with a blue border.');
21 var jsTestIsAsync
= true;
22 var target
= document
.getElementById('target');
24 function contentInserted() {
25 shouldBe('target.getElementsByTagName("img").length', '1');
26 shouldBe('target.getElementsByTagName("img")[0].attributes.length', '5');
27 shouldBeEqualToString('target.getElementsByTagName("img")[0].id', 'source');
28 shouldBeEqualToString('target.getElementsByTagName("img")[0].alt', 'alt-text');
29 shouldBeEqualToString('target.getElementsByTagName("img")[0].attributes["itemprop"].value', 'somedata');
30 shouldBeEqualToString('target.getElementsByTagName("img")[0].attributes["arbitrary"].value', 'green');
36 target
.addEventListener('DOMNodeInserted', contentInserted
, false);
37 if (!window
.testRunner
)
40 testRunner
.waitUntilDone();
42 e
= document
.getElementById("source");
43 x
= e
.offsetLeft
+ e
.offsetWidth
/ 2;
44 y
= e
.offsetTop
+ e
.offsetHeight
/ 2;
46 eventSender
.mouseMoveTo(x
, y
);
47 eventSender
.mouseDown();
48 eventSender
.leapForward(100);
49 e
= document
.getElementById("target");
50 x
= e
.offsetLeft
+ e
.offsetWidth
/ 2;
51 y
= e
.offsetTop
+ e
.offsetHeight
/ 2;
53 eventSender
.mouseMoveTo(x
, y
);
54 eventSender
.mouseUp();