Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jenesius-vue-modal

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jenesius-vue-modal - npm Package Compare versions

Comparing version 1.7.0 to 1.7.1

dist/dts/methods/getCurrentModal.d.ts

1

dist/dts/utils/event-close.d.ts

@@ -7,3 +7,4 @@ /**

background: boolean;
esc: boolean;
}
export declare function DtoEventClose(obj?: Partial<IEventClose>): IEventClose;

2

dist/dts/utils/initialize.d.ts
/**
* last change: 18.02.2022
* last change: 13.08.2022
* */

@@ -4,0 +4,0 @@ /**

/*!
* jenesius-vue-modal v1.7.0
* jenesius-vue-modal v1.7.1
* (c) 2022 Jenesius

@@ -395,2 +395,11 @@ * @license MIT

/**
* @return {Modal} Last opened modal in active status. Return undefined if there is not opened modal.
* */
function getCurrentModal() {
if (modalQueue.value.length === 0) return undefined;
return modalQueue.value[modalQueue.value.length - 1];
}
/**
* @description Try to close the last opened modal window.

@@ -401,5 +410,5 @@ * */

function popModal() {
if (modalQueue.value.length === 0) return Promise.resolve();
var lastModal = modalQueue.value[modalQueue.value.length - 1];
return lastModal.close();
var modal = getCurrentModal();
if (!modal) return Promise.resolve();
return modal.close();
}

@@ -413,3 +422,4 @@

var defaultValues = {
background: false
background: false,
esc: false
};

@@ -755,3 +765,3 @@ return Object.assign(defaultValues, obj);

/**
* last change: 18.02.2022
* last change: 13.08.2022
* */

@@ -769,3 +779,9 @@

// Closing the last modal window when user pressed Escape
if (configuration.escClose && e.key === "Escape" || e.code === "Escape") popModal();
if (configuration.escClose && (e.key === "Escape" || e.code === "Escape")) {
var modal = getCurrentModal();
if (!modal) return;
closeById(modal.id, {
esc: true
});
}
});

@@ -772,0 +788,0 @@ }

{
"name": "jenesius-vue-modal",
"version": "1.7.0",
"version": "1.7.1",
"private": false,

@@ -5,0 +5,0 @@ "description": "Simple modal plugin for Vue3",

import {mount} from "@vue/test-utils";
import {fireEvent, render} from "@testing-library/vue";
import {container} from "../plugin/index";
import openModal from "../plugin/methods/openModal";
import ModalTitle from "./components/modal-title.vue";
import wait from "./wait";

@@ -10,6 +12,10 @@ describe("Testing event close", () => {

const modal = await openModal(ModalTitle);
let backgroundValue = null;
modal.onclose = (v) => {
expect(v.background).toBeFalsy()
backgroundValue = v.background;
}
await wrap.find(".modal-container").trigger("click");
await wait();
expect(backgroundValue).toBe(true)
})

@@ -19,7 +25,34 @@ test("event.background should be false by default", async () => {

const modal = await openModal(ModalTitle);
let backgroundValue = null;
modal.onclose = (v) => {
expect(v.background).toBeFalsy()
backgroundValue = v.background;
}
await modal.close()
await wait()
expect(backgroundValue).toBe(false);
})
test("event.esc should be false by default", async () => {
const wrap = await mount(container);
const modal = await openModal(ModalTitle);
let escValue = null;
modal.onclose = (v) => {
escValue = v.esc;
}
await modal.close()
expect(escValue).toBe(false);
})
test("event.esc should be true if modal was closed by pressed Esc", async () => {
const wrap = await render(container);
const modal = await openModal(ModalTitle);
let escValue = null;
modal.onclose = (v) => {
escValue = v.esc;
}
await fireEvent.keyUp(document, {key: "Escape"});
await wait(10)
expect(escValue).toBe(true)
})
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc