Skip to content

Commit 13e3fe2

Browse files
committed
Preserve linebreak
1 parent 2b85af2 commit 13e3fe2

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

src/formatter/formatFunction.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import formatFunction from './formatFunction';
2+
23
jest.mock(
34
'./formatReactElementNode.js',
45
() => (node) => `<${node.displayName} />`

src/formatter/formatPropValue.spec.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ import formatTreeNode from './formatTreeNode';
55
import formatComplexDataStructure from './formatComplexDataStructure';
66

77
jest.mock('./../parser/parseReactElement');
8-
98
jest.mock('./formatTreeNode', () =>
109
jest.fn().mockReturnValue('<MockedFormatTreeNodeResult />')
1110
);
12-
1311
jest.mock('./formatComplexDataStructure', () =>
1412
jest.fn().mockReturnValue('*Mocked formatComplexDataStructure result*')
1513
);
@@ -109,18 +107,21 @@ describe('formatPropValue', () => {
109107
{}
110108
)
111109
).toBe('{*Mocked formatComplexDataStructure result*}');
110+
112111
expect(formatComplexDataStructure).toHaveBeenCalledTimes(1);
113112
});
114113

115114
it('should format an array prop value', () => {
116115
expect(formatPropValue(['a', 'b', 'c'], false, 0, {})).toBe(
117116
'{*Mocked formatComplexDataStructure result*}'
118117
);
118+
119119
expect(formatComplexDataStructure).toHaveBeenCalledTimes(1);
120120
});
121121

122122
it('should format a boolean prop value', () => {
123123
expect(formatPropValue(true, false, 0, {})).toBe('{true}');
124+
124125
expect(formatPropValue(false, false, 0, {})).toBe('{false}');
125126
});
126127

@@ -136,6 +137,7 @@ describe('formatPropValue', () => {
136137
expect(formatPropValue(new Set(['a', 'b', 42]), false, 0, {})).toBe(
137138
'{[object Set]}'
138139
);
140+
139141
expect(formatPropValue(new Map(), false, 0, {})).toBe('{[object Map]}');
140142
});
141143
});

src/formatter/formatReactElementNode.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ export default (
115115
sortProps,
116116
tabStop,
117117
} = options;
118+
118119
let out = `<${displayName}`;
120+
119121
let outInlineAttr = out;
120122
let outMultilineAttr = out;
121123
let containsMultilineAttr = false;

src/formatter/formatReactFragmentNode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export default (
5151
}
5252

5353
const { useFragmentShortSyntax } = options;
54+
5455
let displayName;
5556

5657
if (useFragmentShortSyntax) {

0 commit comments

Comments
 (0)