Skip to content

LWC Autocomplete for component names in test files should use dashes #504

@randi274

Description

@randi274

Is your feature request related to a problem? Please describe.
In Jest files, to create an element you need to use the dashed name, not the component bundle name to create the element. The component bundle name is being provided, and it creates a compile error when autocomplete is used.

Describe the solution you'd like
When creating an element to test in a Jest file, we're providing an autocomplete with the lwcTypingsName, but this doesn't provide the dashed name that is semantically correct.

Describe alternatives you've considered
You can easily modify it once you've autocompleted. But it would be better if you didn't have to!

Additional context
From the LWC documentation: "Camel case component folder names map to kebab-case in markup.". Note the callout that underscores are also legal.

Here is the correctly formatted name with the list of incorrect autocompletes that we provide:
LWC Retry Weirdness

In the markup, the correct syntax would be: c-account-map -> currently works fine, is completed by the htmlCompletion from the VS Code HTML Language Service.
When importing a component (in regular JS file or the test), the correct syntax to import a method from another component would be: import { doSomething } from 'c/accountMap'; -> our current autocomplete is correct here.
When creating an element to test, the correct syntax would be: c-account-map .

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions