diff --git a/scripts/test-utils.js b/scripts/test-utils.js
index 4e97b6e..7a6c39d 100644
--- a/scripts/test-utils.js
+++ b/scripts/test-utils.js
@@ -81,5 +81,5 @@ function generateIndexFileContent({ testUtilType, buildFinderInterface }) {
function compileTypescript() {
const config = path.resolve("src/test-utils/tsconfig.json");
- execaSync("tsc", ["-p", config, "--sourceMap"], { stdio: "inherit" });
+ execaSync("tsc", ["-p", config, "--sourceMap", "--inlineSources"], { stdio: "inherit" });
}
diff --git a/src/__tests__/base-props-support.test.tsx b/src/__tests__/base-props-support.test.tsx
index ee5dfc5..c1eb9c9 100644
--- a/src/__tests__/base-props-support.test.tsx
+++ b/src/__tests__/base-props-support.test.tsx
@@ -19,9 +19,9 @@ describe(`base props support for code-view`, async () => {
expect(container.firstElementChild).toHaveAttribute("data-testid", "example");
});
- test("should allow id", () => {
+ test("should not allow id", () => {
const { container } = renderComponent();
- expect(container.querySelector("#example")).not.toBeNull();
+ expect(container.querySelector("#example")).toBeNull();
});
test("should not allow className", () => {
diff --git a/src/internal/base-component/get-data-attributes.ts b/src/internal/base-component/get-data-attributes.ts
deleted file mode 100644
index 83c3078..0000000
--- a/src/internal/base-component/get-data-attributes.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
-// SPDX-License-Identifier: Apache-2.0
-
-export function getDataAttributes(props: Record) {
- const result: Record = {};
- Object.keys(props).forEach((prop) => {
- if (prop.startsWith("data-")) {
- result[prop] = props[prop];
- }
- });
- return result;
-}
diff --git a/src/internal/base-component/use-base-component.ts b/src/internal/base-component/use-base-component.ts
index 81a7e37..e9292f2 100644
--- a/src/internal/base-component/use-base-component.ts
+++ b/src/internal/base-component/use-base-component.ts
@@ -27,28 +27,18 @@ export default function useBaseComponent(componentName: string, config?
return { __internalRootRef: elementRef };
}
-export interface BaseComponentProps {
- /**
- * Adds the specified classes to the root element of the component.
- * @deprecated Custom CSS is not supported. For other use cases, use [data attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes).
- */
- className?: string;
- /**
- * Adds the specified ID to the root element of the component.
- * @deprecated Custom CSS is not supported. For other use cases, use [data attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes).
- */
- id?: string;
- // we also support data-* attributes, but they are always implicitly allowed by typescript
- // http://www.typescriptlang.org/docs/handbook/jsx.html#attribute-type-checking
- // "Note: If an attribute name is not a valid JS identifier (like a data-* attribute), it is not considered to be an error"
-}
+// we also support data-* attributes, but they are always implicitly allowed by typescript
+// http://www.typescriptlang.org/docs/handbook/jsx.html#attribute-type-checking
+// "Note: If an attribute name is not a valid JS identifier (like a data-* attribute), it is not considered to be an error"
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
+export interface BaseComponentProps {}
export function getBaseProps(props: BaseComponentProps) {
- const baseProps: Record = {};
+ const baseProps: Record = {};
Object.keys(props).forEach((prop) => {
- if (prop === "id" || prop.match(/^data-/)) {
- baseProps[prop] = (props as Record)[prop];
+ if (prop.startsWith("data-")) {
+ baseProps[prop] = (props as Record)[prop];
}
});
- return baseProps as BaseComponentProps;
+ return baseProps;
}
diff --git a/vite.unit.config.mjs b/vite.unit.config.mjs
index 19607ed..c44dbf9 100644
--- a/vite.unit.config.mjs
+++ b/vite.unit.config.mjs
@@ -17,7 +17,7 @@ export default defineConfig({
enabled: process.env.CI === "true",
provider: "istanbul",
include: ["src/**", "lib/components/**"],
- exclude: ["**/debug-tools/**", "**/__tests__/**", "**/*.d.ts"],
+ exclude: ["**/__tests__/**", "**/*.d.ts", "**/api-docs/**", "**/test-utils/selectors/**"],
},
},
});