@operato/data-grist 10.29.28 → 10.29.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/data-grist",
3
- "version": "10.29.28",
3
+ "version": "10.29.30",
4
4
  "description": "User interface for grid (desktop) and list (mobile)",
5
5
  "author": "heartyoh",
6
6
  "type": "module",
@@ -27,7 +27,8 @@
27
27
  "./ox-sorters-control.js": "./dist/src/sorters/sorters-control.js",
28
28
  "./ox-record-creator.js": "./dist/src/record-view/ox-record-creator.js",
29
29
  "./ox-grist-personalizer.js": "./dist/src/personalizer/ox-grist-personalizer.js",
30
- "./ox-popup-code-input.js": "./dist/src/editors/ox-popup-code-input.js"
30
+ "./ox-popup-code-input.js": "./dist/src/editors/ox-popup-code-input.js",
31
+ "./ox-card-thumb.js": "./dist/src/data-card/ox-card-thumb.js"
31
32
  },
32
33
  "typesVersions": {
33
34
  "*": {
@@ -51,6 +52,9 @@
51
52
  ],
52
53
  "ox-popup-code-input.js": [
53
54
  "dist/src/personalizer/ox-grist-personalizer.d.ts"
55
+ ],
56
+ "ox-card-thumb.js": [
57
+ "dist/src/data-card/ox-card-thumb.d.ts"
54
58
  ]
55
59
  }
56
60
  },
@@ -70,12 +74,12 @@
70
74
  "@material/web": "^2.0.0",
71
75
  "@operato/headroom": "^10.29.1",
72
76
  "@operato/i18n": "^10.29.27",
73
- "@operato/input": "^10.29.28",
77
+ "@operato/input": "^10.29.30",
74
78
  "@operato/list-state": "^10.29.27",
75
- "@operato/p13n": "^10.29.27",
76
- "@operato/popup": "^10.29.27",
79
+ "@operato/p13n": "^10.29.30",
80
+ "@operato/popup": "^10.29.30",
77
81
  "@operato/pull-to-refresh": "^10.29.23",
78
- "@operato/styles": "^10.29.23",
82
+ "@operato/styles": "^10.29.30",
79
83
  "@operato/time-calculator": "^10.29.1",
80
84
  "@operato/utils": "^10.29.23",
81
85
  "i18next": "^24.2.1",
@@ -116,5 +120,5 @@
116
120
  "prettier --write"
117
121
  ]
118
122
  },
119
- "gitHead": "cf6d84547fbf6a32a315c08f85c4dfc35a30d4a5"
123
+ "gitHead": "44682a97746b11fb380a3a5ce7718f3428e4943c"
120
124
  }
@@ -0,0 +1,51 @@
1
+ import { expect, fixture, html } from '@open-wc/testing'
2
+
3
+ import '../src/data-card/ox-card-thumb.js'
4
+ import type { OxCardThumb } from '../src/data-card/ox-card-thumb.js'
5
+
6
+ /*
7
+ * The one picture cell of a catalog card (ADR-0117 amendment 2026-10-13): the picture whole, an icon when there is
8
+ * none, at most one marker in the top-left corner, and a seam under it.
9
+ */
10
+ describe('ox-card-thumb', () => {
11
+ it('★ shows the picture whole, never cropped, with a seam under it', async () => {
12
+ const thumb = await fixture<OxCardThumb>(html`<ox-card-thumb
13
+ style="--md-sys-color-outline-variant: rgb(200, 200, 200)"
14
+ src="data:image/gif;base64,R0lGODlhAQABAAAAACw="
15
+ alt="a board"
16
+ ></ox-card-thumb>`)
17
+ const img = thumb.shadowRoot!.querySelector('img')!
18
+ expect(img.getAttribute('alt')).to.equal('a board')
19
+ expect(getComputedStyle(img).objectFit).to.equal('contain')
20
+ expect(getComputedStyle(thumb).borderBottomStyle).to.equal('solid')
21
+ expect(thumb.shadowRoot!.querySelector('[empty]')).to.equal(null)
22
+ })
23
+
24
+ it('★ draws its icon when there is no picture, or the empty slot when one is given', async () => {
25
+ const bare = await fixture<OxCardThumb>(html`<ox-card-thumb icon="dashboard"></ox-card-thumb>`)
26
+ expect(bare.shadowRoot!.querySelector('[empty] md-icon')!.textContent).to.equal('dashboard')
27
+
28
+ const marked = await fixture<OxCardThumb>(html`<ox-card-thumb><span slot="empty" id="mark">no picture</span></ox-card-thumb>`)
29
+ const slot = marked.shadowRoot!.querySelector('slot[name="empty"]') as HTMLSlotElement
30
+ expect(slot.assignedElements().map(e => e.id)).to.deep.equal(['mark'])
31
+ })
32
+
33
+ it('★ says one thing in the corner, in its tone, and nothing when there is nothing to say', async () => {
34
+ const quiet = await fixture<OxCardThumb>(html`<ox-card-thumb></ox-card-thumb>`)
35
+ expect(quiet.shadowRoot!.querySelector('[badge]')).to.equal(null)
36
+
37
+ const warned = await fixture<OxCardThumb>(html`<ox-card-thumb badge="not latest" tone="warn"></ox-card-thumb>`)
38
+ const badge = warned.shadowRoot!.querySelector('[badge]') as HTMLElement
39
+ expect(badge.textContent).to.equal('not latest')
40
+ expect(badge.getAttribute('tone')).to.equal('warn')
41
+ expect(getComputedStyle(badge).position).to.equal('absolute')
42
+ expect(getComputedStyle(badge).top).to.equal('6px')
43
+ expect(getComputedStyle(badge).left).to.equal('6px')
44
+ })
45
+
46
+ it('lays the default slot over the picture for an action that belongs to it', async () => {
47
+ const thumb = await fixture<OxCardThumb>(html`<ox-card-thumb><button id="del">x</button></ox-card-thumb>`)
48
+ const slot = thumb.shadowRoot!.querySelector('slot:not([name])') as HTMLSlotElement
49
+ expect(slot.assignedElements().map(e => e.id)).to.deep.equal(['del'])
50
+ })
51
+ })