diff --git a/crates/oxc_formatter/tests/fixtures/ts/member-chains/issue-16177.ts b/crates/oxc_formatter/tests/fixtures/ts/member-chains/issue-16177.ts new file mode 100644 index 0000000000000..bdd6295136b5d --- /dev/null +++ b/crates/oxc_formatter/tests/fixtures/ts/member-chains/issue-16177.ts @@ -0,0 +1,16 @@ +{ + { + jest.spyOn(Element.prototype, 'getBoundingClientRect').mockImplementation(function ( + this: Element, + ...args + ) { + return { + ...originalGetBoundingClientRect.bind(this)(...args), + top: canvasTop, + left: canvasLeft, + width: canvasWidth, + height: canvasHeight, + }; + }); + } +} diff --git a/crates/oxc_formatter/tests/fixtures/ts/member-chains/issue-16177.ts.snap b/crates/oxc_formatter/tests/fixtures/ts/member-chains/issue-16177.ts.snap new file mode 100644 index 0000000000000..d3893534e14d1 --- /dev/null +++ b/crates/oxc_formatter/tests/fixtures/ts/member-chains/issue-16177.ts.snap @@ -0,0 +1,62 @@ +--- +source: crates/oxc_formatter/tests/fixtures/mod.rs +--- +==================== Input ==================== +{ + { + jest.spyOn(Element.prototype, 'getBoundingClientRect').mockImplementation(function ( + this: Element, + ...args + ) { + return { + ...originalGetBoundingClientRect.bind(this)(...args), + top: canvasTop, + left: canvasLeft, + width: canvasWidth, + height: canvasHeight, + }; + }); + } +} + +==================== Output ==================== +------------------ +{ printWidth: 80 } +------------------ +{ + { + jest + .spyOn(Element.prototype, "getBoundingClientRect") + .mockImplementation(function (this: Element, ...args) { + return { + ...originalGetBoundingClientRect.bind(this)(...args), + top: canvasTop, + left: canvasLeft, + width: canvasWidth, + height: canvasHeight, + }; + }); + } +} + +------------------- +{ printWidth: 100 } +------------------- +{ + { + jest.spyOn(Element.prototype, "getBoundingClientRect").mockImplementation(function ( + this: Element, + ...args + ) { + return { + ...originalGetBoundingClientRect.bind(this)(...args), + top: canvasTop, + left: canvasLeft, + width: canvasWidth, + height: canvasHeight, + }; + }); + } +} + +===================== End =====================