-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31ac756
commit 6bbadd6
Showing
5 changed files
with
125 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
app/static/tests/unit/components/plot/wodinPlotDownloadImageModal.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {shallowMount} from "@vue/test-utils"; | ||
import WodinPlotDownloadImageModal from "../../../../src/app/components/plot/WodinPlotDownloadImageModal.vue"; | ||
|
||
describe("WodinPlotDownloadImageModal", () => { | ||
const getWrapper = () => { | ||
return shallowMount(WodinPlotDownloadImageModal, { | ||
props: { | ||
title: "Test Title", | ||
xLabel: "test x", | ||
yLabel: "test y" | ||
} | ||
}); | ||
}; | ||
|
||
it("renders as expected", () => { | ||
const wrapper = getWrapper(); | ||
expect(wrapper.find("label[for='download-img-title']").text()).toBe("Title"); | ||
expect((wrapper.find("input#download-img-title").element as HTMLInputElement).value).toBe("Test Title"); | ||
expect(wrapper.find("label[for='download-img-x-label']").text()).toBe("X axis label"); | ||
expect((wrapper.find("input#download-img-x-label").element as HTMLInputElement).value).toBe("test x"); | ||
expect(wrapper.find("label[for='download-img-y-label']").text()).toBe("Y axis label"); | ||
expect((wrapper.find("input#download-img-y-label").element as HTMLInputElement).value).toBe("test y"); | ||
}); | ||
|
||
it("emits close", async () => { | ||
const wrapper = getWrapper(); | ||
await wrapper.find("button#cancel-download-img").trigger("click"); | ||
expect(wrapper.emitted("close")!.length).toBe(1); | ||
}); | ||
|
||
it("emits confirm with edited values", async () => { | ||
const wrapper = getWrapper(); | ||
await wrapper.find("#download-img-title").setValue("new title"); | ||
await wrapper.find("#download-img-x-label").setValue("new x"); | ||
await wrapper.find("#download-img-y-label").setValue("new y"); | ||
await wrapper.find("#confirm-download-img").trigger("click"); | ||
expect(wrapper.emitted("confirm")).toStrictEqual([["new title", "new x", "new y"]]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters