@operato/layout 10.29.68 → 10.29.70
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 +29 -0
- package/dist/src/actions/entity360-door.d.ts +9 -18
- package/dist/src/actions/entity360-door.js +17 -24
- package/dist/src/actions/entity360-door.js.map +1 -1
- package/dist/src/actions/entity360-registry.js +6 -3
- package/dist/src/actions/entity360-registry.js.map +1 -1
- package/dist/src/actions/entity360.d.ts +2 -0
- package/dist/src/actions/entity360.js +6 -0
- package/dist/src/actions/entity360.js.map +1 -1
- package/dist/src/components/ox-entity360-dock.d.ts +0 -1
- package/dist/src/components/ox-entity360-dock.js +3 -3
- package/dist/src/components/ox-entity360-dock.js.map +1 -1
- package/dist/src/layouts/ox-nav-bar.js +6 -1
- package/dist/src/layouts/ox-nav-bar.js.map +1 -1
- package/dist/test/entity360-answer.test.d.ts +1 -0
- package/dist/test/entity360-answer.test.js +21 -0
- package/dist/test/entity360-answer.test.js.map +1 -0
- package/dist/test/entity360-kind.test.js +3 -2
- package/dist/test/entity360-kind.test.js.map +1 -1
- package/dist/test/entity360-section.test.js +1 -19
- package/dist/test/entity360-section.test.js.map +1 -1
- package/dist/test/entity360.test.js +3 -2
- package/dist/test/entity360.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -7
- package/test/entity360-answer.test.ts +25 -0
- package/test/entity360-kind.test.ts +2 -2
- package/test/entity360-section.test.ts +1 -19
- package/test/entity360.test.ts +3 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/layout",
|
|
3
3
|
"description": "Webcomponent layout following open-wc recommendations",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "10.29.
|
|
5
|
+
"version": "10.29.70",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/src/index.js",
|
|
8
8
|
"module": "dist/src/index.js",
|
|
@@ -67,12 +67,13 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@material/web": "^2.0.0",
|
|
70
|
+
"@operato/graphql": "^10.29.69",
|
|
70
71
|
"@operato/i18n": "^10.29.27",
|
|
71
|
-
"@operato/input": "^10.29.
|
|
72
|
-
"@operato/popup": "^10.29.
|
|
73
|
-
"@operato/shell": "^10.29.
|
|
74
|
-
"@operato/styles": "^10.29.
|
|
75
|
-
"@operato/utils": "^10.29.
|
|
72
|
+
"@operato/input": "^10.29.70",
|
|
73
|
+
"@operato/popup": "^10.29.70",
|
|
74
|
+
"@operato/shell": "^10.29.70",
|
|
75
|
+
"@operato/styles": "^10.29.70",
|
|
76
|
+
"@operato/utils": "^10.29.69",
|
|
76
77
|
"lit": "^3.1.2"
|
|
77
78
|
},
|
|
78
79
|
"devDependencies": {
|
|
@@ -107,5 +108,5 @@
|
|
|
107
108
|
"prettier --write"
|
|
108
109
|
]
|
|
109
110
|
},
|
|
110
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "7451d7242ca5e396bbdeb89fc46470d52c89e8cd"
|
|
111
112
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { expect } from '@open-wc/testing'
|
|
2
|
+
|
|
3
|
+
import { entity360Answer } from '../src/actions/entity360-door.js'
|
|
4
|
+
|
|
5
|
+
/** A section that declared its query (ADR-0190) comes to rest in one of the four states, as a door's answer does. */
|
|
6
|
+
describe('entity360Answer', () => {
|
|
7
|
+
const pick = (data: any) => data?.invoice
|
|
8
|
+
|
|
9
|
+
it('is undefined while the query first reads, and keeps what it holds while it reads again', () => {
|
|
10
|
+
expect(entity360Answer({ loading: true }, pick)).to.equal(undefined)
|
|
11
|
+
expect(entity360Answer({ loading: false }, pick)).to.equal(undefined)
|
|
12
|
+
expect(entity360Answer({ loading: true, data: { invoice: { id: 'a' } } }, pick)).to.deep.equal({ state: 'ready', data: { id: 'a' } })
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
it('is ready, or none when the door holds nothing', () => {
|
|
16
|
+
expect(entity360Answer({ loading: false, data: { invoice: { id: 'a' } } }, pick)).to.deep.equal({ state: 'ready', data: { id: 'a' } })
|
|
17
|
+
expect(entity360Answer({ loading: false, data: { invoice: null } }, pick)).to.deep.equal({ state: 'none', data: null })
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('keeps a refusal forbidden, and a request that threw failed with its message', () => {
|
|
21
|
+
const refused = { graphQLErrors: [{ message: 'no', extensions: { code: 'FORBIDDEN' } }] }
|
|
22
|
+
expect(entity360Answer({ loading: false, error: refused }, pick)).to.deep.equal({ state: 'forbidden' })
|
|
23
|
+
expect(entity360Answer({ loading: false, error: new TypeError('Failed to fetch') }, pick)).to.deep.equal({ state: 'failed', message: 'Failed to fetch' })
|
|
24
|
+
})
|
|
25
|
+
})
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
registerEntity360Kind,
|
|
12
12
|
registerEntity360Section,
|
|
13
13
|
setEntity360Value,
|
|
14
|
-
ENTITY360_UNKEPT,
|
|
15
14
|
type Entity360Subject,
|
|
16
15
|
type OxEntity360Dock
|
|
17
16
|
} from '../src/index.js'
|
|
17
|
+
import { DRAFT_UNKEPT } from '@operato/shell'
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* A 360 opened by kind and id, the dock's own back trail, and the assistant subject it stands in for.
|
|
@@ -251,7 +251,7 @@ describe('entity 360 by kind', () => {
|
|
|
251
251
|
openEntity360Kind('kx-lot', { id: 'L-3', name: 'L-3' })
|
|
252
252
|
await settle()
|
|
253
253
|
const input = section().querySelector('input')!
|
|
254
|
-
input.dispatchEvent(new CustomEvent(
|
|
254
|
+
input.dispatchEvent(new CustomEvent(DRAFT_UNKEPT, { bubbles: true, composed: true, detail: { unkept: true } }))
|
|
255
255
|
|
|
256
256
|
openEntity360Kind('kx-lot', { id: 'L-4', name: 'L-4' })
|
|
257
257
|
await settle()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect, fixture } from '@open-wc/testing'
|
|
2
2
|
import { html } from 'lit'
|
|
3
3
|
import '../src/index.js'
|
|
4
|
-
import { askEntity360Door,
|
|
4
|
+
import { askEntity360Door, readEntity360Door, type OxEntity360Section } from '../src/index.js'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* A 360 section says what its door answered (ADR-0067): something, nothing, may-not-see, or failed.
|
|
@@ -21,24 +21,6 @@ describe('entity 360 door', () => {
|
|
|
21
21
|
expect((await askEntity360Door(Promise.reject(thrown), d => d?.items)).state).to.equal('forbidden')
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
it('★ only the newest read answers - a second read of the same id drops the first', async () => {
|
|
25
|
-
const reads = new Entity360Reads()
|
|
26
|
-
let release!: (value: any) => void
|
|
27
|
-
const first = reads.ask(() => new Promise(resolve => (release = resolve)), d => d.items)
|
|
28
|
-
const second = reads.ask(() => Promise.resolve({ data: { items: [2] } }), d => d.items)
|
|
29
|
-
release({ data: { items: [1] } })
|
|
30
|
-
expect(await first).to.equal(undefined)
|
|
31
|
-
expect((await second)?.data).to.deep.equal([2])
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('a read that throws synchronously still ends failed; forget drops one on its way', async () => {
|
|
35
|
-
const reads = new Entity360Reads()
|
|
36
|
-
expect((await reads.ask(() => { throw new Error('no client') }, d => d))?.state).to.equal('failed')
|
|
37
|
-
const pending = reads.ask(() => Promise.resolve({ data: { items: [1] } }), d => d.items)
|
|
38
|
-
reads.forget()
|
|
39
|
-
expect(await pending).to.equal(undefined)
|
|
40
|
-
})
|
|
41
|
-
|
|
42
24
|
it('a request that answers is read as readEntity360Door reads it', async () => {
|
|
43
25
|
expect((await askEntity360Door(Promise.resolve({ data: { items: [] } }), d => d.items)).state).to.equal('none')
|
|
44
26
|
expect((await askEntity360Door(Promise.resolve({ data: { items: [1] } }), d => d.items)).data).to.deep.equal([1])
|
package/test/entity360.test.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { expect, fixture, elementUpdated } from '@open-wc/testing'
|
|
2
2
|
import { html } from 'lit'
|
|
3
3
|
import '../src/index.js'
|
|
4
|
-
import { showEntity360, hideEntity360, isEntity360Unkept, navigateEntity360, canGoBackEntity360,
|
|
4
|
+
import { showEntity360, hideEntity360, isEntity360Unkept, navigateEntity360, canGoBackEntity360, type OxEntity360Dock, type Entity360View } from '../src/index.js'
|
|
5
|
+
import { DRAFT_UNKEPT } from '@operato/shell'
|
|
5
6
|
|
|
6
7
|
const owner = {}
|
|
7
8
|
const labels = { close: 'Close', expand: 'Expand', collapse: 'Collapse', resize: 'Resize', back: 'Back' }
|
|
@@ -67,7 +68,7 @@ describe('shared nonmodal entity 360 dock', () => {
|
|
|
67
68
|
await settle()
|
|
68
69
|
const content = dock().shadowRoot!.querySelector('ox-entity360-content') as HTMLElement
|
|
69
70
|
const input = content.shadowRoot!.querySelector('input')!
|
|
70
|
-
const tell = (unkept: boolean) => input.dispatchEvent(new CustomEvent(
|
|
71
|
+
const tell = (unkept: boolean) => input.dispatchEvent(new CustomEvent(DRAFT_UNKEPT, { bubbles: true, composed: true, detail: { unkept } }))
|
|
71
72
|
expect(isEntity360Unkept(owner)).to.equal(false)
|
|
72
73
|
tell(true)
|
|
73
74
|
expect(isEntity360Unkept(owner)).to.equal(true)
|