ember-browser-services 1.1.8 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +79 -25
- package/addon/services/browser/session-storage.ts +21 -0
- package/addon/tsconfig.tsbuildinfo +1 -1
- package/addon/types.ts +12 -0
- package/addon/utils/proxy-service.ts +4 -0
- package/addon-test-support/-private/web-storage.ts +31 -0
- package/addon-test-support/index.ts +78 -18
- package/addon-test-support/tsconfig.tsbuildinfo +1 -1
- package/addon-test-support/window-mock-augments.ts +55 -0
- package/app/services/browser/session-storage.js +1 -0
- package/declarations/services/browser/session-storage.d.ts +16 -0
- package/declarations/test-support/-private/web-storage.d.ts +18 -0
- package/declarations/test-support/index.d.ts +8 -7
- package/declarations/test-support/window-mock-augments.d.ts +1 -0
- package/declarations/types.d.ts +5 -0
- package/package.json +40 -37
- package/addon-test-support/-private/-helpers.ts +0 -46
- package/addon-test-support/-private/document.ts +0 -11
- package/addon-test-support/-private/local-storage.ts +0 -28
- package/addon-test-support/-private/navigator.ts +0 -22
- package/addon-test-support/-private/window.ts +0 -27
- package/declarations/test-support/-private/-helpers.d.ts +0 -6
- package/declarations/test-support/-private/document.d.ts +0 -8
- package/declarations/test-support/-private/local-storage.d.ts +0 -14
- package/declarations/test-support/-private/navigator.d.ts +0 -4
- package/declarations/test-support/-private/window.d.ts +0 -19
@@ -1,27 +0,0 @@
|
|
1
|
-
import { proxyService } from 'ember-browser-services/utils/proxy-service';
|
2
|
-
|
3
|
-
interface TestLocation extends Partial<Location> {
|
4
|
-
href?: string;
|
5
|
-
}
|
6
|
-
|
7
|
-
export interface TestWindow {
|
8
|
-
parent?: TestWindow;
|
9
|
-
top?: TestWindow;
|
10
|
-
location?: TestLocation;
|
11
|
-
}
|
12
|
-
|
13
|
-
class FakeLocation {
|
14
|
-
href = '';
|
15
|
-
|
16
|
-
replace(href: string) {
|
17
|
-
this.href = href;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
class FakeWindow {
|
22
|
-
location = new FakeLocation();
|
23
|
-
top = this;
|
24
|
-
parent = this;
|
25
|
-
}
|
26
|
-
|
27
|
-
export const FakeWindowService = proxyService(FakeWindow);
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import Service from '@ember/service';
|
2
|
-
import type { Class } from 'ember-browser-services/types';
|
3
|
-
declare type UnknownObject = Record<string, any>;
|
4
|
-
export declare function maybeMake<DefaultType extends typeof Service, TestClass extends UnknownObject>(maybeImplementation: true | typeof Service | TestClass, defaultImplementation: DefaultType): typeof Service;
|
5
|
-
export declare function testableVersionOf<Real extends object, TestInstance extends object, TestClass extends Class<TestInstance>>(real: Real, Klass: TestClass): TestInstance;
|
6
|
-
export {};
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import Service from '@ember/service';
|
2
|
-
declare type FakeLocalStorage = Record<string, string>;
|
3
|
-
/**
|
4
|
-
* Mimics the window.localStorage API
|
5
|
-
*
|
6
|
-
*/
|
7
|
-
export declare class FakeLocalStorageService extends Service {
|
8
|
-
fakeLocalStorage: FakeLocalStorage;
|
9
|
-
setItem(key: string, value: string): void;
|
10
|
-
getItem(key: string): string | null;
|
11
|
-
removeItem(key: string): void;
|
12
|
-
clear(): void;
|
13
|
-
}
|
14
|
-
export {};
|
@@ -1,19 +0,0 @@
|
|
1
|
-
interface TestLocation extends Partial<Location> {
|
2
|
-
href?: string;
|
3
|
-
}
|
4
|
-
export interface TestWindow {
|
5
|
-
parent?: TestWindow;
|
6
|
-
top?: TestWindow;
|
7
|
-
location?: TestLocation;
|
8
|
-
}
|
9
|
-
declare class FakeLocation {
|
10
|
-
href: string;
|
11
|
-
replace(href: string): void;
|
12
|
-
}
|
13
|
-
declare class FakeWindow {
|
14
|
-
location: FakeLocation;
|
15
|
-
top: this;
|
16
|
-
parent: this;
|
17
|
-
}
|
18
|
-
export declare const FakeWindowService: typeof import("@ember/service").default & FakeWindow;
|
19
|
-
export {};
|