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

Side by Side Diff: LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-searchParams.js

Issue 143313002: Implement URLSearchParams. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 4 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
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-searchParams.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 description('Test handling of the searchParams attribute of the URL in HTMLAncho rElement.');
2
3 var a = document.createElement('a');
4
5 debug("Inspect single name-value via searchParams");
6 a.href = "https://www.mydomain.com/path/?key=value";
7 shouldBeTrue("a.searchParams.has('key')");
8 shouldBeEqualToString("a.searchParams.get('key')", "value");
9 shouldBeEqualToString("a.href", "https://www.mydomain.com/path/?key=value");
10
11 debug("Add name-value pair using searchParams");
12 a.href = "https://www.mydomain.com/path/";
13 a.searchParams.append("k e y", "value");
14 shouldBeTrue("a.searchParams.has('k e y')");
15 shouldBeEqualToString("a.searchParams.get('k e y')", "value");
16 shouldBeEqualToString("a.search", "?k+e+y=value");
17 shouldBeEqualToString("a.href", "https://www.mydomain.com/path/?k+e+y=value");
18
19 debug("Update name-value pair using searchParams");
20 a.href = "https://www.mydomain.com/path/?key=value";
21 a.searchParams.set("key", "newvalue");
22 shouldBeTrue("a.searchParams.has('key')");
23 shouldBeEqualToString("a.searchParams.get('key')", "newvalue");
24 shouldBeEqualToString("a.search", "?key=newvalue");
25 shouldBeEqualToString("a.href", "https://www.mydomain.com/path/?key=newvalue");
26
27 debug("Remove name-value pair using searchParams");
28 a.href = "https://www.mydomain.com/path/?key=value";
29 a.searchParams.delete("key");
30 shouldBeFalse("a.searchParams.has('key')");
31 shouldBeEqualToString("a.search", "");
32 shouldBeEqualToString("a.href", "https://www.mydomain.com/path/?");
33
34 debug("Have searchParams reflect removed name-value pairs");
35 a.href = "https://www.mydomain.com/path/?key=value";
36 var searchParams = a.searchParams;
37 shouldBeTrue("searchParams.has('key')");
38 a.search = "";
39 shouldBeFalse("searchParams.has('key')");
40 shouldBeEqualToString("a.href", "https://www.mydomain.com/path/?");
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-searchParams.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698