blob: 1d81f53917437ef0fc9acd5dff77e6866c2144f8 [file] [log] [blame]
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>WebStorage Test: Storage - clear()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
["localStorage", "sessionStorage"].forEach(function(name) {
test(function() {
var storage = window[name];
storage.clear();
storage.setItem("name", "user1");
assert_equals(storage.getItem("name"), "user1");
assert_equals(storage.name, "user1");
assert_equals(storage.length, 1);
storage.clear();
assert_equals(storage.getItem("name"), null, "storage.getItem('name')");
assert_equals(storage.name, undefined, "storage.name");
assert_equals(storage.length, 0, "storage.length");
}, "Clear in " + name);
});
</script>