Skip to content

Commit

Permalink
test(e2e): update nextjs imports for components w dynamic import due …
Browse files Browse the repository at this point in the history
…to use of dom api
  • Loading branch information
clukhei committed Dec 13, 2024
1 parent bee866f commit 30d3d6b
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 46 deletions.
3 changes: 3 additions & 0 deletions cypress/apps/angular-app/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,8 @@
}
}
}
},
"cli": {
"analytics": false
}
}
2 changes: 1 addition & 1 deletion cypress/apps/angular-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions cypress/apps/next-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion cypress/apps/next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
},
"dependencies": {
"@govtechsg/sgds-web-component": "file:../../../lib",
"@webcomponents/scoped-custom-element-registry": "^0.0.9",
"next": "14.2.3",
"react": "^18",
"react-dom": "^18"
Expand Down
2 changes: 0 additions & 2 deletions cypress/apps/next-app/src/app/components/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import SgdsAlert from "@govtechsg/sgds-web-component/react/alert/index.js";
import SgdsAlertHeading from "@govtechsg/sgds-web-component/react/alert-heading/index.js";
import SgdsAlertLink from "@govtechsg/sgds-web-component/react/alert-link/index.js";

export const Alert = () => {
Expand Down Expand Up @@ -36,7 +35,6 @@ export const Alert = () => {
</svg>
</span>
<div>
<SgdsAlertHeading>Hello, nice to meet you</SgdsAlertHeading>
<p>
Aww yeah, you successfully read this important
<SgdsAlertLink href="#">
Expand Down
9 changes: 7 additions & 2 deletions cypress/apps/next-app/src/app/components/Combobox.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import SgdsCombobox from "@govtechsg/sgds-web-component/react/combo-box/index.js";

import dynamic from "next/dynamic"
const SgdsCombobox = dynamic(
() => import("@govtechsg/sgds-web-component/react/combo-box/index.js"),
{
ssr: false,
}
);
export const Combobox = () => {
return (
<SgdsCombobox
Expand Down
9 changes: 7 additions & 2 deletions cypress/apps/next-app/src/app/components/Datepicker.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import SgdsDatepicker from "@govtechsg/sgds-web-component/react/datepicker/index.js";

import dynamic from "next/dynamic"
const SgdsDatepicker = dynamic(
() => import("@govtechsg/sgds-web-component/react/datepicker/index.js"),
{
ssr: false,
}
);
export const Datepicker = () => {
return <SgdsDatepicker dateFormat="DD/MM/YYYY" mode="single"></SgdsDatepicker>;
};
10 changes: 8 additions & 2 deletions cypress/apps/next-app/src/app/components/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import SgdsDropdownItem from "@govtechsg/sgds-web-component/react/dropdown-item/index.js";
import SgdsDropdown from "@govtechsg/sgds-web-component/react/dropdown/index.js"
import SgdsButton from "@govtechsg/sgds-web-component/react/button/index.js"
import dynamic from "next/dynamic"
const SgdsDropdown = dynamic(
() => import("@govtechsg/sgds-web-component/react/dropdown/index.js"),
{
ssr: false,
}
);
import SgdsButton from "@govtechsg/sgds-web-component/react/button/index.js"


export const Dropdown = () => {
Expand Down
8 changes: 7 additions & 1 deletion cypress/apps/next-app/src/app/components/Mainnav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ import SgdsButton from "@govtechsg/sgds-web-component/react/button/index.js";
import SgdsMainnavItem from "@govtechsg/sgds-web-component/react/mainnav-item/index.js";
import SgdsDropdownItem from "@govtechsg/sgds-web-component/react/dropdown-item/index.js";
import SgdsMainnav from "@govtechsg/sgds-web-component/react/mainnav/index.js";
import SgdsMainnavDropdown from "@govtechsg/sgds-web-component/react/mainnav-dropdown/index.js";
import dynamic from "next/dynamic"

const SgdsMainnavDropdown = dynamic(
() => import("@govtechsg/sgds-web-component/react/mainnav-dropdown/index.js"),
{
ssr: false,
}
);

export const Mainnav = () => {
return (
Expand Down
3 changes: 0 additions & 3 deletions cypress/apps/next-app/src/app/components/Progress.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import SgdsProgress from "@govtechsg/sgds-web-component/react/progress/index.js";
import SgdsProgressBar from "@govtechsg/sgds-web-component/react/progress-bar/index.js";

export const Progress = () => {
return (
<SgdsProgress>
<SgdsProgressBar
label="50%"
variant="secondary"
Expand All @@ -12,6 +10,5 @@ export const Progress = () => {
ariamax={100}
aria-label="Loading in progress"
></SgdsProgressBar>
</SgdsProgress>
);
};
9 changes: 7 additions & 2 deletions cypress/apps/next-app/src/app/components/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import SgdsTooltip from "@govtechsg/sgds-web-component/react/tooltip/index.js"

import dynamic from "next/dynamic"
const SgdsTooltip = dynamic(
() => import("@govtechsg/sgds-web-component/react/tooltip/index.js"),
{
ssr: false,
}
)
export const Tooltip = () => {
return (
<>
Expand Down
9 changes: 1 addition & 8 deletions cypress/apps/react-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions cypress/apps/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
]
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@webcomponents/scoped-custom-element-registry": "^0.0.9"
"@babel/plugin-proposal-private-property-in-object": "^7.21.11"
}
}
1 change: 0 additions & 1 deletion cypress/apps/react-app/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import "@webcomponents/scoped-custom-element-registry";
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
Expand Down
23 changes: 12 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"license": "MIT",
"dependencies": {
"@govtechsg/sgds": "^2.3.2",
"@lit-labs/react": "^1.0.9",
"@lit/react": "^1.0.6",
"@open-wc/scoped-elements": "2.2.0",
"@storybook/addon-a11y": "^8.2.8",
"bootstrap": "^5.1.3",
Expand Down
2 changes: 1 addition & 1 deletion scripts/makeReact.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ components.map(component => {
const source = prettier.format(
`
import * as React from 'react';
import { createComponent } from '@lit-labs/react';
import { createComponent } from '@lit/react';
import Component from '../../components/${importPath}';
import { register } from "../../utils/ce-registry";

Expand Down

0 comments on commit 30d3d6b

Please sign in to comment.