Skip to content

Commit 5f662b6

Browse files
mxschllpan-kot
authored andcommitted
fix more tests for jsdom 30 compatibility
1 parent 883925e commit 5f662b6

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

src/checkbox/__tests__/checkbox.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ test('all style api properties', () => {
324324
expect(getComputedStyle(control).getPropertyValue(customCssProps.styleFocusRingBorderColor)).toBe('blue');
325325
expect(getComputedStyle(control).getPropertyValue(customCssProps.styleFocusRingBorderRadius)).toBe('1px');
326326
expect(getComputedStyle(control).getPropertyValue(customCssProps.styleFocusRingBorderWidth)).toBe('2px');
327-
expect(getComputedStyle(label).getPropertyValue('color')).toBe('orange');
327+
expect(getComputedStyle(label).getPropertyValue('color')).toBe('rgb(255, 165, 0)');
328328
});
329329

330330
describe('native attributes', () => {

src/error-boundary/__tests__/error-boundary.test.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,16 +617,19 @@ describe('built-in error boundaries', () => {
617617
describe('default behaviors', () => {
618618
test('window reload is called when the refresh action is clicked', () => {
619619
const mockReload = jest.fn();
620-
jest.spyOn(window.location, 'reload').mockImplementation(mockReload);
620+
Object.defineProperty(window.location, 'reload', { configurable: true, writable: true, value: mockReload });
621621

622622
renderWithErrorBoundary(<b>{{}}</b>);
623623
findRefreshAction()!.click();
624624
expect(mockReload).toHaveBeenCalledTimes(1);
625625
});
626626

627627
test('hides default refresh in cross-origin iframes', () => {
628-
jest.spyOn(window.location, 'href', 'get').mockImplementation(() => {
629-
throw new Error();
628+
Object.defineProperty(window.location, 'href', {
629+
configurable: true,
630+
get() {
631+
throw new Error();
632+
},
630633
});
631634

632635
renderWithErrorBoundary(<b>{{}}</b>);

src/pie-chart/__tests__/pie-chart.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ describe('Details popover', () => {
483483
const { wrapper } = renderPieChart(<PieChart data={defaultData} />);
484484
wrapper.findApplication()!.focus();
485485
expect(wrapper.findDetailPopover()).toBeTruthy();
486-
wrapper.findApplication()!.blur();
486+
fireEvent.blur(wrapper.findApplication()!.getElement(), { relatedTarget: document.body });
487487
expect(wrapper.findDetailPopover()).toBeNull();
488488
});
489489

src/radio-group/__tests__/radio-group.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ test('all style api properties', function () {
443443
expect(getComputedStyle(outerCircle).getPropertyValue('fill')).toBe('blue');
444444
expect(getComputedStyle(outerCircle).getPropertyValue('stroke')).toBe('green');
445445
expect(getComputedStyle(innerCircle).getPropertyValue('stroke')).toBe('blue');
446-
expect(getComputedStyle(label).getPropertyValue('color')).toBe('brown');
447-
expect(getComputedStyle(description).getPropertyValue('color')).toBe('yellow');
446+
expect(getComputedStyle(label).getPropertyValue('color')).toBe('rgb(165, 42, 42)');
447+
expect(getComputedStyle(description).getPropertyValue('color')).toBe('rgb(255, 255, 0)');
448448
expect(getComputedStyle(control).getPropertyValue(customCssProps.styleFocusRingBorderColor)).toBe('orange');
449449
expect(getComputedStyle(control).getPropertyValue(customCssProps.styleFocusRingBorderRadius)).toBe('2px');
450450
expect(getComputedStyle(control).getPropertyValue(customCssProps.styleFocusRingBorderWidth)).toBe('1px');

0 commit comments

Comments
 (0)