diff --git a/src/ReactDOMTestUtils.re b/src/ReactDOMTestUtils.re index 82c5d606d..a51814378 100644 --- a/src/ReactDOMTestUtils.re +++ b/src/ReactDOMTestUtils.re @@ -123,7 +123,9 @@ module DOM = { let findBySelectorAndPartialTextContent = (element, selector, content) => querySelectorAll(element, selector) - |> Array.find_opt(node => node->textContent->Js.String2.includes(content)); + |> Array.find_opt(node => + Js.String.includes(~sub=content, node->textContent, ()) + ); }; let prepareContainer = (container: ref(option(Dom.element)), ()) => { diff --git a/src/ReasonReactRouter.re b/src/ReasonReactRouter.re index 89603b17a..e6574e54d 100644 --- a/src/ReasonReactRouter.re +++ b/src/ReasonReactRouter.re @@ -73,23 +73,22 @@ let pathParse = str => | "/" => [] | raw => /* remove the preceeding /, which every pathname seems to have */ - let raw = Js.String.sliceToEnd(~from=1, raw); + let raw = Js.String.slice(~start=1, raw, ()); /* remove the trailing /, which some pathnames might have. Ugh */ let raw = switch (Js.String.get(raw, Js.String.length(raw) - 1)) { - | "/" => Js.String.slice(~from=0, ~to_=-1, raw) + | "/" => Js.String.slice(~start=0, ~end_=-1, raw, ()) | _ => raw }; /* remove search portion if present in string */ let raw = - switch (raw |> Js.String.splitAtMost("?", ~limit=2)) { + switch (Js.String.split(~sep="?", ~limit=2, raw, ())) { | [|path, _|] => path | _ => raw }; - raw - |> Js.String.split("/") - |> Js.Array.filter(item => String.length(item) != 0) + Js.String.split(~sep="/", raw, ()) + |> Js.Array.filter(~f=item => String.length(item) != 0) |> arrayToList; }; let path = (~serverUrlString=?, ()) => @@ -109,7 +108,7 @@ let hash = () => | raw => /* remove the preceeding #, which every hash seems to have. Why is this even included in location.hash?? */ - raw |> Js.String.sliceToEnd(~from=1) + Js.String.slice(~start=1, raw, ()) } }; let searchParse = str => @@ -117,7 +116,7 @@ let searchParse = str => | "" | "?" => "" | raw => - switch (raw |> Js.String.splitAtMost("?", ~limit=2)) { + switch (Js.String.split(~sep="?", ~limit=2, raw, ())) { | [|_, search|] => search | _ => "" } diff --git a/test/React__test.re b/test/React__test.re index 8b26c8339..eba55d20f 100644 --- a/test/React__test.re +++ b/test/React__test.re @@ -335,7 +335,7 @@ describe("React", () => { fallback={({error: _, info}) => { expect( info.componentStack - ->Js.String2.includes("ComponentThatThrows"), + ->Js.String.includes(~sub="ComponentThatThrows", ()), ) ->toBe(true); "An error occured"->React.string ;