* feat: add plugin slot for fbe lock paywall (#1347) * feat: Added PluginSlot wrapping UpgradeNotification components (#1366) * chore: Updated PluginSlot mock to support children and test ids * chore: Updated mocked PluginSlot * chore: Added unit test for MockedPluginSlot * fix: Updated slot name ids * feat: Added Plugin Slot wrapping UpgradeNotification in NotificationTray (#1367) * fix: Removed PluginSlot prop scoping for UpgradeNotification (#1369) * feat: generic sidebar notification plugin (#1379) * feat: make notification plugin api generic * feat: include new sidebar and tests * feat: tweak sidebar toggle * style: fix extra space from merge * feat: rename plugin slots --------- Co-authored-by: Alison Langston <46360176+alangsto@users.noreply.github.com> Co-authored-by: Zachary Hancock <zhancock@edx.org>
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import { render, screen } from '@testing-library/react';
|
|
import MockedPluginSlot from './MockedPluginSlot';
|
|
|
|
describe('MockedPluginSlot', () => {
|
|
it('renders mock plugin with "PluginSlot" text', () => {
|
|
render(<MockedPluginSlot id="test_plugin" />);
|
|
|
|
const component = screen.getByText('PluginSlot_test_plugin');
|
|
expect(component).toBeInTheDocument();
|
|
});
|
|
|
|
it('renders as the slot children directly if there is content within', () => {
|
|
render(
|
|
<div role="article">
|
|
<MockedPluginSlot>
|
|
<q role="note">How much wood could a woodchuck chuck if a woodchuck could chuck wood?</q>
|
|
</MockedPluginSlot>
|
|
</div>,
|
|
);
|
|
|
|
const component = screen.getByRole('article');
|
|
expect(component).toBeInTheDocument();
|
|
|
|
// Direct children
|
|
const quote = component.querySelector(':scope > q');
|
|
expect(quote.getAttribute('role')).toBe('note');
|
|
});
|
|
|
|
it('renders mock plugin with a data-testid ', () => {
|
|
render(
|
|
<MockedPluginSlot id="guybrush">
|
|
<q role="note">I am selling these fine leather jackets.</q>
|
|
</MockedPluginSlot>,
|
|
);
|
|
|
|
const component = screen.getByTestId('guybrush');
|
|
expect(component).toBeInTheDocument();
|
|
|
|
const quote = component.querySelector('[role=note]');
|
|
expect(quote).toBeInTheDocument();
|
|
});
|
|
});
|