import { readFileSync } from 'node:fs';
|
import { resolve } from 'node:path';
|
|
import { describe, expect, it } from 'vitest';
|
|
const commonStyles = readFileSync(resolve('apps/jnpf-web-apps-main/src/design/common.scss'), 'utf8');
|
|
describe('common form styles', () => {
|
it('centers labels, lets long labels grow, and aligns required marks with the first line', () => {
|
expect(commonStyles).toContain(`.jnpf-form-item-label-text {
|
overflow-wrap: anywhere;
|
white-space: pre-line;
|
}`);
|
expect(commonStyles).toContain(`.ant-form-item-label-wrap > label {
|
align-items: center;
|
height: auto;
|
min-height: 32px;
|
}`);
|
expect(commonStyles).toContain(`> .jnpf-form-item-label-text::before {
|
display: inline-block;
|
margin-inline-end: 4px;
|
font-family: SimSun, sans-serif;
|
font-size: inherit;
|
line-height: 1;
|
color: var(--error-color);
|
content: '*';
|
}`);
|
});
|
|
it('allows long word-form labels to expand their row', () => {
|
expect(commonStyles).toContain(`.ant-form-item-label {
|
padding: 5px 0;
|
overflow: visible;
|
white-space: normal;
|
border-right: 1px solid var(--border-color-base);
|
|
> label {
|
height: auto;
|
min-height: 32px;
|
overflow-wrap: anywhere;
|
}
|
}`);
|
});
|
|
it('renders configured line breaks in dynamic list column headers', () => {
|
expect(commonStyles).toContain(`.dynamic-model-list-table .vxe-header--column .vxe-cell--title {
|
white-space: pre-line;
|
}`);
|
});
|
|
it('removes redundant file upload padding from word-form details', () => {
|
expect(commonStyles).toContain(`&.word-form-detail {
|
.ant-col-item {
|
& > .ant-form-item {
|
.ant-form-item-label + .ant-form-item-control {
|
padding: 5px 10px;
|
}
|
}
|
}
|
|
.upload-file-container {
|
padding: 0;
|
}
|
}`);
|
});
|
});
|