Skip to content

Commit

Permalink
Prefix test-related session-storage items to make removal more specif…
Browse files Browse the repository at this point in the history
…ic. Fixes #213 - Keep hide-passed state when clearing session storage
  • Loading branch information
jzaefferer committed Mar 10, 2012
1 parent 5d90742 commit 8543081
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions qunit/qunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ Test.prototype = {
// store result when possible
if ( QUnit.config.reorder && defined.sessionStorage ) {
if (bad) {
sessionStorage.setItem("qunit-" + this.module + "-" + this.testName, bad);
sessionStorage.setItem("qunit-test-" + this.module + "-" + this.testName, bad);
} else {
sessionStorage.removeItem("qunit-" + this.module + "-" + this.testName);
sessionStorage.removeItem("qunit-test-" + this.module + "-" + this.testName);
}
}

Expand Down Expand Up @@ -255,7 +255,7 @@ Test.prototype = {
});
}
// defer when previous test run passed, if storage is available
var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-" + this.module + "-" + this.testName);
var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-test-" + this.module + "-" + this.testName);
if (bad) {
run();
} else {
Expand Down Expand Up @@ -874,7 +874,7 @@ function done() {
// clear own sessionStorage items if all tests passed
if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) {
for (var key in sessionStorage) {
if (sessionStorage.hasOwnProperty(key) && key.indexOf("qunit-") === 0 ) {
if (sessionStorage.hasOwnProperty(key) && key.indexOf("qunit-test-") === 0 ) {
sessionStorage.removeItem(key);
}
}
Expand Down

0 comments on commit 8543081

Please sign in to comment.