刘光辉
4 小时以前 cf11e63b659afcc9792ab3e395f1b45d844431a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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;
    }
  }`);
  });
});