Skip to content

Commit

Permalink
Allow 'list' attribute to input
Browse files Browse the repository at this point in the history
  • Loading branch information
allevo committed Jun 20, 2024
1 parent 90eb24c commit c974759
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 5 deletions.
26 changes: 21 additions & 5 deletions packages/seqflow-js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -752,20 +752,36 @@ declare global {
data?: Record<string, any>,
) => Promise<void>);

type Foo = {
[K in keyof HTMLElementTagNameMap]: Omit<
type IntrinsicEl = Omit<
{
[K in keyof HTMLElementTagNameMap]: Omit<
Partial<{
[V in keyof HTMLElementTagNameMap[K]]: HTMLElementTagNameMap[K][V];
}>,
"style"
> &
ARG<{
style?: Partial<CSSStyleDeclaration> | string;
onClick?: (ev: MouseEvent) => void;
key?: string;
}>;
},
"input"
> & {
input: Omit<
Partial<{
[V in keyof HTMLElementTagNameMap[K]]: HTMLElementTagNameMap[K][V];
[V in keyof HTMLElementTagNameMap["input"]]: HTMLElementTagNameMap["input"][V];
}>,
"style"
"style" | "list"
> &
ARG<{
style?: Partial<CSSStyleDeclaration> | string;
onClick?: (ev: MouseEvent) => void;
key?: string;
list?: string;
}>;
};
interface IntrinsicElements extends Foo {}
interface IntrinsicElements extends IntrinsicEl {}

interface IntrinsicAttributes {
key?: string;
Expand Down
21 changes: 21 additions & 0 deletions packages/seqflow-js/tests/types.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { screen, waitFor } from "@testing-library/dom";
import { expect, test } from "vitest";
import { type Log, type SeqflowFunctionContext, start } from "../src/index";

test("render simple button", async () => {
async function App(this: SeqflowFunctionContext, data: { text: string }) {
this.renderSync(<input list="button" />);
}

start(
document.body,
App,
{
text: "increment",
},
{},
);
expect(document.body.innerHTML).toBe(

Check failure on line 18 in packages/seqflow-js/tests/types.test.tsx

View workflow job for this annotation

GitHub Actions / Build and Test

tests/types.test.tsx > render simple button

AssertionError: expected '<input list="button">' to be '<button type="button">increment</butt…' // Object.is equality - Expected + Received - <button type="button">increment</button> + <input list="button"> ❯ tests/types.test.tsx:18:34
'<button type="button">increment</button>',
);
});

0 comments on commit c974759

Please sign in to comment.