Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/common/src/services/__tests__/filter.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="node" />

import type { BasePubSubService } from '@slickgrid-universal/event-pub-sub';
import { of, throwError } from 'rxjs';
import { afterEach, beforeEach, describe, expect, it, vi, type Mock } from 'vitest';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="node" />

import type { BasePubSubService } from '@slickgrid-universal/event-pub-sub';
import { of } from 'rxjs';
import { afterEach, beforeEach, describe, expect, it, vi, type Mock } from 'vitest';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('HeaderGroupingService', () => {
vi.spyOn(gridStub, 'getPreHeaderPanel').mockReturnValue(mockPreHeaderPanelElm);
vi.spyOn(gridStub, 'getPreHeaderPanelLeft').mockReturnValue(document.createElement('div'));
vi.spyOn(gridStub, 'getPreHeaderPanelRight').mockReturnValue(document.createElement('div'));
setTimeoutSpy = vi.spyOn(global, 'setTimeout');
setTimeoutSpy = vi.spyOn(globalThis, 'setTimeout');
});

afterEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="node" />

import { of, throwError } from 'rxjs';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { RxJsResourceStub } from '../../../../../test/rxjsResourceStub.js';
Expand Down
2 changes: 2 additions & 0 deletions packages/common/src/services/__tests__/sort.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="node" />

import { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
import { of, throwError } from 'rxjs';
import { afterEach, beforeEach, describe, expect, it, vi, type Mock } from 'vitest';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="node" />

import {
Editors,
SlickEvent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="node" />

import {
getOffset,
SlickEvent,
Expand Down Expand Up @@ -788,7 +790,7 @@ describe('SlickCustomTooltip plugin', () => {
expect(tooltipElm).toBeTruthy();
expect(tooltipElm.textContent).toBe('loading...');

await new Promise(process.nextTick);
await vi.runAllTimersAsync();

tooltipElm = document.body.querySelector('.slick-custom-tooltip') as HTMLDivElement;
expect(tooltipElm.textContent).toBe('async post text with ratio: 1.2');
Expand Down Expand Up @@ -820,7 +822,7 @@ describe('SlickCustomTooltip plugin', () => {
expect(tooltipElm).toBeTruthy();
expect(tooltipElm.textContent).toBe('loading...');

await new Promise(process.nextTick);
await vi.runAllTimersAsync();

tooltipElm = document.body.querySelector('.slick-custom-tooltip') as HTMLDivElement;
expect(tooltipElm.textContent).toBe('tooltip title text with ratio: 1.2');
Expand Down Expand Up @@ -1246,7 +1248,7 @@ describe('SlickCustomTooltip plugin', () => {
plugin.init(gridStub, container);
plugin.setOptions({ useRegularTooltip: true, persistOnHover: false });

const clearTimeoutSpy = vi.spyOn(global, 'clearTimeout');
const clearTimeoutSpy = vi.spyOn(globalThis, 'clearTimeout');

(plugin as any)._hideTooltipTimeout = 123 as any; // simulate existing timeout
(plugin as any)._autoHideTimeout = 456 as any; // simulate existing timeout
Expand Down
6 changes: 3 additions & 3 deletions packages/utils/src/__tests__/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ describe('Service/Utilies', () => {
it('uses queueMicrotask() when available', () =>
new Promise((done: any) => {
const callback = vi.fn();
const queueMicrotaskSpy = vi.spyOn(global, 'queueMicrotask');
const queueMicrotaskSpy = vi.spyOn(globalThis, 'queueMicrotask');
queueMicrotaskPolyfill(callback);
setTimeout(() => {
expect(queueMicrotaskSpy).toHaveBeenCalledWith(callback);
Expand All @@ -697,7 +697,7 @@ describe('Service/Utilies', () => {
new Promise((done: any) => {
const callback = vi.fn();
// Remove queueMicrotask
const originalQueueMicrotask = global.queueMicrotask;
const originalQueueMicrotask = globalThis.queueMicrotask;
// @ts-ignore
delete global.queueMicrotask;
// Spy on Promise.resolve().then
Expand All @@ -708,7 +708,7 @@ describe('Service/Utilies', () => {
expect(callback).toHaveBeenCalledTimes(1);
promiseThenSpy.mockRestore();
// Restore queueMicrotask
global.queueMicrotask = originalQueueMicrotask;
globalThis.queueMicrotask = originalQueueMicrotask;
done();
}, 10);
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="node" />

import {
autoAddEditorFormatterToColumnsWithEditor,
Editors,
Expand Down
Loading