Cleaned up formating of spec code.
Adds tests to cover handling of background changes to window.localStorage.