Skip to content

Commit

Permalink
fix: Macro for same item name now creates (vttred#314)
Browse files Browse the repository at this point in the history
* fix: async restores treasure result text (vttred#272)

* fix: async restores treasure result text

* fix: avoid race conditions with flag "async:false"

* fix: Monster Data Model bugfixes (vttred#279)

* fix: On dropping item onto actor, check for existence before checking for anything related to containers

* fix: Remove pre-container-data-model code for handling containers on monsters

* fix: Programmers and linguists agree: Why Plurals?

* fix: don't reroll on round 1 if already rolled (vttred#280)

* Create CNAME

* docs: add Haxxer as a contributor for code (vttred#281)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

* fix(temporary): removed caching from the build ci

* fix: AC/AAC display fix + party overview fix (vttred#286)

* fix: Add missing usesAscendingAC key

* fix: Update deprecated code

* fix: use game.system.id instead of OSE.systemName when getting party members

* fix: Additional v1.7.x fixes (vttred#289)

* fix: Character generator now properly sets scores

* fix: Items should once again properly display their descriptions.

* fix: Treasure items should be created under the Treasure inventory heading

* fix: Item and armor descriptions should target the correct fields

* fix: replaced broken chart with "translated" badge

* chore: update README to where people can find the Discord invite

* feat: add Catalan and Chinese support to manifest

* Updates to Item Piles system integration (vttred#292)

* Updates to system integration

* Added unstackable item types

* [enhancement] Added option to revert Ctrl/Meta behavior (vttred#294)

* [enhancement] Added option to revert Ctrl/Meta behavior

* Extracted skipDialogCheck to method

* Removed comment about monster testing.

* Moved skipRollDialogcheck to helper collection

* cleanup

Co-authored-by: bakbakbakbakbak <[email protected]>

* docs: add bakbakbakbakbak as a contributor for code (vttred#302)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

* docs: add adn770 as a contributor for translation (vttred#303)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

* [enhancement] Container delete confirmation (vttred#299)

* [enhancement] Added confirmation when deleting containers containing items

* [fix] Container now pushes out containing items.

* Changed to Dialog.confirm

* Cleanup

* cleanup

* Allow first item check condition to allow no item

Co-authored-by: bakbakbakbakbak <[email protected]>

* fix: shopping cart now deducts gold

* Remove confusing monster options (vttred#308)

Co-authored-by: bakbakbakbakbak <[email protected]>

* [fix] Correctly creating link anchors in TextEditor & dragging items to hotbar (vttred#304)

* [fix] Use item.getDragData to fix bad link

* [fix] Macro creation when dragging item from actor

* Fixed macro warning for non-actor items

* Tests for item macros

* Cleanup

* Unlinked token macro fix

* Fixed typo in en.json

* Fixed bug on row 67

* Non-destructive macro removal

* Macro logic

* Cleanup

Co-authored-by: bakbakbakbakbak <[email protected]>

* fix: Macro for same item name now creates

Co-authored-by: Anthony Ronda <[email protected]>
Co-authored-by: Tim <[email protected]>
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Adam Oresten <[email protected]>
Co-authored-by: bakbakbakbakbak <[email protected]>
  • Loading branch information
6 people committed Jan 28, 2023
1 parent 3a8527b commit 51e403a
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions src/e2e/actor/createItemMacro.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { createOseMacro } from '../../module/macros';
import { trashChat, waitForInput } from '../testUtils';


export const key = 'ose.actor.macro';
export const options = {
displayName: 'The Character Sheet: Item Macros'
};

export default ({ before, beforeEach, after, describe, it, expect, assert, ...context }) => {
const testCharacterName = 'Quench Test Character';
const prepareActor = async (data) => {
await trashChat();
await trashActor();

return Actor.create({
...data,
name: testCharacterName,
type: 'character'
});
};
const testActor = () => game.actors.getName(testCharacterName);
const trashActor = () => testActor()?.delete();
const trashMacro = async () => {
await game.macros.find(o => o.name === "Test Macro Item")?.delete();
await game.user.assignHotbarMacro(null, 1);
}
const createItem = (type) => { return testActor()?.createEmbeddedDocuments("Item", [{ type: type, name: "Test Macro Item" }]) };

const createItemMacroData = (item) => {
const dragData = item.toDragData();
dragData.item = item;
dragData.type = "Item"
return dragData
};

const canCreate = async (type) => {
await createItem(type);
const item = testActor().items.contents[0];
const data = createItemMacroData(item);
const macro = await createOseMacro(data, 1);
await waitForInput();

const createdMacro = game.user.getHotbarMacros()[0];
expect(createdMacro?.macro?.command.indexOf("game.ose.rollItemMacro")).not.equal(-1)
}

before(async () => {
await trashChat();
})

describe('Item Macro', () => {
before(async () => {
await prepareActor();
trashMacro();
})

after(async () => {
await trashChat();
await trashActor();
})

afterEach(() => {
trashMacro();
})

it('Create weapon macro', async () => { await canCreate("weapon") })
it('Create spell macro', async () => { await canCreate("spell") })
})
};

0 comments on commit 51e403a

Please sign in to comment.