Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: JSX template support #43

Open
3 tasks done
pfteter opened this issue Jun 14, 2024 · 0 comments
Open
3 tasks done

feat: JSX template support #43

pfteter opened this issue Jun 14, 2024 · 0 comments
Labels

Comments

@pfteter
Copy link

pfteter commented Jun 14, 2024

Prerequisites

Describe the Feature Request

Since PW stencil component tests use a string to define the component test setup it doesn't support multiple things that playwright component testing does like JSX mount.

Same as playwright component tests, stencil sould support JSX for setContent/ mount.

I was able to get it working using a jsx to string converter (mount is a fixture > page.setContent):

test('Button test', async ({mount}) => {
     const {container} = await mount(
    <stencil-button color={ButtonColor.PRIMARY} testSelector="save-button">
      Save
    </stencil-button>,
  )
}  

Benefits are obvious - highlighting, typing ...

Describe the Use Case

Component tests (setContent) should support syntax highlighting, typing, autocomplete ....

Describe Preferred Solution

Fo a working PoC I used:

      const html = jsxToString(jsxSource);
      await page.setContent(extendedHtml(html), options);

I used a library that renders JSX to string.

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant