@simplysm/core-browser 13.0.74 → 13.0.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/core-browser",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.76",
|
|
4
4
|
"description": "Simplysm package - Core module (browser)",
|
|
5
5
|
"author": "simplysm",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"tabbable": "^6.4.0",
|
|
26
|
-
"@simplysm/core-common": "13.0.
|
|
26
|
+
"@simplysm/core-common": "13.0.76"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"happy-dom": "^20.
|
|
29
|
+
"happy-dom": "^20.8.3"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -75,26 +75,6 @@ describe("Element prototype extensions", () => {
|
|
|
75
75
|
const result = container.findAll("");
|
|
76
76
|
expect(result).toEqual([]);
|
|
77
77
|
});
|
|
78
|
-
|
|
79
|
-
it("returns empty array for whitespace-only selector", () => {
|
|
80
|
-
container.innerHTML = `<div class="item">1</div>`;
|
|
81
|
-
const result = container.findAll(" ");
|
|
82
|
-
expect(result).toEqual([]);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("handles comma in attribute selector", () => {
|
|
86
|
-
container.innerHTML = `
|
|
87
|
-
<div data-values="a,b,c">1</div>
|
|
88
|
-
<div class="item">2</div>
|
|
89
|
-
`;
|
|
90
|
-
|
|
91
|
-
// When comma is in attribute selector
|
|
92
|
-
// Current implementation may split incorrectly, single selector recommended
|
|
93
|
-
const result = container.findAll('[data-values="a,b,c"]');
|
|
94
|
-
|
|
95
|
-
// Edge case behavior verification
|
|
96
|
-
expect(result.length).toBeGreaterThanOrEqual(0);
|
|
97
|
-
});
|
|
98
78
|
});
|
|
99
79
|
|
|
100
80
|
describe("findFirst", () => {
|
|
@@ -119,12 +99,6 @@ describe("Element prototype extensions", () => {
|
|
|
119
99
|
const result = container.findFirst("");
|
|
120
100
|
expect(result).toBeUndefined();
|
|
121
101
|
});
|
|
122
|
-
|
|
123
|
-
it("returns undefined for whitespace-only selector", () => {
|
|
124
|
-
container.innerHTML = `<div class="item">1</div>`;
|
|
125
|
-
const result = container.findFirst(" ");
|
|
126
|
-
expect(result).toBeUndefined();
|
|
127
|
-
});
|
|
128
102
|
});
|
|
129
103
|
|
|
130
104
|
describe("getParents", () => {
|
|
@@ -226,24 +200,6 @@ describe("Element prototype extensions", () => {
|
|
|
226
200
|
container.style.display = "none";
|
|
227
201
|
expect(container.isVisible()).toBe(false);
|
|
228
202
|
});
|
|
229
|
-
|
|
230
|
-
it("determines visibility of element with zero width", () => {
|
|
231
|
-
container.style.width = "0";
|
|
232
|
-
container.style.height = "100px";
|
|
233
|
-
// When getClientRects().length is 0, it is not visible
|
|
234
|
-
const isVisible = container.isVisible();
|
|
235
|
-
// May vary depending on browser, verify it is boolean type
|
|
236
|
-
expect(typeof isVisible).toBe("boolean");
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
it("determines visibility of element with zero height", () => {
|
|
240
|
-
container.style.width = "100px";
|
|
241
|
-
container.style.height = "0";
|
|
242
|
-
// When getClientRects().length is 0, it is not visible
|
|
243
|
-
const isVisible = container.isVisible();
|
|
244
|
-
// May vary depending on browser, verify it is boolean type
|
|
245
|
-
expect(typeof isVisible).toBe("boolean");
|
|
246
|
-
});
|
|
247
203
|
});
|
|
248
204
|
|
|
249
205
|
describe("copyElement", () => {
|
|
@@ -639,40 +595,6 @@ describe("Element prototype extensions", () => {
|
|
|
639
595
|
vi.unstubAllGlobals();
|
|
640
596
|
});
|
|
641
597
|
|
|
642
|
-
it("supports custom timeout setting", async () => {
|
|
643
|
-
const mockObserver = {
|
|
644
|
-
observe: vi.fn(),
|
|
645
|
-
disconnect: vi.fn(),
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
const MockIntersectionObserver = vi.fn(function (
|
|
649
|
-
this: IntersectionObserver,
|
|
650
|
-
callback: IntersectionObserverCallback,
|
|
651
|
-
) {
|
|
652
|
-
// Responds after 100ms
|
|
653
|
-
setTimeout(() => {
|
|
654
|
-
callback(
|
|
655
|
-
[
|
|
656
|
-
{
|
|
657
|
-
target: container,
|
|
658
|
-
boundingClientRect: { top: 0, left: 0, width: 10, height: 10 },
|
|
659
|
-
},
|
|
660
|
-
] as unknown as IntersectionObserverEntry[],
|
|
661
|
-
this,
|
|
662
|
-
);
|
|
663
|
-
}, 100);
|
|
664
|
-
return mockObserver;
|
|
665
|
-
});
|
|
666
|
-
|
|
667
|
-
vi.stubGlobal("IntersectionObserver", MockIntersectionObserver);
|
|
668
|
-
|
|
669
|
-
// Should succeed with 200ms timeout
|
|
670
|
-
const result = await getBounds([container], 200);
|
|
671
|
-
expect(result.length).toBe(1);
|
|
672
|
-
|
|
673
|
-
vi.unstubAllGlobals();
|
|
674
|
-
});
|
|
675
|
-
|
|
676
598
|
it("collects all results even when callback is called multiple times", async () => {
|
|
677
599
|
const el1 = document.createElement("div");
|
|
678
600
|
const el2 = document.createElement("div");
|
|
@@ -59,21 +59,6 @@ describe("HTMLElement prototype extensions", () => {
|
|
|
59
59
|
expect(() => child.getRelativeOffset(".not-exist")).toThrow(ArgumentError);
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
it("handles elements with transforms", () => {
|
|
63
|
-
container.style.position = "relative";
|
|
64
|
-
container.style.transform = "scale(2)";
|
|
65
|
-
container.innerHTML = `<div id="child" style="transform: rotate(45deg);"></div>`;
|
|
66
|
-
|
|
67
|
-
const child = container.querySelector<HTMLElement>("#child")!;
|
|
68
|
-
|
|
69
|
-
// Should return result without error even with transforms
|
|
70
|
-
const result = child.getRelativeOffset(container);
|
|
71
|
-
expect(result).toHaveProperty("top");
|
|
72
|
-
expect(result).toHaveProperty("left");
|
|
73
|
-
expect(typeof result.top).toBe("number");
|
|
74
|
-
expect(typeof result.left).toBe("number");
|
|
75
|
-
});
|
|
76
|
-
|
|
77
62
|
it("accumulates border width of intermediate elements", () => {
|
|
78
63
|
container.style.position = "relative";
|
|
79
64
|
container.innerHTML = `
|