Fix issue #96: When right clicking actor on foundry, show action to force sync to dragonroll
All checks were successful
Test / test (push) Successful in 2s
All checks were successful
Test / test (push) Successful in 2s
This commit is contained in:
@@ -410,6 +410,36 @@ test("an actor that holds no traits does not clear what the campaign has", () =>
|
||||
assert.ok(!("traits" in character), "a live edit that knows nothing about traits leaves the tab as it is");
|
||||
});
|
||||
|
||||
// A forced actor sync from the module's context menu replaces everything the campaign
|
||||
// holds for that actor (Syndria98/dragonroll#96): the fields a live edit leaves out when
|
||||
// the world says nothing are written empty instead of kept, and the campaign's own text
|
||||
// on the actor's flag does not survive it.
|
||||
test("a forced sync writes empty the fields a live edit would leave out", () => {
|
||||
const actor = {
|
||||
name: "Thalia",
|
||||
system: {},
|
||||
items: [],
|
||||
flags: { [MODULE_ID]: { traits: "What the campaign typed", proficiencies: "Armour, tools" } },
|
||||
};
|
||||
|
||||
const live = foundryActorToCharacter(actor);
|
||||
assert.equal(live.traits, "What the campaign typed", "a live edit fills the traits tab from the actor's flag");
|
||||
assert.equal(live.proficiencies, "Armour, tools", "and the free-text proficiencies from it too");
|
||||
assert.ok(
|
||||
!("tools" in live) && !("languages" in live) && !("skills" in live) && !("savingThrows" in live) && !("currency" in live),
|
||||
"and says nothing about the toggles and lists the world has no data for"
|
||||
);
|
||||
|
||||
const replaced = foundryActorToCharacter(actor, true);
|
||||
assert.equal(replaced.traits, "", "a forced sync clears the traits the campaign typed");
|
||||
assert.equal(replaced.proficiencies, "", "down to the free-text proficiencies");
|
||||
assert.deepEqual(replaced.tools, []);
|
||||
assert.deepEqual(replaced.languages, []);
|
||||
assert.deepEqual(replaced.skills, {});
|
||||
assert.deepEqual(replaced.savingThrows, {});
|
||||
assert.deepEqual(replaced.currency, {});
|
||||
});
|
||||
|
||||
// --- The module sends the names a sheet outside Foundry can read -----------------
|
||||
|
||||
function makeWorld({ actor, config = {}, worldItems = [] }) {
|
||||
|
||||
Reference in New Issue
Block a user