mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-05 14:26:06 +02:00
fix: location context menu does not remove external classes from location node
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="enableContextMenu ? ContextMenu : Passthrough">
|
<component :is="enableContextMenu ? ContextMenu : Passthrough">
|
||||||
<component :is="enableContextMenu ? ContextMenuTrigger : Passthrough" as-child>
|
<component :is="enableContextMenu ? ContextMenuTrigger : Passthrough" as-child>
|
||||||
<div class="cursor-pointer">
|
<div class="cursor-pointer" v-bind="$attrs">
|
||||||
<div v-if="!text" class="text-transparent">-</div>
|
<div v-if="!text" class="text-transparent">-</div>
|
||||||
<div v-show="text" class="flex items-center">
|
<div v-show="text" class="flex items-center">
|
||||||
<template v-if="isAgeRestricted">
|
<template v-if="isAgeRestricted">
|
||||||
@@ -83,6 +83,10 @@
|
|||||||
import WorldActionMenuItems from './WorldActionMenuItems.vue';
|
import WorldActionMenuItems from './WorldActionMenuItems.vue';
|
||||||
import { accessTypeLocaleKeyMap } from '../shared/constants';
|
import { accessTypeLocaleKeyMap } from '../shared/constants';
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
inheritAttrs: false
|
||||||
|
});
|
||||||
|
|
||||||
const Passthrough = (_, { slots }) => slots.default?.();
|
const Passthrough = (_, { slots }) => slots.default?.();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|||||||
@@ -112,6 +112,10 @@ const i18n = createI18n({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const stubs = {
|
const stubs = {
|
||||||
|
ContextMenu: { template: '<div><slot /></div>' },
|
||||||
|
ContextMenuTrigger: { template: '<div><slot /></div>' },
|
||||||
|
ContextMenuContent: { template: '<div><slot /></div>' },
|
||||||
|
WorldActionMenuItems: { template: '<div />' },
|
||||||
TooltipWrapper: {
|
TooltipWrapper: {
|
||||||
template: '<span><slot /></span>',
|
template: '<span><slot /></span>',
|
||||||
props: [
|
props: [
|
||||||
@@ -126,9 +130,10 @@ const stubs = {
|
|||||||
AlertTriangle: { template: '<span class="alert-triangle" />' }
|
AlertTriangle: { template: '<span class="alert-triangle" />' }
|
||||||
};
|
};
|
||||||
|
|
||||||
function mountLocation(props = {}, appearanceOverrides = {}) {
|
function mountLocation(props = {}, appearanceOverrides = {}, mountOptions = {}) {
|
||||||
return mount(Location, {
|
return mount(Location, {
|
||||||
props,
|
props,
|
||||||
|
...mountOptions,
|
||||||
global: {
|
global: {
|
||||||
plugins: [
|
plugins: [
|
||||||
i18n,
|
i18n,
|
||||||
@@ -185,6 +190,24 @@ describe('Location.vue', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('context menu attrs', () => {
|
||||||
|
test('keeps external classes on the visible location node when context menu is enabled', () => {
|
||||||
|
const wrapper = mountLocation(
|
||||||
|
{ location: 'wrld_12345:67890', enableContextMenu: true },
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
attrs: {
|
||||||
|
class: 'text-xs custom-location'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const locationNode = wrapper.find('.custom-location');
|
||||||
|
expect(locationNode.exists()).toBe(true);
|
||||||
|
expect(locationNode.classes()).toContain('text-xs');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('hint display', () => {
|
describe('hint display', () => {
|
||||||
test('shows hint with access type for valid instance', () => {
|
test('shows hint with access type for valid instance', () => {
|
||||||
const wrapper = mountLocation({
|
const wrapper = mountLocation({
|
||||||
|
|||||||
Reference in New Issue
Block a user