|
|
@ -39,7 +39,7 @@ test("should render the divs correctly with string content", () => { |
|
|
|
expect(label["labelDiv"]).toMatchInlineSnapshot(` |
|
|
|
expect(label["labelDiv"]).toMatchInlineSnapshot(` |
|
|
|
<div |
|
|
|
<div |
|
|
|
class="label marker-label" |
|
|
|
class="label marker-label" |
|
|
|
style="position: absolute; opacity: 1; left: 1px; top: 3px; z-index: 4;" |
|
|
|
style="position: absolute; opacity: 1; display: block; left: 1px; top: 3px; z-index: 4;" |
|
|
|
> |
|
|
|
> |
|
|
|
foo |
|
|
|
foo |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -47,7 +47,7 @@ test("should render the divs correctly with string content", () => { |
|
|
|
expect(label["eventDiv"]).toMatchInlineSnapshot(` |
|
|
|
expect(label["eventDiv"]).toMatchInlineSnapshot(` |
|
|
|
<div |
|
|
|
<div |
|
|
|
class="label marker-label-event" |
|
|
|
class="label marker-label-event" |
|
|
|
style="position: absolute; opacity: 0.01; cursor: pointer; left: 1px; top: 3px; z-index: 4; display: block;" |
|
|
|
style="position: absolute; opacity: 0.01; cursor: pointer; display: block; left: 1px; top: 3px; z-index: 4;" |
|
|
|
> |
|
|
|
> |
|
|
|
foo |
|
|
|
foo |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -60,7 +60,7 @@ test("should render the divs correctly with node content", () => { |
|
|
|
expect(label["labelDiv"]).toMatchInlineSnapshot(` |
|
|
|
expect(label["labelDiv"]).toMatchInlineSnapshot(` |
|
|
|
<div |
|
|
|
<div |
|
|
|
class="marker-label" |
|
|
|
class="marker-label" |
|
|
|
style="position: absolute; opacity: 1; left: 1px; top: 3px; z-index: 4;" |
|
|
|
style="position: absolute; opacity: 1; display: block; left: 1px; top: 3px; z-index: 4;" |
|
|
|
> |
|
|
|
> |
|
|
|
<img /> |
|
|
|
<img /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -68,7 +68,7 @@ test("should render the divs correctly with node content", () => { |
|
|
|
expect(label["eventDiv"]).toMatchInlineSnapshot(` |
|
|
|
expect(label["eventDiv"]).toMatchInlineSnapshot(` |
|
|
|
<div |
|
|
|
<div |
|
|
|
class="marker-label marker-label-event" |
|
|
|
class="marker-label marker-label-event" |
|
|
|
style="position: absolute; opacity: 0.01; cursor: pointer; left: 1px; top: 3px; z-index: 4; display: block;" |
|
|
|
style="position: absolute; opacity: 0.01; cursor: pointer; display: block; left: 1px; top: 3px; z-index: 4;" |
|
|
|
> |
|
|
|
> |
|
|
|
<img /> |
|
|
|
<img /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -91,7 +91,7 @@ test("should render the divs with options", () => { |
|
|
|
expect(label["labelDiv"]).toMatchInlineSnapshot(` |
|
|
|
expect(label["labelDiv"]).toMatchInlineSnapshot(` |
|
|
|
<div |
|
|
|
<div |
|
|
|
class="label marker-label" |
|
|
|
class="label marker-label" |
|
|
|
style="position: absolute; opacity: 0.5; left: 1px; top: 3px; z-index: 1010;" |
|
|
|
style="position: absolute; opacity: 0.5; display: block; left: 1px; top: 3px; z-index: 1010;" |
|
|
|
> |
|
|
|
> |
|
|
|
foo |
|
|
|
foo |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -99,26 +99,29 @@ test("should render the divs with options", () => { |
|
|
|
expect(label["eventDiv"]).toMatchInlineSnapshot(` |
|
|
|
expect(label["eventDiv"]).toMatchInlineSnapshot(` |
|
|
|
<div |
|
|
|
<div |
|
|
|
class="label marker-label-event" |
|
|
|
class="label marker-label-event" |
|
|
|
style="position: absolute; opacity: 0.01; left: 1px; top: 3px; z-index: 1010; display: none; cursor: inherit;" |
|
|
|
style="position: absolute; opacity: 0.01; display: none; left: 1px; top: 3px; z-index: 1010; cursor: inherit;" |
|
|
|
> |
|
|
|
> |
|
|
|
foo |
|
|
|
foo |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
`);
|
|
|
|
`);
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test("should render the event div based upon interactivity", () => { |
|
|
|
test.each([ |
|
|
|
const label = new Label({ |
|
|
|
[false, false, "none"], |
|
|
|
labelContent: "foo", |
|
|
|
[true, false, "block"], |
|
|
|
draggable: false, |
|
|
|
[false, true, "block"], |
|
|
|
clickable: false, |
|
|
|
[true, true, "block"], |
|
|
|
}); |
|
|
|
])( |
|
|
|
|
|
|
|
"should render the event div based upon interactivity %s %s %s", |
|
|
|
|
|
|
|
(clickable, draggable, display) => { |
|
|
|
|
|
|
|
const label = new Label({ |
|
|
|
|
|
|
|
labelContent: "foo", |
|
|
|
|
|
|
|
draggable: false, |
|
|
|
|
|
|
|
clickable: false, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
label.visible = true; |
|
|
|
|
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
[false, false, "none"], |
|
|
|
|
|
|
|
[true, false, "block"], |
|
|
|
|
|
|
|
[false, true, "block"], |
|
|
|
|
|
|
|
[true, true, "block"], |
|
|
|
|
|
|
|
].map(([clickable, draggable, display]: [boolean, boolean, string]) => { |
|
|
|
|
|
|
|
label.clickable = clickable; |
|
|
|
label.clickable = clickable; |
|
|
|
label.draggable = draggable; |
|
|
|
label.draggable = draggable; |
|
|
|
label.draw(); |
|
|
|
label.draw(); |
|
|
@ -126,5 +129,16 @@ test("should render the event div based upon interactivity", () => { |
|
|
|
expect(label["eventDiv"].style.cursor).toBe( |
|
|
|
expect(label["eventDiv"].style.cursor).toBe( |
|
|
|
display === "block" ? "pointer" : "inherit" |
|
|
|
display === "block" ? "pointer" : "inherit" |
|
|
|
); |
|
|
|
); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test("should not display event div if marker is not visible", () => { |
|
|
|
|
|
|
|
const label = new Label({ labelContent: "foo" }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
label.clickable = true; |
|
|
|
|
|
|
|
label.draggable = true; |
|
|
|
|
|
|
|
label.visible = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
label.draw(); |
|
|
|
|
|
|
|
expect(label["eventDiv"].style.display).toBe("none"); |
|
|
|
}); |
|
|
|
}); |
|
|
|