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

@featherds/dialog

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@featherds/dialog - npm Package Compare versions

Comparing version 0.12.5 to 0.12.6

12

package.json
{
"name": "@featherds/dialog",
"version": "0.12.5",
"version": "0.12.6",
"publishConfig": {

@@ -12,6 +12,6 @@ "access": "public"

"dependencies": {
"@featherds/composables": "^0.12.5",
"@featherds/icon": "^0.12.5",
"@featherds/styles": "^0.12.5",
"@featherds/utils": "^0.12.5",
"@featherds/composables": "^0.12.6",
"@featherds/icon": "^0.12.6",
"@featherds/styles": "^0.12.6",
"@featherds/utils": "^0.12.6",
"vue": "^3.1.0-0"

@@ -24,3 +24,3 @@ },

"types": "./src/index.d.ts",
"gitHead": "902fb935f136f66098ff1f777f7ca1294854cd42"
"gitHead": "efae40a88230bf71e4927f9e40604d095fb92d35"
}
import { mount } from "@vue/test-utils";
import axe from "axe-core";
import axe from "@featherds/utils/test/axe";
import FeatherDialog from "./FeatherDialog.vue";
import { getCalls } from "@featherds/utils/test/calls";
import { expect, describe, it } from "vitest";
const slots = {

@@ -44,3 +46,4 @@ default: {

await wrapper.setProps({ modelValue: true });
expect(wrapper.find(".content").isVisible()).toBe(true);
await wrapper.vm.$nextTick();
expect(wrapper.find(".content").exists()).toBe(true);
await wrapper.setProps({ modelValue: false });

@@ -75,53 +78,13 @@ expect(wrapper.find(".content").exists()).toBe(false);

describe("a11y", () => {
it("should have no accessibility errors when closed", (done) => {
it("should have no accessibility errors when closed", async () => {
const wrapper = getWrapper({ props: getprops(false), slots });
document.body.appendChild(wrapper.element);
axe.run(
wrapper.element,
{
runOnly: {
type: "tag",
values: ["wcag2a", "wcag2aa"],
},
},
(err, result) => {
expect(err).toBe(null);
expect(result.violations.length).toBe(0);
result.violations.forEach((v) => {
//eslint-disable-next-line
console.error(
`${v.description} at ${v.nodes.map((n) => n.target).join(", ")}`
);
});
document.body.removeChild(wrapper.element);
done();
}
);
expect(await axe(wrapper.element)).toHaveNoViolations();
});
it("should have no accessibility errors when open", (done) => {
it("should have no accessibility errors when open", async () => {
const wrapper = getWrapper({ props: getprops(true), slots });
document.body.appendChild(wrapper.element);
axe.run(
wrapper.element,
{
runOnly: {
type: "tag",
values: ["wcag2a", "wcag2aa"],
},
},
(err, result) => {
expect(err).toBe(null);
expect(result.violations.length).toBe(0);
result.violations.forEach((v) => {
//eslint-disable-next-line
console.error(
`${v.description} at ${v.nodes.map((n) => n.target).join(", ")}`
);
});
document.body.removeChild(wrapper.element);
done();
}
);
expect(await axe(wrapper.element)).toHaveNoViolations();
});
});
});
import { mount } from "@vue/test-utils";
import FocusTrap from "./FocusTrap.vue";
import { vi, expect, describe, it, afterEach } from "vitest";
const slots = {

@@ -29,4 +29,4 @@ default: {

wrapper = getWrapper({ props: { enable: false }, slots });
const addEvents = jest.spyOn(wrapper.vm, "addFocusTrapEvents");
const removeEvents = jest.spyOn(wrapper.vm, "removeFocusTrapEvents");
const addEvents = vi.spyOn(wrapper.vm, "addFocusTrapEvents");
const removeEvents = vi.spyOn(wrapper.vm, "removeFocusTrapEvents");
await wrapper.setProps({ enable: true });

@@ -39,3 +39,3 @@ expect(addEvents).toHaveBeenCalled();

wrapper = getWrapper({ props: { enable: false }, slots });
const focusFirst = jest.spyOn(wrapper.vm, "attemptToFocusFirst");
const focusFirst = vi.spyOn(wrapper.vm, "attemptToFocusFirst");
await wrapper.setProps({ enable: true });

@@ -46,3 +46,3 @@ expect(focusFirst).toHaveBeenCalled();

wrapper = getWrapper({ props: { enable: false }, slots });
const removeEvents = jest.spyOn(wrapper.vm, "removeFocusTrapEvents");
const removeEvents = vi.spyOn(wrapper.vm, "removeFocusTrapEvents");
wrapper.unmount();

@@ -81,14 +81,17 @@ expect(removeEvents).toHaveBeenCalled();

describe("trapFocus", () => {
it("should set lastFocus to event.target if it's inside content element", (done) => {
wrapper = getWrapper({ props, slots, attachTo: document.body });
const vm = wrapper.vm;
const first = wrapper.find("#first").element;
vm.trapFocus();
setTimeout(() => {
expect(vm.lastFocus).toBe(first);
done();
}, 1);
});
it("should set lastFocus to event.target if it's inside content element", () =>
new Promise((done) => {
wrapper = getWrapper({ props, slots, attachTo: document.body });
const vm = wrapper.vm;
const first = wrapper.find("#first").element;
vm.trapFocus();
setTimeout(() => {
expect(vm.lastFocus).toBe(first);
done("");
}, 1);
}));
it("should loop focus back to last element if focusing before", () => {
jest.useFakeTimers();
vi.useFakeTimers({
toFake: ["setTimeout", "clearTimeout"],
});
wrapper = getWrapper({ props, slots });

@@ -116,3 +119,3 @@ const vm = wrapper.vm;

//should set focus to last
jest.runAllTimers();
vi.runAllTimers();
expect(vm.lastFocus).toBe(last);

@@ -123,3 +126,5 @@ document.body.removeChild(wrapper.element);

it("should loop focus back to first element if focusing after", () => {
jest.useFakeTimers();
vi.useFakeTimers({
toFake: ["setTimeout", "clearTimeout"],
});
wrapper = getWrapper({ props, slots });

@@ -148,3 +153,3 @@ const vm = wrapper.vm;

//should set focus to first
jest.runAllTimers();
vi.runAllTimers();
expect(vm.lastFocus).toBe(first);

@@ -151,0 +156,0 @@ document.body.removeChild(wrapper.element);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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