Skip to content

Commit ed948de

Browse files
committed
Updated baselines and tests
1 parent b65e5b4 commit ed948de

11 files changed

+54
-31
lines changed

tests/baselines/reference/errorSpanForUnclosedJsxTag.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ var Foo = {
1717
};
1818
var Baz = function () { };
1919
var x = React.createElement(Foo.Bar, null,
20-
"Hello let y = ",
20+
"Hello let y =",
21+
" ",
2122
React.createElement(Baz, null, "Hello"));

tests/baselines/reference/inlineJsxFactoryDeclarationsLocalTypes.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ exports.tree = exports.MyClass = exports.MySFC = void 0;
9696
var renderer2_1 = require("./renderer2");
9797
var MySFC = function (props) { return renderer2_1.predom("p", null,
9898
props.x,
99-
" + ",
99+
" +",
100+
" ",
100101
props.y,
101-
" = ",
102+
" =",
103+
" ",
102104
props.x + props.y,
103105
_this.props.children); };
104106
exports.MySFC = MySFC;
@@ -109,9 +111,11 @@ var MyClass = /** @class */ (function () {
109111
MyClass.prototype.render = function () {
110112
return renderer2_1.predom("p", null,
111113
this.props.x,
112-
" + ",
114+
" +",
115+
" ",
113116
this.props.y,
114-
" = ",
117+
" =",
118+
" ",
115119
this.props.x + this.props.y,
116120
this.props.children);
117121
};
@@ -132,9 +136,11 @@ var elem = component_1["default"];
132136
elem = renderer_1.dom("h", null); // Expect assignability error here
133137
var DOMSFC = function (props) { return renderer_1.dom("p", null,
134138
props.x,
135-
" + ",
139+
" +",
140+
" ",
136141
props.y,
137-
" = ",
142+
" =",
143+
" ",
138144
props.x + props.y,
139145
props.children); };
140146
var DOMClass = /** @class */ (function () {
@@ -144,9 +150,11 @@ var DOMClass = /** @class */ (function () {
144150
DOMClass.prototype.render = function () {
145151
return renderer_1.dom("p", null,
146152
this.props.x,
147-
" + ",
153+
" +",
154+
" ",
148155
this.props.y,
149-
" = ",
156+
" =",
157+
" ",
150158
this.props.x + this.props.y,
151159
this.props.children);
152160
};

tests/baselines/reference/jsxChildrenIndividualErrorElaborations.errors.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ tests/cases/compiler/index.tsx(74,9): error TS2322: Type 'number' is not assigna
3939

4040
Hello unexpected text!
4141
~~~~~~~~~~~~~~~~~~~~~~~~
42-
</Blah>
43-
4442
!!! error TS2747: 'Blah' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is '(x: number) => string'.
4543
!!! related TS6500 tests/cases/compiler/index.tsx:5:3: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & Props'
44+
</Blah>
4645

4746
// Blah components don't accept multiple children.
4847
var a = <Blah>
@@ -112,10 +111,9 @@ tests/cases/compiler/index.tsx(74,9): error TS2322: Type 'number' is not assigna
112111

113112
Hello unexpected text!
114113
~~~~~~~~~~~~~~~~~~~~~~~~
115-
</Blah3>
116-
117114
!!! error TS2747: 'Blah3' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Cb | Cb[]'.
118115
!!! related TS6500 tests/cases/compiler/index.tsx:54:3: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & PropsMixed'
116+
</Blah3>
119117

120118
// Blah3 components don't accept multiple children of the wrong type.
121119
var a = <Blah3>

tests/baselines/reference/tsxReactEmit3.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ declare var Foo, Bar, baz;
99
//// [test.js]
1010
React.createElement(Foo, null,
1111
" ",
12-
React.createElement(Bar, null, " q "),
12+
React.createElement(Bar, null,
13+
" q",
14+
" "),
1315
" ",
1416
React.createElement(Bar, null),
15-
" s ",
17+
" s",
18+
" ",
1619
React.createElement(Bar, null),
1720
React.createElement(Bar, null));

tests/baselines/reference/tsxReactEmitEntities.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ declare var React: any;
2323
<div>&#x1F408;&#x1F415;&#128007;&#128017;</div>;
2424

2525
//// [file.js]
26-
React.createElement("div", null, "Dot goes here: \u00B7 &notAnEntity; ");
26+
React.createElement("div", null,
27+
"Dot goes here: \u00B7 &notAnEntity;",
28+
" ");
2729
React.createElement("div", null, "Be careful of \"-ed strings!");
2830
React.createElement("div", null, "{{braces}}");
2931
// Escapes do nothing

tests/baselines/reference/tsxReactEmitWhitespace.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ React.createElement("div", null, p);
8282
// Emit " 3"
8383
React.createElement("div", null, " 3");
8484
// Emit " 3 "
85-
React.createElement("div", null, " 3 ");
85+
React.createElement("div", null,
86+
" 3",
87+
" ");
8688
// Emit "3"
8789
React.createElement("div", null, "3");
8890
// Emit no args
@@ -92,4 +94,6 @@ React.createElement("div", null, "foo bar");
9294
// Emit "hello\\ world"
9395
React.createElement("div", null, "hello\\ world");
9496
// Emit " a b c d "
95-
React.createElement("div", null, " a b c d ");
97+
React.createElement("div", null,
98+
" a b c d",
99+
" ");

tests/baselines/reference/tsxReactEmitWhitespace2.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ declare var React: any;
1919
//// [file.js]
2020
// Emit ' word' in the last string
2121
React.createElement("div", null,
22-
"word ",
22+
"word",
23+
" ",
2324
React.createElement("code", null, "code"),
2425
" word");
2526
// Same here

tests/baselines/reference/tsxUnionElementType1.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ function SFC1(prop) {
2121
}
2222
;
2323
function SFC2(prop) {
24-
return React.createElement("h1", null, "World ");
24+
return React.createElement("h1", null,
25+
"World",
26+
" ");
2527
}
2628
var SFCComp = SFC1 || SFC2;
2729
React.createElement(SFCComp, { x: true });

tests/baselines/reference/tsxUnionElementType2.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ function SFC1(prop) {
2121
}
2222
;
2323
function SFC2(prop) {
24-
return React.createElement("h1", null, "World ");
24+
return React.createElement("h1", null,
25+
"World",
26+
" ");
2527
}
2628
var SFCComp = SFC1 || SFC2;
2729
React.createElement(SFCComp, { x: "hi" });

tests/cases/fourslash/syntacticClassificationsJsx1.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ verify.syntacticClassificationsAre(
1616
c.jsxAttribute("b"), c.operator("="), c.punctuation("{"), c.numericLiteral("1"), c.punctuation("}"),
1717
c.punctuation(">"),
1818
c.jsxText(`
19-
some jsx text
19+
some jsx text`),
20+
c.jsxText(`
2021
`),
2122
c.punctuation("<"), c.punctuation("/"), c.jsxCloseTagName("div"), c.punctuation(">"), c.punctuation(";"),
2223
c.keyword("let"), c.identifier("y"), c.operator("="),
@@ -26,8 +27,8 @@ verify.syntacticClassificationsAre(
2627
c.punctuation("/"), c.punctuation(">")
2728
)
2829

29-
const c2 = classification("2020");
30-
verify.semanticClassificationsAre("2020",
31-
c2.semanticToken("variable.declaration", "x"),
32-
c2.semanticToken("variable.declaration", "y"),
30+
const c2 = classification("2020");
31+
verify.semanticClassificationsAre("2020",
32+
c2.semanticToken("variable.declaration", "x"),
33+
c2.semanticToken("variable.declaration", "y"),
3334
);

tests/cases/fourslash/syntacticClassificationsJsx2.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ verify.syntacticClassificationsAre(
1616
c.jsxAttribute("c"), c.operator("="), c.punctuation("{"), c.numericLiteral("1"), c.punctuation("}"),
1717
c.punctuation(">"),
1818
c.jsxText(`
19-
some jsx text
19+
some jsx text`),
20+
c.jsxText(`
2021
`),
2122
c.punctuation("<"), c.punctuation("/"), c.jsxCloseTagName("div.name"), c.punctuation(">"), c.punctuation(";"),
2223
c.keyword("let"), c.identifier("y"), c.operator("="),
@@ -26,8 +27,8 @@ verify.syntacticClassificationsAre(
2627
c.punctuation("/"), c.punctuation(">")
2728
)
2829

29-
const c2 = classification("2020");
30-
verify.semanticClassificationsAre("2020",
31-
c2.semanticToken("variable.declaration", "x"),
32-
c2.semanticToken("variable.declaration", "y"),
30+
const c2 = classification("2020");
31+
verify.semanticClassificationsAre("2020",
32+
c2.semanticToken("variable.declaration", "x"),
33+
c2.semanticToken("variable.declaration", "y"),
3334
);

0 commit comments

Comments
 (0)