@operato/context 10.15.0 → 10.16.2
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 +26 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +491 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov.info +15543 -0
- package/dist/src/tools/ox-page-title-bar.js +22 -1
- package/dist/src/tools/ox-page-title-bar.js.map +1 -1
- package/dist/test/page-frames.test.d.ts +1 -0
- package/dist/test/page-frames.test.js +55 -0
- package/dist/test/page-frames.test.js.map +1 -0
- package/dist/test/page-title-description.test.d.ts +1 -0
- package/dist/test/page-title-description.test.js +34 -0
- package/dist/test/page-title-description.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/test/page-frames.test.ts +63 -0
- package/test/page-title-description.test.ts +43 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { expect, fixture } from '@open-wc/testing'
|
|
2
|
+
import { html, LitElement } from 'lit'
|
|
3
|
+
|
|
4
|
+
import { DocumentPageStyles, WorkSurfacePageStyles } from '@operato/styles'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Page frames (ADR-0060 decision 8): the frame owns spacing, width and scroll, so two screens of the
|
|
8
|
+
* same kind come out the same. The numbers are written out, so a change to the frame shows up here as
|
|
9
|
+
* a decision.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
class DocumentScreen extends LitElement {
|
|
13
|
+
static styles = [DocumentPageStyles]
|
|
14
|
+
render() {
|
|
15
|
+
return html`
|
|
16
|
+
<div class="page">
|
|
17
|
+
<section class="page-section">
|
|
18
|
+
<header class="page-section-header"><h3>today</h3><div class="page-section-actions"><button>refresh</button></div></header>
|
|
19
|
+
<div class="page-card">card</div>
|
|
20
|
+
</section>
|
|
21
|
+
<section class="page-section"><header class="page-section-header"><h3>later</h3></header></section>
|
|
22
|
+
</div>
|
|
23
|
+
`
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
customElements.define('test-document-screen', DocumentScreen)
|
|
27
|
+
|
|
28
|
+
class WorkScreen extends LitElement {
|
|
29
|
+
static styles = [WorkSurfacePageStyles]
|
|
30
|
+
render() {
|
|
31
|
+
return html`<div class="page-headroom"><button>tab</button></div><div class="page-fill" style="height: 5000px"></div>`
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
customElements.define('test-work-screen', WorkScreen)
|
|
35
|
+
|
|
36
|
+
describe('page frames', () => {
|
|
37
|
+
it('document: one column 1080px wide at most, 18/20/40 padding, sections 24px apart, the page scrolls', async () => {
|
|
38
|
+
const host = await fixture<HTMLElement>(html`<div style="width: 1600px; height: 600px"><test-document-screen></test-document-screen></div>`)
|
|
39
|
+
const screen = host.querySelector('test-document-screen') as DocumentScreen
|
|
40
|
+
await screen.updateComplete
|
|
41
|
+
const page = screen.shadowRoot!.querySelector('.page') as HTMLElement
|
|
42
|
+
const [first, second] = Array.from(screen.shadowRoot!.querySelectorAll('.page-section'))
|
|
43
|
+
const style = getComputedStyle(page)
|
|
44
|
+
|
|
45
|
+
expect(Math.round(page.getBoundingClientRect().width)).to.equal(1080)
|
|
46
|
+
expect([style.paddingTop, style.paddingRight, style.paddingBottom, style.paddingLeft]).to.deep.equal(['18px', '20px', '40px', '20px'])
|
|
47
|
+
expect(Math.round(second.getBoundingClientRect().top - first.getBoundingClientRect().bottom)).to.equal(24)
|
|
48
|
+
expect(getComputedStyle(screen).overflowY).to.equal('auto')
|
|
49
|
+
|
|
50
|
+
const actions = screen.shadowRoot!.querySelector('.page-section-actions') as HTMLElement
|
|
51
|
+
expect(Math.round(actions.getBoundingClientRect().right)).to.equal(Math.round(page.getBoundingClientRect().right) - 20)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('work surface: the content fills and scrolls inside itself, the page does not scroll', async () => {
|
|
55
|
+
const host = await fixture<HTMLElement>(html`<div style="height: 400px"><test-work-screen></test-work-screen></div>`)
|
|
56
|
+
const screen = host.querySelector('test-work-screen') as WorkScreen
|
|
57
|
+
await screen.updateComplete
|
|
58
|
+
|
|
59
|
+
expect(getComputedStyle(screen).overflow).to.equal('hidden')
|
|
60
|
+
expect(Math.round(screen.getBoundingClientRect().height)).to.equal(400)
|
|
61
|
+
expect(getComputedStyle(screen.shadowRoot!.querySelector('.page-fill')!).minHeight).to.equal('0px')
|
|
62
|
+
})
|
|
63
|
+
})
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { expect, fixture } from '@open-wc/testing'
|
|
2
|
+
import { html } from 'lit'
|
|
3
|
+
|
|
4
|
+
import { store } from '@operato/shell'
|
|
5
|
+
|
|
6
|
+
import '../src/tools/ox-page-title-bar.js'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `context.description` draws one line under the screen title (ADR-0060 decision 8). A screen that
|
|
10
|
+
* does not give it must look exactly as before: no line, no wrapping.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
async function bar(context: Record<string, unknown>) {
|
|
14
|
+
store.dispatch({ type: 'UPDATE_CONTEXT', context } as any)
|
|
15
|
+
const el = await fixture<HTMLElement & { updateComplete: Promise<unknown> }>(html`<ox-page-title-bar></ox-page-title-bar>`)
|
|
16
|
+
await el.updateComplete
|
|
17
|
+
await el.updateComplete
|
|
18
|
+
return el
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe('ox-page-title-bar description', () => {
|
|
22
|
+
it('draws the description under the title', async () => {
|
|
23
|
+
const el = await bar({ title: 'work orders', description: 'orders released to the floor today' })
|
|
24
|
+
const line = el.shadowRoot!.querySelector('[description]')
|
|
25
|
+
|
|
26
|
+
expect(line?.textContent).to.equal('orders released to the floor today')
|
|
27
|
+
expect(el.hasAttribute('described')).to.equal(true)
|
|
28
|
+
expect(line!.getBoundingClientRect().top).to.be.greaterThan(el.shadowRoot!.querySelector('[titler]')!.getBoundingClientRect().top)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('★ draws nothing more when the screen gives no description', async () => {
|
|
32
|
+
const el = await bar({ title: 'work orders' })
|
|
33
|
+
|
|
34
|
+
expect(el.shadowRoot!.querySelector('[description]') === null).to.equal(true)
|
|
35
|
+
expect(el.hasAttribute('described')).to.equal(false)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('leaves the description out when the screen turns the title row off', async () => {
|
|
39
|
+
const el = await bar({ title: 'learn', heading: false, description: 'what the platform does' })
|
|
40
|
+
|
|
41
|
+
expect(el.shadowRoot!.querySelector('[description]') === null).to.equal(true)
|
|
42
|
+
})
|
|
43
|
+
})
|