• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 description("Test basic dom storage .clear() functionality.");
2 
3 function test(storageString)
4 {
5     storage = eval(storageString);
6     if (!storage) {
7         testFailed(storageString + " DOES NOT exist");
8         return;
9     }
10 
11     debug("Testing " + storageString);
12 
13     evalAndLog("storage.clear()");
14     shouldBe("storage.length", "0");
15 
16     evalAndLog("storage['FOO'] = 'MyFOO'");
17     evalAndLog("storage['BAR'] = 'MyBar'");
18     shouldBe("storage.length", "2");
19     shouldBeEqualToString("storage['FOO']", "MyFOO");
20     shouldBeEqualToString("storage['BAR']", "MyBar");
21 
22     evalAndLog("storage.clear()");
23     shouldBe("storage.length", "0");
24     shouldBe("storage['FOO']", "undefined");  // FIXME: Wait...shouldn't this be null?
25     shouldBe("storage['BAR']", "undefined");  // ditto
26 }
27 
28 test("sessionStorage");
29 debug("");
30 debug("");
31 test("localStorage");
32 
33 window.successfullyParsed = true;
34 isSuccessfullyParsed();
35