Skip to content

[feature] test-fixture-mocha to accept HTML in addition to ID #55

@sashafirsov

Description

@sashafirsov

Description

As for test author the splitting tested HTML and fixture(id) ( within HTML and test JS module ) become significant inconvenience. It forced to switch between HTML and JS while the size of common identifier (id) is often comparable to size of tested HTML itself

<test-fixture id="SomeElementFixture">
  <template>
    <some-element></some-element>
  </template>
</test-fixture>
someElement = fixture('SomeElementFixture');

Proposed

To pass an HTML string which will be instantiated instead of template body on separate HTML.

someElement = fixture(`<some-element></some-element>`);

Backward compatibe

The original signature with ID as parameter still will be in place. The HTML string could be detected either by presence of '<' character as 1st character of anywhere in string.

Benefits

  • no need to jump between HTML and test module during test development and debug
  • shorter code overall
  • no need to rely on any IDs, explicit element reference is used instead
  • no risk of using wrong IDs
  • yada-yada

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions