Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Improve unittest, update docs example
Browse files Browse the repository at this point in the history
  • Loading branch information
lookacat committed Mar 9, 2022
1 parent 20f8a29 commit 8131eef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,16 @@ const indicator = {
}
describe("OcStatusIndicators", () => {
it("does call indicator handler on click", () => {
var called = false
const spyHandler = jest.spyOn(indicator, "handler")
const wrapper = mount(StatusIndicators, {
propsData: {
resource: fileResource,
indicators: [
{
id: "test",
label: "test",
type: "test",
handler: () => {
called = true
},
},
],
indicators: [indicator],
target: "test",
},
})
wrapper.find(".oc-status-indicators-indicator").trigger("click")
expect(called).toBeTruthy()
expect(spyHandler).toHaveBeenCalled()
})
it("does create indicator with id", () => {
const wrapper = mount(StatusIndicators, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default {
.oc-status-indicators {
align-items: center;
display: flex;
float: right;
justify-content: flex-end;
&-indicator {
border-radius: 99px;
}
Expand Down Expand Up @@ -148,6 +148,7 @@ export default {
id: 'file-link',
label: "Shared via link",
icon: 'links',
handler: (resource, indicatorId) => alert(`Resource: ${resource.name}, indicator: ${indicatorId}`)
}
]
}),
Expand Down

0 comments on commit 8131eef

Please sign in to comment.