test(coverage): drive browser tests to 80% on all metrics (#496) #505
@@ -118,4 +118,36 @@ describe('admin/tags/[id] page', () => {
|
||||
const banners = document.querySelectorAll('[role="status"]');
|
||||
expect(banners.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('hides the color picker for child tags (parentId set)', async () => {
|
||||
render(AdminTagEditPage, {
|
||||
props: {
|
||||
data: baseData({ tag: baseTag({ parentId: 't-parent' }) }),
|
||||
form: undefined
|
||||
}
|
||||
});
|
||||
|
||||
const colorPicker = document.querySelector('[data-testid="color-picker"]');
|
||||
expect(colorPicker).toBeNull();
|
||||
});
|
||||
|
||||
it('does not show form-success banner when form is undefined', async () => {
|
||||
render(AdminTagEditPage, { props: { data: baseData(), form: undefined } });
|
||||
|
||||
const banners = document.querySelectorAll('.bg-green-50');
|
||||
// Some other green elements may exist, but the form-success specifically
|
||||
// — accept that the banner may not be present
|
||||
const formSuccessBanner = Array.from(banners).filter((b) =>
|
||||
(b.textContent ?? '').match(/gespeichert|aktualisiert|saved/i)
|
||||
);
|
||||
expect(formSuccessBanner.length).toBe(0);
|
||||
});
|
||||
|
||||
it('renders without throwing when mergeSuccess is null', async () => {
|
||||
expect(() =>
|
||||
render(AdminTagEditPage, {
|
||||
props: { data: baseData({ mergeSuccess: null }), form: undefined }
|
||||
})
|
||||
).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user