Updated documentation
All checks were successful
Build / Build NPM Project (push) Successful in 36s
Build / Tag Version (push) Successful in 7s
Build / Publish (push) Successful in 16s

This commit is contained in:
2024-01-07 19:11:26 -05:00
parent 7a9ab68402
commit 034134a08f
10 changed files with 4055 additions and 182 deletions

View File

@ -1,7 +1,27 @@
import {LocalStorage, SessionStorage} from "../src";
const CUSTOM_KEY = '_MY_KEY'
// Mocks ===============================================================================================================
class StorageMock implements Storage {
private store: {[key: string]: string} = {}
get length() { return Object.keys(this.store).length; }
clear() { this.store = {}; }
getItem(key: string) { return this.store[key]; }
setItem(key: string, value: string) { this.store[key] = value; }
removeItem(key: string) { delete this.store[key]; }
key(index: number) { return Object.keys(this.store)[index]; }
}
(<any>global).localStorage = new StorageMock();
(<any>global).sessionStorage = new StorageMock()
var localStorage: StorageMock;
localStorage = (<any>global).localStorage;
var sessionStorage: StorageMock;
sessionStorage = (<any>global).sessionStorage;
// Test Data ===========================================================================================================
const CUSTOM_KEY = '_MY_KEY'
class TestType {
constructor(public first: string, public last: string) { }
fullName() { return `${this.last}, ${this.first}`; }
@ -18,6 +38,7 @@ class TestStorage {
@SessionStorage(new TestType('John', 'Smith')) objectSessionStorage!: TestType;
}
// Tests ===============================================================================================================
describe('WebStorage Decorators', () => {
let testComponent: TestStorage;
beforeEach(() => {