diff --git a/test/common/ops/unlock.test.js b/test/common/ops/unlock.test.js index 24aed655a5..f35341074c 100644 --- a/test/common/ops/unlock.test.js +++ b/test/common/ops/unlock.test.js @@ -20,6 +20,9 @@ describe('shared.ops.unlock', () => { beforeEach(() => { user = generateUser(); user.balance = usersStartingGems; + user.pinnedItems.push({ type: 'background', path: 'backgrounds.backgrounds042016.giant_florals' }); + user.pinnedItems.push({ type: 'haircolor', path: 'hair.color.rainbow' }); + user.pinnedItems.push({ type: 'shirt', path: 'shirt.convict' }); clock = sandbox.useFakeTimers(new Date('2024-04-10')); }); @@ -272,6 +275,7 @@ describe('shared.ops.unlock', () => { }); it('unlocks an item (appearance)', async () => { + expect(user.pinnedItems.findIndex(item => item.type === 'shirt')).to.not.equal(-1); const path = unlockPath.split(',')[0]; const initialShirts = Object.keys(user.purchased.shirt).length; const [, message] = await unlock(user, { query: { path } }); @@ -282,11 +286,12 @@ describe('shared.ops.unlock', () => { ); expect(get(user.purchased, path)).to.be.true; expect(user.balance).to.equal(usersStartingGems - 0.5); + expect(user.pinnedItems.findIndex(item => item.type === 'shirt')).to.equal(-1); }); it('unlocks an item (hair color)', async () => { user.purchased.hair.color = {}; - + expect(user.pinnedItems.findIndex(item => item.type === 'haircolor')).to.not.equal(-1); const path = hairUnlockPath.split(',')[0]; const initialColorHair = Object.keys(user.purchased.hair.color).length; const [, message] = await unlock(user, { query: { path } }); @@ -297,6 +302,7 @@ describe('shared.ops.unlock', () => { ); expect(get(user.purchased, path)).to.be.true; expect(user.balance).to.equal(usersStartingGems - 0.5); + expect(user.pinnedItems.findIndex(item => item.type === 'haircolor')).to.equal(-1); }); it('unlocks an item (facial hair)', async () => { @@ -334,6 +340,7 @@ describe('shared.ops.unlock', () => { it('unlocks an item (background)', async () => { const initialBackgrounds = Object.keys(user.purchased.background).length; + expect(user.pinnedItems.findIndex(item => item.type === 'background')).to.not.equal(-1); const [, message] = await unlock(user, { query: { path: backgroundUnlockPath }, }); @@ -344,6 +351,7 @@ describe('shared.ops.unlock', () => { ); expect(get(user.purchased, backgroundUnlockPath)).to.be.true; expect(user.balance).to.equal(usersStartingGems - 1.75); + expect(user.pinnedItems.findIndex(item => item.type === 'background')).to.equal(-1); }); it('handles an invalid hair path gracefully', async () => { diff --git a/website/client/src/components/shops/buyModal.vue b/website/client/src/components/shops/buyModal.vue index 5f03814b05..2e45b7fe71 100644 --- a/website/client/src/components/shops/buyModal.vue +++ b/website/client/src/components/shops/buyModal.vue @@ -281,6 +281,11 @@ .badge-dialog { left: -8px; top: -8px; + + .badge-pin { + width: 32px; + height: 32px; + } } .avatar { @@ -903,8 +908,8 @@ export default { purchaseGems () { this.$root.$emit('bv::show::modal', 'buy-gems'); }, - togglePinned () { - this.isPinned = this.$store.dispatch('user:togglePinnedItem', { type: this.item.pinType, path: this.item.path }); + async togglePinned () { + this.isPinned = await this.$store.dispatch('user:togglePinnedItem', { type: this.item.pinType, path: this.item.path }); if (!this.isPinned) { this.text(this.$t('unpinnedItem', { item: this.item.text })); diff --git a/website/client/src/components/shops/customizations/index.vue b/website/client/src/components/shops/customizations/index.vue index 236f6a8e95..237b1d3efe 100644 --- a/website/client/src/components/shops/customizations/index.vue +++ b/website/client/src/components/shops/customizations/index.vue @@ -76,7 +76,21 @@ :empty-item="false" :show-popover="Boolean(ctx.item.text)" @click="selectItem(ctx.item)" - /> + > + + @@ -108,6 +122,16 @@ } + +