Skip to content

Commit ec971c6

Browse files
committed
Updated test code with named arguments
1 parent 8b70c65 commit ec971c6

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

examples/dom_example.res

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ let _ =
5353
document
5454
->Document.asHtmlDocument
5555
->flatMap(HtmlDocument.body)
56-
->map(body => body->Element.appendChild(el))
56+
->map(body => body->Element.appendChild(~child=el))
5757

5858
/*
5959
/*

tests/Webapi/Dom/Webapi__Dom__HtmlFormElement__test.res

+22-22
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let createInput = () => createElement("input")
1212
let createLabelWithText = text => {
1313
let el = createElement("label")
1414
let textNode = createTextNode(text)
15-
Element.appendChild(el, textNode)
15+
Element.appendChild(el, ~child=textNode)
1616
el
1717
}
1818

@@ -25,15 +25,15 @@ Element.setAttribute(usernameInput, "name", "username")
2525
Element.setAttribute(usernameInput, "value", "username")
2626

2727
let usernameLabel = createLabelWithText("Username:")
28-
Element.appendChild(usernameLabel, usernameInput)
28+
Element.appendChild(usernameLabel, ~child=usernameInput)
2929

3030
let passwordInput = createInput()
3131
Element.setAttribute(passwordInput, "type", "password")
3232
Element.setAttribute(passwordInput, "name", "password")
3333
Element.setAttribute(passwordInput, "value", "password")
3434

3535
let passwordLabel = createLabelWithText("Password:")
36-
Element.appendChild(passwordLabel, passwordInput)
36+
Element.appendChild(passwordLabel, ~child=passwordInput)
3737

3838
let radioInput1 = createInput()
3939
Element.setAttribute(radioInput1, "type", "radio")
@@ -42,7 +42,7 @@ Element.setAttribute(radioInput1, "value", "one")
4242
Element.setAttribute(radioInput1, "checked", "true")
4343

4444
let radioLabel1 = createLabelWithText("Choice 1:")
45-
Element.appendChild(radioLabel1, radioInput1)
45+
Element.appendChild(radioLabel1, ~child=radioInput1)
4646

4747
let radioInput2 = createInput()
4848
Element.setAttribute(radioInput2, "type", "radio")
@@ -51,34 +51,34 @@ Element.setAttribute(radioInput2, "value", "two")
5151
// Element.setAttribute(radioInput2, "checked", "true");
5252

5353
let radioLabel2 = createLabelWithText("Choice 2:")
54-
Element.appendChild(radioLabel2, radioInput2)
54+
Element.appendChild(radioLabel2, ~child=radioInput2)
5555

5656
let select = createElement("select")
5757
Element.setAttribute(select, "name", "select")
5858
let selectLabel = createLabelWithText("Select:")
59-
Element.appendChild(selectLabel, select)
59+
Element.appendChild(selectLabel, ~child=select)
6060

6161
let usernameContainer = createElement("div")
6262
let passwordContainer = createElement("div")
6363
let radioContainer = createElement("div")
6464
let selectContainer = createElement("div")
6565

66-
Element.appendChild(usernameContainer, usernameLabel)
67-
Element.appendChild(passwordContainer, passwordLabel)
68-
Element.appendChild(radioContainer, radioLabel1)
69-
Element.appendChild(radioContainer, radioLabel2)
70-
Element.appendChild(selectContainer, selectLabel)
71-
Element.appendChild(formEl, usernameContainer)
72-
Element.appendChild(formEl, passwordContainer)
73-
Element.appendChild(formEl, radioContainer)
74-
Element.appendChild(formEl, selectContainer)
66+
Element.appendChild(usernameContainer, ~child=usernameLabel)
67+
Element.appendChild(passwordContainer, ~child=passwordLabel)
68+
Element.appendChild(radioContainer, ~child=radioLabel1)
69+
Element.appendChild(radioContainer, ~child=radioLabel2)
70+
Element.appendChild(selectContainer, ~child=selectLabel)
71+
Element.appendChild(formEl, ~child=usernameContainer)
72+
Element.appendChild(formEl, ~child=passwordContainer)
73+
Element.appendChild(formEl, ~child=radioContainer)
74+
Element.appendChild(formEl, ~child=selectContainer)
7575

7676
let body =
7777
Document.asHtmlDocument(document)
7878
->Belt.Option.flatMap(HtmlDocument.body)
7979
->TestHelpers.unsafelyUnwrapOption
8080

81-
Element.appendChild(body, formEl)
81+
Element.appendChild(body, ~child=formEl)
8282

8383
let collection = elements(form)
8484

@@ -151,7 +151,7 @@ HtmlOptionsCollection.setLength(opts, 0)
151151

152152
let opt1 = createElement("option")
153153
Element.setAttribute(opt1, "value", "1")
154-
Element.appendChild(opt1, createTextNode("opt1"))
154+
Element.appendChild(opt1, ~child=createTextNode("opt1"))
155155

156156
HtmlOptionsCollection.add(
157157
opts,
@@ -164,7 +164,7 @@ Js.log2("collection length:", HtmlOptionsCollection.length(opts))
164164

165165
let opt2 = createElement("option")
166166
Element.setAttribute(opt2, "value", "2")
167-
Element.appendChild(opt2, createTextNode("opt2"))
167+
Element.appendChild(opt2, ~child=createTextNode("opt2"))
168168

169169
let item = HtmlOptionsCollection.item(opts, 0)
170170
jsAssert(Belt.Option.isSome(item), "HtmlOptionsCollection.item should return an item")
@@ -189,7 +189,7 @@ jsAssert(HtmlOptionsCollection.selectedIndex(opts) == -1, "HtmlOptionsCollection
189189

190190
let opt3 = createElement("option")
191191
Element.setAttribute(opt3, "value", "3")
192-
Element.appendChild(opt3, createTextNode("opt3"))
192+
Element.appendChild(opt3, ~child=createTextNode("opt3"))
193193

194194
HtmlOptionsCollection.add(
195195
opts,
@@ -230,7 +230,7 @@ HtmlSelectElement.setLength(select, 0)
230230

231231
let opt1 = createElement("option")
232232
Element.setAttribute(opt1, "value", "1")
233-
Element.appendChild(opt1, createTextNode("opt1"))
233+
Element.appendChild(opt1, ~child=createTextNode("opt1"))
234234

235235
HtmlSelectElement.add(
236236
select,
@@ -243,7 +243,7 @@ Js.log2("collection length:", HtmlSelectElement.length(select))
243243

244244
let opt2 = createElement("option")
245245
Element.setAttribute(opt2, "value", "2")
246-
Element.appendChild(opt2, createTextNode("opt2"))
246+
Element.appendChild(opt2, ~child=createTextNode("opt2"))
247247

248248
let item = HtmlSelectElement.item(select, 0)
249249
jsAssert(Belt.Option.isSome(item), "HtmlSelectElement.item should return an item")
@@ -268,7 +268,7 @@ jsAssert(HtmlSelectElement.selectedIndex(select) == -1, "HtmlSelectElement.clear
268268

269269
let opt3 = createElement("option")
270270
Element.setAttribute(opt3, "value", "3")
271-
Element.appendChild(opt3, createTextNode("opt3"))
271+
Element.appendChild(opt3, ~child=createTextNode("opt3"))
272272

273273
HtmlSelectElement.add(
274274
select,

tests/Webapi/Webapi__IntersectionObserver__test.res

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let body =
77

88
Webapi.Dom.Element.setInnerText(el, "Hello There")
99
Webapi.Dom.Element.setAttribute(el, "style", "margin-top: 800px; margin-bottom: 800px")
10-
Webapi.Dom.Element.appendChild(body, el)
10+
Webapi.Dom.Element.appendChild(body, ~child=el)
1111

1212
let handler = (entries, observer) => {
1313
Js.Array.forEach(entry => {

0 commit comments

Comments
 (0)