@operato/property-editor 10.29.80 → 10.29.81
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 +9 -0
- package/dist/src/ox-property-editor-number-map.d.ts +13 -1
- package/dist/src/ox-property-editor-number-map.js +48 -11
- package/dist/src/ox-property-editor-number-map.js.map +1 -1
- package/dist/test/number-map.test.js +76 -0
- package/dist/test/number-map.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/test/number-map.test.ts +85 -0
- package/translations/en.json +2 -1
- package/translations/es.json +2 -1
- package/translations/ko.json +2 -1
- package/translations/ms.json +2 -1
- package/translations/zh.json +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/property-editor",
|
|
3
|
-
"version": "10.29.
|
|
3
|
+
"version": "10.29.81",
|
|
4
4
|
"description": "Webcomponent for property-editor following open-wc recommendations",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"type": "module",
|
|
@@ -213,10 +213,10 @@
|
|
|
213
213
|
},
|
|
214
214
|
"dependencies": {
|
|
215
215
|
"@material/web": "^2.0.0",
|
|
216
|
-
"@operato/help": "^10.29.
|
|
216
|
+
"@operato/help": "^10.29.81",
|
|
217
217
|
"@operato/i18n": "^10.29.27",
|
|
218
|
-
"@operato/input": "^10.29.
|
|
219
|
-
"@operato/popup": "^10.29.
|
|
218
|
+
"@operato/input": "^10.29.81",
|
|
219
|
+
"@operato/popup": "^10.29.81",
|
|
220
220
|
"lit": "^3.1.2",
|
|
221
221
|
"lodash-es": "^4.17.21"
|
|
222
222
|
},
|
|
@@ -255,5 +255,5 @@
|
|
|
255
255
|
"prettier --write"
|
|
256
256
|
]
|
|
257
257
|
},
|
|
258
|
-
"gitHead": "
|
|
258
|
+
"gitHead": "e59c974dc6f94baeea7e1b21224bb347bbd222a7"
|
|
259
259
|
}
|
package/test/number-map.test.ts
CHANGED
|
@@ -131,3 +131,88 @@ describe('number-map — other kinds and nested keys', () => {
|
|
|
131
131
|
expect(el.value).to.deep.equal({ locomotion: { clip: 'walk', speed: 2 } })
|
|
132
132
|
})
|
|
133
133
|
})
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Several things edited together that hold different values (a board's figures selected together): an entry marked
|
|
137
|
+
* `mixed` shows it is mixed, not its default, until a value is given -- and a value given is shown as any other.
|
|
138
|
+
*/
|
|
139
|
+
describe('number-map — mixed entries', () => {
|
|
140
|
+
const entries = [
|
|
141
|
+
{ key: 'pitch', label: '롤러 간격', unit: 'mm', min: 100, max: 400, default: 200, mixed: true },
|
|
142
|
+
{ key: 'gap', label: '틈', unit: 'mm', min: 0, max: 50, default: 10 },
|
|
143
|
+
{ key: 'mode', label: '동작', kind: 'enum', values: ['idle', 'walk', 'run'], default: 'idle', mixed: true },
|
|
144
|
+
{ key: 'batteryLow', label: '배터리 부족', kind: 'boolean', default: false, mixed: true }
|
|
145
|
+
]
|
|
146
|
+
const make = (value: Record<string, unknown> = { gap: 20 }) =>
|
|
147
|
+
fixture<OxPropertyEditorNumberMap>(html`<ox-property-editor-number-map name="figureValues" .property=${{ entries }} .value=${value}></ox-property-editor-number-map>`)
|
|
148
|
+
const at = (el: OxPropertyEditorNumberMap, selector: string) => el.renderRoot.querySelector(selector) as HTMLInputElement & HTMLSelectElement
|
|
149
|
+
|
|
150
|
+
it('a mixed number: an empty field saying so, the range kept as its title, no thumb on the slider', async () => {
|
|
151
|
+
const el = await make()
|
|
152
|
+
const field = at(el, 'input[type=number][data-key="pitch"]')
|
|
153
|
+
expect(field.value).to.equal('')
|
|
154
|
+
expect(field.placeholder).to.equal('Mixed')
|
|
155
|
+
expect(field.title).to.equal('100–400 (200)')
|
|
156
|
+
expect(field.hasAttribute('mixed')).to.equal(true)
|
|
157
|
+
expect(at(el, 'input[type=range][data-key="pitch"]').hasAttribute('mixed')).to.equal(true)
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
it('an entry not marked mixed shows its value as before', async () => {
|
|
161
|
+
const el = await make()
|
|
162
|
+
expect(at(el, 'input[type=number][data-key="gap"]').value).to.equal('20')
|
|
163
|
+
expect(at(el, 'input[type=number][data-key="gap"]').hasAttribute('mixed')).to.equal(false)
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
it('a mixed choice is none of its values; a mixed checkbox is indeterminate', async () => {
|
|
167
|
+
const el = await make()
|
|
168
|
+
const choice = at(el, 'select[data-key="mode"]')
|
|
169
|
+
expect(choice.value).to.equal('')
|
|
170
|
+
expect(choice.selectedOptions[0].textContent).to.equal('Mixed')
|
|
171
|
+
expect(at(el, 'input[type=checkbox][data-key="batteryLow"]').indeterminate).to.equal(true)
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
it('a value given to a mixed number is told and then shown as any other', async () => {
|
|
175
|
+
const el = await make()
|
|
176
|
+
const field = at(el, 'input[type=number][data-key="pitch"]')
|
|
177
|
+
field.value = '300'
|
|
178
|
+
const told = oneEvent(el, 'change')
|
|
179
|
+
field.dispatchEvent(new Event('change', { bubbles: true }))
|
|
180
|
+
await told
|
|
181
|
+
await el.updateComplete
|
|
182
|
+
expect(el.value).to.deep.equal({ gap: 20, pitch: 300 })
|
|
183
|
+
expect(at(el, 'input[type=number][data-key="pitch"]').value).to.equal('300')
|
|
184
|
+
expect(at(el, 'input[type=number][data-key="pitch"]').hasAttribute('mixed')).to.equal(false)
|
|
185
|
+
expect(at(el, 'input[type=range][data-key="pitch"]').hasAttribute('mixed')).to.equal(false)
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
it('a choice made on a mixed entry is told; it is then that choice', async () => {
|
|
189
|
+
const el = await make()
|
|
190
|
+
const choice = at(el, 'select[data-key="mode"]')
|
|
191
|
+
choice.value = 'run'
|
|
192
|
+
const told = oneEvent(el, 'change')
|
|
193
|
+
choice.dispatchEvent(new Event('change', { bubbles: true }))
|
|
194
|
+
await told
|
|
195
|
+
await el.updateComplete
|
|
196
|
+
expect(el.value).to.deep.equal({ gap: 20, mode: 'run' })
|
|
197
|
+
expect(at(el, 'select[data-key="mode"]').value).to.equal('run')
|
|
198
|
+
expect(at(el, 'select[data-key="mode"]').querySelector('option[hidden]')).to.equal(null)
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
it('a value outside the range on a mixed entry is not taken: the field is empty again, not the default', async () => {
|
|
202
|
+
const el = await make()
|
|
203
|
+
let told = false
|
|
204
|
+
el.addEventListener('change', () => (told = true))
|
|
205
|
+
const field = at(el, 'input[type=number][data-key="pitch"]')
|
|
206
|
+
field.value = '1000'
|
|
207
|
+
field.dispatchEvent(new Event('change', { bubbles: true }))
|
|
208
|
+
await el.updateComplete
|
|
209
|
+
expect(told).to.equal(false)
|
|
210
|
+
expect(field.value).to.equal('')
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
it('a mixed entry the map holds a value for shows that value', async () => {
|
|
214
|
+
const el = await make({ pitch: 250 })
|
|
215
|
+
expect(at(el, 'input[type=number][data-key="pitch"]').value).to.equal('250')
|
|
216
|
+
expect(at(el, 'input[type=number][data-key="pitch"]').hasAttribute('mixed')).to.equal(false)
|
|
217
|
+
})
|
|
218
|
+
})
|
package/translations/en.json
CHANGED
package/translations/es.json
CHANGED
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
"text.input-secret-placeholder": "introduzca la información secreta",
|
|
4
4
|
"text.input-secret-show": "mostrar",
|
|
5
5
|
"text.input-secret-hide": "ocultar",
|
|
6
|
-
"text.input-secret-toggle": "mostrar/ocultar"
|
|
6
|
+
"text.input-secret-toggle": "mostrar/ocultar",
|
|
7
|
+
"text.mixed-values": "Varios"
|
|
7
8
|
}
|
package/translations/ko.json
CHANGED
package/translations/ms.json
CHANGED
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
"text.input-secret-placeholder": "Masukkan maklumat rahsia",
|
|
4
4
|
"text.input-secret-show": "Tunjuk",
|
|
5
5
|
"text.input-secret-hide": "Sembunyi",
|
|
6
|
-
"text.input-secret-toggle": "Tunjuk/Sembunyi"
|
|
6
|
+
"text.input-secret-toggle": "Tunjuk/Sembunyi",
|
|
7
|
+
"text.mixed-values": "Pelbagai"
|
|
7
8
|
}
|