Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Cropped URL href is wrong #616

@nchevobbe

Description

@nchevobbe

Steps to reproduce:

Render a url string rep with a cropLimit prop that will crop the URL, e.g.

StringRep.rep({
  object: "http://example.com",
  cropLimit: 15
});

Expected results:
The URL is rendered as "http://…ple.com", but as an href attribute of "http://example.com"

Actual results:
The URL is rendered as "http://…ple.com", as well as the href attribute, which is wrong


The following test should pass, which it does not at the moment:

  it("renders a URL for a cropped string", () => {
    const url = "http://example.com";
    const openLink = jest.fn();
    const element = renderRep(url, {
      openLink,
      useQuotes: false,
      cropLimit: 15
    });
    expect(element.text()).toEqual(url);
    const link = element.find("a");
    expect(link.prop("href")).toBe(url);
    expect(link.prop("title")).toBe(url);

    link.simulate("click");
    expect(openLink).toBeCalledWith(url);
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions