question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Experimental CT: Svelte named Slots

See original GitHub issue

Context:

  • Playwright Version: experimental-ct-svelte": 1.23.4
  • Operating System: Mac / Linux
  • Node.js version: 16.14.2 / 18.5.0
  • Browser: All
  • Extra: *

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and that we can run and debug locally. For example:

Reproduction: https://github.com/aMediocreDad/playwright-svelte-slots-repro

import { test, expect } from "@playwright/experimental-ct-svelte";

import Component from "./slot-example.svelte";

test("Named Slots", async ({ mount }) => {
	const component = await mount(Component, {
		props: {
			title: "Named Slots",
		},
		// This should work
		slots: {
			text: "Hello World",
		},
	});

	const title = component.locator("h1");

	await expect(title).toHaveText("Named Slots");

	const text = component.locator("p");

	// Yet, this fails
	await expect(text).toContainText("Hello World");
});

Describe the bug

While this is experimental the FAQ indicates that you can pass (text) to named slots when mounting the Svelte component.

This seems to be wrong. It would, however, be a desirable feature.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
aMediocreDadcommented, Aug 18, 2022

@aMediocreDad Did you manage to make it work for your use case by following sveltejs/svelte#2588. Code there does not seem to work for me.

No, I have not tried using those solutions. We use the same solutions we do for Storybook, which is using a svelte component that wraps the one being tested populating the slot with relevant parameters exposed through props.

1reaction
sand4rtcommented, Oct 11, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Component composition / Named slots • Svelte Tutorial
In those cases, we can use named slots. In ContactCard.svelte , add a name attribute to each slot: <article class="contact-card"> <h2> <slot name="name"> ......
Read more >
Cypress Component Testing
Cypress Component Testing provides a component workbench for you to quickly build and test components from multiple front-end UI libraries — no matter....
Read more >
chore: mount should return locator pointing to the component ...
chore: mount should return locator pointing to the component element / fragment (#12718. An error occurred. ) ; packages/playwright-ct-react/package.json · @ -1,7 ...
Read more >
dvg - River Thames Conditions - Environment Agency - GOV.UK
Letkol bonar panjaitan, Turkey vulture scientific name, Adventure inc tv wiki, ... Scottsdale arrests mugshots, Jwulink library, Lord of ocean slot online, ...
Read more >
Untitled
Fernando villaverde sporting, Attribute name xsl, Francisco javier ahedo infante, Park avenue 580 piso 15 b, Every cell contains a number of, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found