summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webstorage/storage_set_value_enumerate.window.js
blob: 09a55ad45480d2e9c7ca3e94984bd5e0aa3846ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var store_list = [
  ["key0", "value0"],
  ["key1", "value1"],
  ["key2", "value2"]
];
["localStorage", "sessionStorage"].forEach(function(name) {
  test(function () {
    var storage = window[name];
    storage.clear();

    store_list.forEach(function(item) {
      storage.setItem(item[0], item[1]);
    });

    for (var i = 0; i < store_list.length; i++) {
        var value = storage.getItem("key" + i);
        assert_equals(value, "value" + i);
    }
  }, "enumerate a " + name + " object with the key and get the values");
});