Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLBaseElement/script-tests/multiple-base-elements.js

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 description('Test the behavior of multiple base elements.');
2
3 var originalBase = document.URL.replace(/[^/]*$/, "");
4
5 function clean(url)
6 {
7 if (url.length < originalBase.length)
8 return url;
9 if (url.substring(0, originalBase.length) !== originalBase)
10 return url;
11 return "http://originalbase.com/" + url.substring(originalBase.length);
12 }
13
14 var anchor = document.createElement('a');
15 anchor.href = "file";
16
17 document.body.appendChild(anchor);
18
19 shouldBe("clean(anchor.href)", "'http://originalbase.com/file'");
20
21 var base = document.createElement('base');
22 base.href = "http://domain.com/base/";
23
24 shouldBe("document.head.appendChild(base), clean(anchor.href)", "'http://domain. com/base/file'");
25 shouldBe("base.href = 'http://domain.com/base-changed/', clean(anchor.href)", "' http://domain.com/base-changed/file'");
26 shouldBe("document.head.removeChild(base), clean(anchor.href)", "'http://origina lbase.com/file'");
27
28 base.href = "http://domain.com/base/";
29
30 var base2 = document.createElement('base');
31 base2.href = "http://domain.com/base2/";
32
33 var base3 = document.createElement('base');
34 base3.href = "http://domain.com/base3/";
35
36 shouldBe("document.head.appendChild(base), document.head.appendChild(base2), cle an(anchor.href)", "'http://domain.com/base/file'");
37 shouldBe("base.removeAttribute('href'), clean(anchor.href)", "'http://domain.com /base2/file'");
38 shouldBe("document.head.appendChild(base3), clean(anchor.href)", "'http://domain .com/base2/file'");
39
40 document.head.removeChild(base);
41 document.head.removeChild(base2);
42 document.head.removeChild(base3);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698