First row of tests and fixes

This commit is contained in:
2026-03-05 22:50:53 +01:00
parent 12458925a1
commit f28df2ae76
23 changed files with 442 additions and 126 deletions
+30 -1
View File
@@ -5,7 +5,11 @@ export default class AwEFieldSheet extends AwEItemSheet {
static DEFAULT_OPTIONS = {
classes: ["field"],
position: { width: 620 },
window: { contentClasses: ["field-content"] }
window: { contentClasses: ["field-content"] },
actions: {
addSpecialization: AwEFieldSheet.#onAddSpecialization,
removeSpecialization: AwEFieldSheet.#onRemoveSpecialization
}
}
/** @override */
@@ -14,4 +18,29 @@ export default class AwEFieldSheet extends AwEItemSheet {
template: "systems/fvtt-adventures-with-emmy/templates/field.hbs"
}
}
/**
* Handle adding a specialization.
* @param {PointerEvent} event - The initiating event.
* @param {HTMLElement} target - The input element.
*/
static async #onAddSpecialization(event, target) {
const value = target.value.trim()
if (!value) return
const current = this.document.system.specializations ?? []
await this.document.update({ "system.specializations": [...current, value] })
target.value = ""
}
/**
* Handle removing a specialization.
* @param {PointerEvent} event - The initiating click event.
* @param {HTMLElement} target - The remove button.
*/
static async #onRemoveSpecialization(event, target) {
const index = Number(target.dataset.index)
const current = [...(this.document.system.specializations ?? [])]
current.splice(index, 1)
await this.document.update({ "system.specializations": current })
}
}