mirror of
https://github.com/minio/minio.git
synced 2025-05-21 09:33:50 -04:00
Select object if user clicks anywhere on object name for browser (#9649)
Fixes #9647
This commit is contained in:
parent
c54e3b4ea3
commit
f706a5b4c8
@ -54,8 +54,11 @@ export const ObjectItem = ({
|
|||||||
href={getDataType(name, contentType) === "folder" ? name : "#"}
|
href={getDataType(name, contentType) === "folder" ? name : "#"}
|
||||||
onClick={e => {
|
onClick={e => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
// onclick function is passed only when we have a prefix
|
||||||
if (onClick) {
|
if (onClick) {
|
||||||
onClick()
|
onClick()
|
||||||
|
} else {
|
||||||
|
checked ? uncheckObject(name) : checkObject(name)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -30,7 +30,10 @@ describe("ObjectItem", () => {
|
|||||||
|
|
||||||
it("shouldn't call onClick when the object isclicked", () => {
|
it("shouldn't call onClick when the object isclicked", () => {
|
||||||
const onClick = jest.fn()
|
const onClick = jest.fn()
|
||||||
const wrapper = shallow(<ObjectItem name={"test"} />)
|
const checkObject = jest.fn()
|
||||||
|
const wrapper = shallow(
|
||||||
|
<ObjectItem name={"test"} checkObject={checkObject} />
|
||||||
|
)
|
||||||
wrapper.find("a").simulate("click", { preventDefault: jest.fn() })
|
wrapper.find("a").simulate("click", { preventDefault: jest.fn() })
|
||||||
expect(onClick).not.toHaveBeenCalled()
|
expect(onClick).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
@ -57,9 +60,15 @@ describe("ObjectItem", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("should call uncheckObject when the object/prefix is unchecked", () => {
|
it("should call uncheckObject when the object/prefix is unchecked", () => {
|
||||||
|
const checkObject = jest.fn()
|
||||||
const uncheckObject = jest.fn()
|
const uncheckObject = jest.fn()
|
||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<ObjectItem name={"test"} checked={true} uncheckObject={uncheckObject} />
|
<ObjectItem
|
||||||
|
name={"test"}
|
||||||
|
checked={true}
|
||||||
|
checkObject={checkObject}
|
||||||
|
uncheckObject={uncheckObject}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
wrapper.find("input[type='checkbox']").simulate("change")
|
wrapper.find("input[type='checkbox']").simulate("change")
|
||||||
expect(uncheckObject).toHaveBeenCalledWith("test")
|
expect(uncheckObject).toHaveBeenCalledWith("test")
|
||||||
|
@ -105,7 +105,7 @@ div.fesl-row {
|
|||||||
|
|
||||||
.fesl-item-name {
|
.fesl-item-name {
|
||||||
a {
|
a {
|
||||||
cursor: default;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,12 +114,6 @@ div.fesl-row {
|
|||||||
----------------------------*/
|
----------------------------*/
|
||||||
&[data-type=folder] {
|
&[data-type=folder] {
|
||||||
.list-type(#a1d6dd, '\f07b');
|
.list-type(#a1d6dd, '\f07b');
|
||||||
|
|
||||||
.fesl-item-name {
|
|
||||||
a {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
&[data-type=pdf] {.list-type(#fa7775, '\f1c1'); }
|
&[data-type=pdf] {.list-type(#fa7775, '\f1c1'); }
|
||||||
&[data-type=zip] { .list-type(#427089, '\f1c6'); }
|
&[data-type=zip] { .list-type(#427089, '\f1c6'); }
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user