27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
import { readFileSync } from 'node:fs';
|
|
import { resolve } from 'node:path';
|
|
|
|
const componentPath = resolve(
|
|
__dirname,
|
|
'../../frontend/src/app/features/admin/blog/blog.component.ts',
|
|
);
|
|
const source = readFileSync(componentPath, 'utf8');
|
|
|
|
describe('AdminBlogComponent — delete confirmation disabled binding', () => {
|
|
it('binds the delete modal deleting input to actionInFlight() so Delete is enabled on open', () => {
|
|
const modalTag = extractBlogDeleteModalTag(source);
|
|
expect(modalTag).not.toBeNull();
|
|
expect(modalTag).toMatch(/\[deleting\]\s*=\s*"actionInFlight\(\)"/);
|
|
});
|
|
|
|
it('no longer derives the delete modal disabled state from the selected post', () => {
|
|
const modalTag = extractBlogDeleteModalTag(source);
|
|
expect(modalTag).not.toBeNull();
|
|
expect(modalTag).not.toMatch(/\[deleting\]\s*=\s*"deleting\(\)\s*!==\s*null"/);
|
|
});
|
|
});
|
|
|
|
function extractBlogDeleteModalTag(src: string): string | null {
|
|
const m = src.match(/<app-blog-delete-modal[\s\S]*?>/);
|
|
return m ? m[0] : null;
|
|
} |