This commit introduces 'Revert: None - Selected' toggle, enabling users to revert all reversible scripts with a single action, improving user safety and control over script effects. This feature addresses user-reported concerns about the ease of reverting script changes. This feature should enhance the user experience by streamlining the revert process along with providing essential information about script reversibility. Key changes: - Add buttons to revert all selected scripts or setting all selected scripts to non-revert state. - Add tooltips with detailed explanations about consequences of modifying revert states, includinginformation about irreversible script changes. Supporting changes: - Align items on top menu vertically for better visual consistency. - Rename `SelectionType` to `RecommendationStatusType` for more clarity. - Rename `IReverter` to `Reverter` to move away from `I` prefix convention. - The `.script` CSS class was duplicated in `TheScriptsView.vue` and `TheScriptsArea.vue`, leading to style collisions in the development environment. The class has been renamed to component-specific classes to avoid such issues in the future.
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { shallowMount } from '@vue/test-utils';
|
|
import MenuOptionList from '@/presentation/components/Scripts/Menu/MenuOptionList.vue';
|
|
|
|
const DOM_SELECTOR_LABEL = '.list div:first-child:not(.items)';
|
|
const DOM_SELECTOR_SLOT = '.list .items';
|
|
|
|
describe('MenuOptionList', () => {
|
|
it('renders the label when provided', () => {
|
|
// arrange
|
|
const label = 'Test label';
|
|
const expectedLabel = `${label}:`;
|
|
// act
|
|
const wrapper = mountComponent({ label });
|
|
// assert
|
|
const labelElement = wrapper.find(DOM_SELECTOR_LABEL);
|
|
const actualLabel = labelElement.text();
|
|
expect(actualLabel).to.equal(expectedLabel);
|
|
});
|
|
|
|
it('does not render the label when not provided', () => {
|
|
// arrange
|
|
const label = undefined;
|
|
// act
|
|
const wrapper = mountComponent({ label });
|
|
// assert
|
|
const labelElement = wrapper.find(DOM_SELECTOR_LABEL);
|
|
expect(labelElement.exists()).toBe(false);
|
|
});
|
|
|
|
it('renders default slot content', () => {
|
|
// arrange
|
|
const expectedSlotContent = 'Slot Content';
|
|
// act
|
|
const wrapper = mountComponent({ slotContent: expectedSlotContent });
|
|
// assert
|
|
const slotText = wrapper.find(DOM_SELECTOR_SLOT);
|
|
expect(slotText.text()).to.equal(expectedSlotContent);
|
|
});
|
|
});
|
|
|
|
function mountComponent(options?: {
|
|
readonly label?: string;
|
|
readonly slotContent?: string;
|
|
}) {
|
|
return shallowMount(MenuOptionList, {
|
|
props: {
|
|
label: options?.label,
|
|
},
|
|
slots: {
|
|
default: options?.slotContent ?? 'Stubbed slot content',
|
|
},
|
|
});
|
|
}
|