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

Commit

Permalink
test: set sync in mount options, but no luck
Browse files Browse the repository at this point in the history
  • Loading branch information
suwarnoong committed Mar 7, 2019
1 parent e840554 commit db18daa
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions ui/src/components/Modal/__tests__/Modal.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { mount, shallowMount } from "@vue/test-utils";
import { mount } from "@vue/test-utils";
import Modal from "../Modal.vue";
import { CreateElement, VNode } from "vue";

describe("Modal", () => {
// Both Vue.config.async and mountOptions.sync are not working?
// Vue.config.async = false;
// expect(Vue.config.async).toBe(false);

const title = "Modal Title";
const wrapper = mount(Modal, {
// does not work. infact it is default value
// https://github.com/vuejs/vue-test-utils/pull/1062
sync: true,

propsData: {
title,
active: false
Expand Down Expand Up @@ -39,9 +47,15 @@ describe("Modal", () => {
it("closed correctly", () => {
const button = wrapper.find(".fd-modal__close");
button.trigger("click");
wrapper.setProps({ active: false });

expect(wrapper.emitted("close")).toHaveLength(1);
expect(wrapper.emitted("update:active")).toHaveLength(1);

// Temporary manually modify the active prop
// Tried with $nextTick but no luck
// expect(wrapper.props('active')).toBe(false);
wrapper.setProps({ active: false });

expect(wrapper.find(".fd-overlay--modal").attributes("aria-hidden")).toBe(
"true"
);
Expand Down

0 comments on commit db18daa

Please sign in to comment.