Skip to content

Commit ddcfc29

Browse files
committed
Update react-beta to use the released react 19.
1 parent c1bcde7 commit ddcfc29

File tree

4 files changed

+58
-66
lines changed

4 files changed

+58
-66
lines changed

libraries/react-beta/package-lock.json

Lines changed: 32 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libraries/react-beta/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"webpack": "5.94.0"
2020
},
2121
"dependencies": {
22-
"react": "beta",
23-
"react-dom": "beta"
22+
"react": "^19",
23+
"react-dom": "^19"
2424
},
2525
"wireit": {
2626
"test": {

libraries/react-beta/src/basic-tests.js

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
ComponentWithProperties,
2929
ComponentWithUnregistered,
3030
ComponentWithImperativeEvent,
31-
ComponentWithDeclarativeEvent
31+
ComponentWithDeclarativeEvent,
3232
} from "./components";
3333

3434
// Setup the test harness. This will get cleaned out with every test.
@@ -41,22 +41,22 @@ let reactRoot = null;
4141
function render(element) {
4242
act(() => {
4343
reactRoot.render(element);
44-
})
44+
});
4545
}
4646

4747
before(() => {
4848
window.IS_REACT_ACT_ENVIRONMENT = true;
49-
})
49+
});
5050

51-
beforeEach(function() {
51+
beforeEach(function () {
5252
scratch = document.createElement("div");
5353
scratch.id = "scratch";
5454
app.appendChild(scratch);
5555

5656
reactRoot = createRoot(scratch);
5757
});
5858

59-
afterEach(function() {
59+
afterEach(function () {
6060
app.innerHTML = "";
6161
scratch = null;
6262

@@ -65,10 +65,9 @@ afterEach(function() {
6565
});
6666
});
6767

68-
describe("basic support", function() {
69-
70-
describe("no children", function() {
71-
it("can display a Custom Element with no children", function() {
68+
describe("basic support", function () {
69+
describe("no children", function () {
70+
it("can display a Custom Element with no children", function () {
7271
this.weight = 3;
7372
let root;
7473
render(
@@ -83,7 +82,7 @@ describe("basic support", function() {
8382
});
8483
});
8584

86-
describe("with children", function() {
85+
describe("with children", function () {
8786
function expectHasChildren(wc) {
8887
expect(wc).to.exist;
8988
let shadowRoot = wc.shadowRoot;
@@ -95,7 +94,7 @@ describe("basic support", function() {
9594
expect(paragraph.textContent).to.eql("Test p");
9695
}
9796

98-
it("can display a Custom Element with children in a Shadow Root", function() {
97+
it("can display a Custom Element with children in a Shadow Root", function () {
9998
this.weight = 3;
10099
let root;
101100
render(
@@ -109,7 +108,7 @@ describe("basic support", function() {
109108
expectHasChildren(wc);
110109
});
111110

112-
it("can display a Custom Element with children in a Shadow Root and pass in Light DOM children", async function() {
111+
it("can display a Custom Element with children in a Shadow Root and pass in Light DOM children", async function () {
113112
this.weight = 3;
114113
let root;
115114
render(
@@ -127,7 +126,7 @@ describe("basic support", function() {
127126
expect(wc.textContent.includes("2")).to.be.true;
128127
});
129128

130-
it("can display a Custom Element with children in the Shadow DOM and handle hiding and showing the element", function() {
129+
it("can display a Custom Element with children in the Shadow DOM and handle hiding and showing the element", function () {
131130
this.weight = 3;
132131
let root;
133132
render(
@@ -142,7 +141,7 @@ describe("basic support", function() {
142141
act(() => {
143142
root.toggle();
144143
});
145-
let dummy = ReactDOM.findDOMNode(root.refs.dummy);
144+
let dummy = root.dummy.current;
146145
expect(dummy).to.exist;
147146
expect(dummy.textContent).to.eql("Dummy view");
148147
act(() => {
@@ -153,8 +152,8 @@ describe("basic support", function() {
153152
});
154153
});
155154

156-
describe("attributes and properties", function() {
157-
it("will pass boolean data as either an attribute or a property", function() {
155+
describe("attributes and properties", function () {
156+
it("will pass boolean data as either an attribute or a property", function () {
158157
this.weight = 3;
159158
let root;
160159
render(
@@ -169,7 +168,7 @@ describe("basic support", function() {
169168
expect(data).to.be.true;
170169
});
171170

172-
it("will pass numeric data as either an attribute or a property", function() {
171+
it("will pass numeric data as either an attribute or a property", function () {
173172
this.weight = 3;
174173
let root;
175174
render(
@@ -184,7 +183,7 @@ describe("basic support", function() {
184183
expect(parseInt(data, 10)).to.eql(42);
185184
});
186185

187-
it("will pass string data as either an attribute or a property", function() {
186+
it("will pass string data as either an attribute or a property", function () {
188187
this.weight = 3;
189188
let root;
190189
render(
@@ -236,8 +235,8 @@ describe("basic support", function() {
236235
// });
237236
});
238237

239-
describe("events", function() {
240-
it("can imperatively listen to a DOM event dispatched by a Custom Element", function() {
238+
describe("events", function () {
239+
it("can imperatively listen to a DOM event dispatched by a Custom Element", function () {
241240
this.weight = 3;
242241
let root;
243242
render(
@@ -252,9 +251,8 @@ describe("basic support", function() {
252251
expect(handled.textContent).to.eql("false");
253252
act(() => {
254253
wc.click();
255-
})
254+
});
256255
expect(handled.textContent).to.eql("true");
257256
});
258257
});
259-
260258
});

libraries/react-beta/src/components.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export class ComponentWithDifferentViews extends Component {
6666
constructor () {
6767
super();
6868
this.state = { showWC: true };
69+
this.dummy = React.createRef();
6970
}
7071
toggle() {
7172
this.setState({ showWC: !this.state.showWC });
@@ -77,7 +78,7 @@ export class ComponentWithDifferentViews extends Component {
7778
{showWC ? (
7879
<ce-with-children ref={(el) => this.wc = el}></ce-with-children>
7980
) : (
80-
<div ref="dummy">Dummy view</div>
81+
<div ref={this.dummy}>Dummy view</div>
8182
)}
8283
</div>
8384
);
@@ -153,7 +154,7 @@ export class ComponentWithImperativeEvent extends Component {
153154
return (
154155
<div>
155156
<div ref={(el) => this.handled = el}>{state.eventHandled.toString()}</div>
156-
<ce-with-event id="wc" ref={(el) => this.wc = el}></ce-with-event>
157+
<ce-with-event id="wc" ref={(el) => this.wc = el}></ce-with-event>
157158
</div>
158159
);
159160
}
@@ -205,7 +206,7 @@ export class ComponentWithDeclarativeEvent extends Component {
205206
oncamelEvent={this.handleCamelEvent}
206207
onCAPSevent={this.handleCapsEvent}
207208
onPascalEvent={this.handlePascalEvent}
208-
></ce-with-event>
209+
></ce-with-event>
209210
</div>
210211
);
211212
}

0 commit comments

Comments
 (0)