Skip to content

Commit

Permalink
test: add modal closed value and namespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenesius committed Nov 10, 2023
1 parent a7727c6 commit c43aaaf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
26 changes: 24 additions & 2 deletions tests/modal-namespace.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,28 @@ describe("Namespace tests", () => {
expect(modalSub_2.closed.value).toBe(true);

})
test("Modal.namespace must be set correctly.", async () => {})
test("Modal.closed should return right values from corresponding namespace", async () => {})
test("Modal.namespace must be set correctly.", async () => {
const modal_default = await openModal(ModalTitle);
const modal_notification = await openModal(ModalTitle, {}, { namespace: space });

expect(modal_default.namespace).toBe(NamespaceStore.DEFAULT_NAMESPACE)
expect(modal_notification.namespace).toBe(space)
})
test("Modal.closed should return right values from corresponding namespace", async () => {
const modal_default = await openModal(ModalTitle);
const modal_notification = await openModal(ModalTitle, {}, { namespace: space });

expect(modal_default.closed.value).toBe(false)
expect(modal_notification.closed.value).toBe(false)

await closeModal()

expect(modal_default.closed.value).toBe(true)
expect(modal_notification.closed.value).toBe(false)

await closeModal({namespace: space})

expect(modal_default.closed.value).toBe(true)
expect(modal_notification.closed.value).toBe(true)
})
})
2 changes: 1 addition & 1 deletion tests/prompt-modal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {mount} from "@vue/test-utils";
import {container, promptModal} from "../src/index";
import ModalPromptValue from "./components/modal-prompt-value.vue";
import wait from "./wait";
import NamespaceStore from "@/utils/NamespaceStore";
import NamespaceStore from "./../src/utils/NamespaceStore";

beforeEach(async () => {
NamespaceStore.instance.forceClean()
Expand Down
2 changes: 1 addition & 1 deletion tests/unit-test/add-modal-by-name.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {mount} from "@vue/test-utils";
import ModalError from "../../src/utils/ModalError";
import ModalTitle from "../components/modal-title.vue";
import wait from "../wait";
import NamespaceStore from "@/utils/NamespaceStore";
import NamespaceStore from "./../../src/utils/NamespaceStore";

beforeEach(() => {
config({
Expand Down

0 comments on commit c43aaaf

Please sign in to comment.