fix SigSelect Jasmine: return test API from IIFE; pend touch specs on desktop
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
window.SigSelect was being clobbered by the IIFE's undefined return value
(var SigSelect = (function(){...window.SigSelect={...}}()) overwrites window.SigSelect
with undefined). Fixed by using return {} like RoleSelect does.
TouchEvent is not defined in desktop Firefox, so the 5 touch-related specs now
call pending() when the API is absent rather than throwing a ReferenceError.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -258,7 +258,7 @@ var SigSelect = (function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ── Test API ──────────────────────────────────────────────────────────
|
// ── Test API ──────────────────────────────────────────────────────────
|
||||||
window.SigSelect = {
|
return {
|
||||||
_testInit: function () {
|
_testInit: function () {
|
||||||
_focusedCardEl = null;
|
_focusedCardEl = null;
|
||||||
_reservedCardId = null;
|
_reservedCardId = null;
|
||||||
|
|||||||
@@ -110,7 +110,10 @@ describe("SigSelect", () => {
|
|||||||
// ── Touch: OK btn tap allows synthetic click through ──────────────── //
|
// ── Touch: OK btn tap allows synthetic click through ──────────────── //
|
||||||
|
|
||||||
describe("touch on OK button", () => {
|
describe("touch on OK button", () => {
|
||||||
beforeEach(() => makeFixture());
|
beforeEach(() => {
|
||||||
|
if (typeof TouchEvent === 'undefined') { pending('TouchEvent unavailable in desktop Firefox'); return; }
|
||||||
|
makeFixture();
|
||||||
|
});
|
||||||
|
|
||||||
it("touchstart on OK btn does not call preventDefault (allows synthetic click)", () => {
|
it("touchstart on OK btn does not call preventDefault (allows synthetic click)", () => {
|
||||||
// First tap the card body to show OK
|
// First tap the card body to show OK
|
||||||
@@ -142,7 +145,10 @@ describe("SigSelect", () => {
|
|||||||
// ── Touch outside grid dismisses stage (mobile) ───────────────────── //
|
// ── Touch outside grid dismisses stage (mobile) ───────────────────── //
|
||||||
|
|
||||||
describe("touch outside grid", () => {
|
describe("touch outside grid", () => {
|
||||||
beforeEach(() => makeFixture());
|
beforeEach(() => {
|
||||||
|
if (typeof TouchEvent === 'undefined') { pending('TouchEvent unavailable in desktop Firefox'); return; }
|
||||||
|
makeFixture();
|
||||||
|
});
|
||||||
|
|
||||||
it("dismisses stage preview when touching outside the grid (unfocused state)", () => {
|
it("dismisses stage preview when touching outside the grid (unfocused state)", () => {
|
||||||
// Focus a card first
|
// Focus a card first
|
||||||
@@ -195,6 +201,7 @@ describe("SigSelect", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("does not call preventDefault on touchstart while a card is reserved", () => {
|
it("does not call preventDefault on touchstart while a card is reserved", () => {
|
||||||
|
if (typeof TouchEvent === 'undefined') { pending('TouchEvent unavailable in desktop Firefox'); return; }
|
||||||
SigSelect._setReservedCardId("99");
|
SigSelect._setReservedCardId("99");
|
||||||
var touchEvent = new TouchEvent("touchstart", {
|
var touchEvent = new TouchEvent("touchstart", {
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
|
|||||||
@@ -110,7 +110,10 @@ describe("SigSelect", () => {
|
|||||||
// ── Touch: OK btn tap allows synthetic click through ──────────────── //
|
// ── Touch: OK btn tap allows synthetic click through ──────────────── //
|
||||||
|
|
||||||
describe("touch on OK button", () => {
|
describe("touch on OK button", () => {
|
||||||
beforeEach(() => makeFixture());
|
beforeEach(() => {
|
||||||
|
if (typeof TouchEvent === 'undefined') { pending('TouchEvent unavailable in desktop Firefox'); return; }
|
||||||
|
makeFixture();
|
||||||
|
});
|
||||||
|
|
||||||
it("touchstart on OK btn does not call preventDefault (allows synthetic click)", () => {
|
it("touchstart on OK btn does not call preventDefault (allows synthetic click)", () => {
|
||||||
// First tap the card body to show OK
|
// First tap the card body to show OK
|
||||||
@@ -142,7 +145,10 @@ describe("SigSelect", () => {
|
|||||||
// ── Touch outside grid dismisses stage (mobile) ───────────────────── //
|
// ── Touch outside grid dismisses stage (mobile) ───────────────────── //
|
||||||
|
|
||||||
describe("touch outside grid", () => {
|
describe("touch outside grid", () => {
|
||||||
beforeEach(() => makeFixture());
|
beforeEach(() => {
|
||||||
|
if (typeof TouchEvent === 'undefined') { pending('TouchEvent unavailable in desktop Firefox'); return; }
|
||||||
|
makeFixture();
|
||||||
|
});
|
||||||
|
|
||||||
it("dismisses stage preview when touching outside the grid (unfocused state)", () => {
|
it("dismisses stage preview when touching outside the grid (unfocused state)", () => {
|
||||||
// Focus a card first
|
// Focus a card first
|
||||||
@@ -195,6 +201,7 @@ describe("SigSelect", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("does not call preventDefault on touchstart while a card is reserved", () => {
|
it("does not call preventDefault on touchstart while a card is reserved", () => {
|
||||||
|
if (typeof TouchEvent === 'undefined') { pending('TouchEvent unavailable in desktop Firefox'); return; }
|
||||||
SigSelect._setReservedCardId("99");
|
SigSelect._setReservedCardId("99");
|
||||||
var touchEvent = new TouchEvent("touchstart", {
|
var touchEvent = new TouchEvent("touchstart", {
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user