1description("Test basic dom storage .clear() functionality."); 2 3function 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 28test("sessionStorage"); 29debug(""); 30debug(""); 31test("localStorage"); 32 33window.successfullyParsed = true; 34isSuccessfullyParsed(); 35