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

Release 0.12.4 #789

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/devtools-reps/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "devtools-reps",
"version": "0.12.3",
"version": "0.12.4",
"description": "Devtools Reps",
"main": "src/index.js",
"scripts": {
Expand Down
6 changes: 5 additions & 1 deletion packages/devtools-reps/src/reps/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ StringRep.propTypes = {
member: React.PropTypes.any,
cropLimit: React.PropTypes.number,
openLink: React.PropTypes.func,
omitLinkHref: React.PropTypes.bool,
};

function StringRep(props) {
Expand All @@ -41,6 +42,7 @@ function StringRep(props) {
useQuotes = true,
escapeWhitespace = true,
openLink,
omitLinkHref = true,
} = props;

let config = {className: "objectBox objectBox-string"};
Expand Down Expand Up @@ -78,7 +80,9 @@ function StringRep(props) {
items.push(a({
className: "url",
title: token,
href: token,
href: omitLinkHref === true
? null
: token,
draggable: false,
onClick: openLink
? e => {
Expand Down
19 changes: 18 additions & 1 deletion packages/devtools-reps/src/reps/tests/string-with-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const { Rep } = REPS;

const renderRep = (string, props) => mount(
Rep(Object.assign({
object: string
object: string,
omitLinkHref: false,
}, props))
);

Expand Down Expand Up @@ -255,4 +256,20 @@ describe("test String with URL", () => {
link.simulate("click");
expect(openLink).toBeCalledWith(url);
});

it("does not create an href attribute if omitLinkHref is true", () => {
const url = "http://example.com";
const element = renderRep(url, {omitLinkHref: true, useQuotes: false});
expect(element.text()).toEqual(url);
const link = element.find("a");
expect(link.prop("href")).toBe(null);
});

it("does not create an href attribute if omitLinkHref is undefined", () => {
const url = "http://example.com";
const element = mount(Rep({ object: url, useQuotes: false }));
expect(element.text()).toEqual(url);
const link = element.find("a");
expect(link.prop("href")).toBe(null);
});
});
Loading