piral-core 0.15.0-alpha.4332 → 0.15.0-alpha.4396
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/esm/actions/state.js +6 -7
- package/esm/actions/state.js.map +1 -1
- package/esm/debugger.js +1 -2
- package/esm/debugger.js.map +1 -1
- package/esm/hooks/globalState.js +2 -9
- package/esm/hooks/globalState.js.map +1 -1
- package/esm/state/createActions.d.ts +2 -2
- package/esm/state/createActions.js.map +1 -1
- package/esm/state/createGlobalState.d.ts +1 -2
- package/esm/state/createGlobalState.js +2 -2
- package/esm/state/createGlobalState.js.map +1 -1
- package/esm/types/state.d.ts +2 -3
- package/lib/actions/state.js +6 -7
- package/lib/actions/state.js.map +1 -1
- package/lib/debugger.js +1 -2
- package/lib/debugger.js.map +1 -1
- package/lib/hooks/globalState.js +2 -9
- package/lib/hooks/globalState.js.map +1 -1
- package/lib/state/createActions.d.ts +2 -2
- package/lib/state/createActions.js.map +1 -1
- package/lib/state/createGlobalState.d.ts +1 -2
- package/lib/state/createGlobalState.js +2 -2
- package/lib/state/createGlobalState.js.map +1 -1
- package/lib/types/state.d.ts +2 -3
- package/package.json +7 -13
- package/src/RootListener.test.tsx +5 -7
- package/src/actions/app.test.ts +32 -32
- package/src/actions/components.test.ts +10 -10
- package/src/actions/data.test.ts +49 -49
- package/src/actions/define.test.ts +2 -2
- package/src/actions/portal.test.ts +17 -17
- package/src/actions/state.test.ts +3 -3
- package/src/actions/state.ts +7 -8
- package/src/components/ForeignComponentContainer.test.tsx +14 -13
- package/src/components/Mediator.test.tsx +11 -10
- package/src/debugger.ts +1 -2
- package/src/helpers.test.tsx +9 -8
- package/src/hooks/globalState.ts +2 -11
- package/src/hooks/setter.test.ts +3 -4
- package/src/modules/element-server.test.ts +4 -4
- package/src/modules/element.test.ts +6 -6
- package/src/setters/SetComponent.test.tsx +7 -6
- package/src/setters/SetError.test.tsx +7 -6
- package/src/setters/SetErrors.test.tsx +7 -6
- package/src/setters/SetLayout.test.tsx +7 -6
- package/src/setters/SetProvider.test.tsx +7 -6
- package/src/setters/SetRedirect.test.tsx +7 -6
- package/src/setters/SetRoute.test.tsx +7 -6
- package/src/state/createActions.ts +3 -3
- package/src/state/createGlobalState.test.ts +9 -11
- package/src/state/createGlobalState.ts +2 -2
- package/src/state/withApi.test.tsx +5 -5
- package/src/types/state.ts +2 -3
- package/src/hooks/globalState-server.test.ts +0 -41
- package/src/hooks/globalState.test.ts +0 -47
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment node
|
|
3
|
-
*/
|
|
4
|
-
import { useGlobalState } from './globalState';
|
|
5
|
-
|
|
6
|
-
jest.mock('react', () => {
|
|
7
|
-
const { Atom } = require('@libre/atom');
|
|
8
|
-
const state = Atom.of({
|
|
9
|
-
foo: 5,
|
|
10
|
-
bar: {
|
|
11
|
-
qxz: 'hello',
|
|
12
|
-
},
|
|
13
|
-
list: [1, 2, 3],
|
|
14
|
-
});
|
|
15
|
-
return {
|
|
16
|
-
createContext: jest.fn(),
|
|
17
|
-
useContext: () => ({ state }),
|
|
18
|
-
useState: (v) => [v, jest.fn()],
|
|
19
|
-
useMemo: (f) => f(),
|
|
20
|
-
useLayoutEffect: (f) => f(),
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
describe('Media Module', () => {
|
|
25
|
-
it('in here window should be undefined', () => {
|
|
26
|
-
expect(typeof window).toBe('undefined');
|
|
27
|
-
const result = useGlobalState((m) => (m as any).foo);
|
|
28
|
-
expect(result).toBe(5);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('gets full state object', () => {
|
|
32
|
-
const result = useGlobalState();
|
|
33
|
-
expect(result).toEqual({
|
|
34
|
-
foo: 5,
|
|
35
|
-
bar: {
|
|
36
|
-
qxz: 'hello',
|
|
37
|
-
},
|
|
38
|
-
list: [1, 2, 3],
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { useGlobalState } from './globalState';
|
|
2
|
-
|
|
3
|
-
jest.mock('react', () => {
|
|
4
|
-
const { Atom } = require('@libre/atom');
|
|
5
|
-
const state = Atom.of({
|
|
6
|
-
foo: 5,
|
|
7
|
-
bar: {
|
|
8
|
-
qxz: 'hello',
|
|
9
|
-
},
|
|
10
|
-
list: [1, 2, 3],
|
|
11
|
-
});
|
|
12
|
-
return {
|
|
13
|
-
createContext: jest.fn(),
|
|
14
|
-
useContext: () => ({ state }),
|
|
15
|
-
useState: (v) => [v, jest.fn()],
|
|
16
|
-
useMemo: (f) => f(),
|
|
17
|
-
useLayoutEffect: (f) => f(),
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe('GlobalState Hook Module', () => {
|
|
22
|
-
it('selects key from state', () => {
|
|
23
|
-
const result = useGlobalState((m) => (m as any).foo);
|
|
24
|
-
expect(result).toBe(5);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('gets full state object', () => {
|
|
28
|
-
const result = useGlobalState();
|
|
29
|
-
expect(result).toEqual({
|
|
30
|
-
foo: 5,
|
|
31
|
-
bar: {
|
|
32
|
-
qxz: 'hello',
|
|
33
|
-
},
|
|
34
|
-
list: [1, 2, 3],
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('selects nested values', () => {
|
|
39
|
-
const result = useGlobalState((m) => (m as any).bar.qxz);
|
|
40
|
-
expect(result).toBe('hello');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('selection works against array members', () => {
|
|
44
|
-
const result = useGlobalState((m) => (m as any).list[2]);
|
|
45
|
-
expect(result).toBe(3);
|
|
46
|
-
});
|
|
47
|
-
});
|