Skip to content

Commit

Permalink
[playground] Fix broken tests
Browse files Browse the repository at this point in the history
Our e2e setup with monaco is kinda brittle since it relies on the dom. It seems like longish text gets truncated so let's just simpify all these test cases.
  • Loading branch information
poteto committed Nov 18, 2024
1 parent 0dac86f commit a915617
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 314 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
function TestComponent(t0) {
  const $ = _c(2);
  const { x } = t0;
  let t1;
  if ($[0] !== x) {
    t1 = <Button>{x}</Button>;
    $[0] = x;
    $[1] = t1;
  } else {
    t1 = $[1];
  }
  return t1;
}
function TestComponent(t0) {
const $ = _c(2);
const { x } = t0;
let t1;
if ($[0] !== x) {
t1 = <Button>{x}</Button>;
$[0] = x;
$[1] = t1;
} else {
t1 = $[1];
}
return t1;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
function MyApp() {
  const $ = _c(1);
  let t0;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    t0 = <div>Hello World</div>;
    $[0] = t0;
  } else {
    t0 = $[0];
  }
  return t0;
}
function MyApp() {
const $ = _c(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = <div>Hello World</div>;
$[0] = t0;
} else {
t0 = $[0];
}
return t0;
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
function anonymous_1() {
  "use no memo";
  const Avatar = () => {
    return <div>Avatar Content</div>;
  };
  const MemoizedAvatar = React.memo(Avatar);
  const Bio = () => {
    const handleBioUpdate = () => {
      console.log("Bio updated");
    };
    return <div onClick={handleBioUpdate}>Bio Content</div>;
  };
  const MemoizedBio = React.memo(Bio);
  return (
    <div>
      <MemoizedAvatar />
      <MemoizedBio />
    </div>
  );
}
function anonymous_1({ x }) {
"use no memo";
return <Button>{x}</Button>;
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
function anonymous_1() {
  "use memo";
  const $ = _c(3);
  const Chart = _temp2;
  let t0;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    t0 = React.memo(Chart);
    $[0] = t0;
  } else {
    t0 = $[0];
  }
  const MemoizedChart = t0;
  const Graph = _temp3;
  let t1;
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
    t1 = React.memo(Graph);
    $[1] = t1;
  } else {
    t1 = $[1];
  }
  const MemoizedGraph = t1;
  let t2;
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
    t2 = (
      <div>
        <MemoizedChart />
        <MemoizedGraph />
      </div>
    );
    $[2] = t2;
  } else {
    t2 = $[2];
function anonymous_1(t0) {
"use memo";
const $ = _c(2);
const { x } = t0;
let t1;
if ($[0] !== x) {
t1 = <Button>{x}</Button>;
$[0] = x;
$[1] = t1;
} else {
t1 = $[1];
}
return t1;
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
function App() {
  "use memo";
  const $ = _c(3);
  let t0;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    const Sidebar = function Sidebar() {
      const handleToggle = _temp;
      return <aside onClick={handleToggle}>Sidebar Content</
          aside>;
    };
    t0 = React.memo(Sidebar);
    $[0] = t0;
  } else {
    t0 = $[0];
  }
  const MemoizedSidebar = t0;
  let t1;
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
    const Content = function Content() {
      return <main>Main Content</main>;
    };
    t1 = React.memo(Content);
    $[1] = t1;
  } else {
    t1 = $[1];
  }
  const MemoizedContent = t1;
  let t2;
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
    t2 = (
      <div>
        <MemoizedSidebar />
function TestComponent(t0) {
"use memo";
const $ = _c(2);
const { x } = t0;
let t1;
if ($[0] !== x) {
t1 = <Button>{x}</Button>;
$[0] = x;
$[1] = t1;
} else {
t1 = $[1];
}
return t1;
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
function Settings() {
  "use memo";
  const $ = _c(3);
  let t0;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    t0 = function Preferences() {
      const handleSave = _temp;
      return <div onClick={handleSave}>Preferences Content</
          div>;
    };
    $[0] = t0;
  } else {
    t0 = $[0];
  }
  const Preferences = t0;
  let t1;
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
    t1 = function Notifications() {
      return <div>Notifications Settings</div>;
    };
    $[1] = t1;
  } else {
    t1 = $[1];
  }
  const Notifications = t1;
  let t2;
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
    t2 = (
      <div>
        <Preferences />
        <Notifications />
      </div>
function TestComponent(t0) {
"use memo";
const $ = _c(2);
const { x } = t0;
let t1;
if ($[0] !== x) {
t1 = <Button>{x}</Button>;
$[0] = x;
$[1] = t1;
} else {
t1 = $[1];
}
return t1;
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
function anonymous_1() {
  "use no memo";
  const Widget = function () {
    const handleExpand = () => {
      console.log("Widget expanded");
    };
    return <div onClick={handleExpand}>Widget Content</div>;
  };
  const Panel = function () {
    return <section>Panel Information</section>;
  };
  return (
    <div>
      <Widget />
      <Panel />
    </div>
  );
}
function anonymous_1() {
"use no memo";
return <Button>{x}</Button>;
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
function anonymous_1() {
  const $ = _c(1);
  const handleClick = _temp;
  let t0;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    t0 = <h1 onClick={handleClick}>Welcome to the App!</h1>;
    $[0] = t0;
  } else {
    t0 = $[0];
  }
  return t0;
function TestComponent(t0) {
const $ = _c(2);
const { x } = t0;
let t1;
if ($[0] !== x) {
t1 = <Button>{x}</Button>;
$[0] = x;
$[1] = t1;
} else {
t1 = $[1];
}
return t1;
}
function _temp() {
  console.log("Header clicked");
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
function anonymous_1({
  return <aside>Sidebar Information</aside>;
}
function anonymous_1({ x }) {
return <Button>{x}</Button>;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
function anonymous_1() {
  const handleMouseOver = () => {
    console.log("Footer hovered");
  };
  return <footer onMouseOver={handleMouseOver}>Footer 
      Information</footer>;
}
function TestComponent({ x }) {
return <Button>{x}</Button>;
}
Loading

0 comments on commit a915617

Please sign in to comment.