Skip to content

Commit

Permalink
[test] Remove userAgent override in jsdom env (#42344)
Browse files Browse the repository at this point in the history
  • Loading branch information
cherniavskii committed May 23, 2024
1 parent bb4ce66 commit 1f86f90
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/mui-material/src/Tabs/Tabs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function hasRightScrollButton(container) {

describe('<Tabs />', () => {
// tests mocking getBoundingClientRect prevent mocha to exit
const isJSDOM = navigator.userAgent === 'node.js';
const isJSDOM = /jsdom/.test(window.navigator.userAgent);

const { clock, render, renderToString } = createRenderer();

Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material/src/internal/animate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('animate', () => {

before(function beforeHook() {
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
const isJSDOM = navigator.userAgent === 'node.js';
const isJSDOM = /jsdom/.test(window.navigator.userAgent);
if (isJSDOM || isSafari) {
// The test fails on Safari with just:
//
Expand Down
4 changes: 0 additions & 4 deletions packages/test-utils/src/createDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ function createDOM() {
}
global.window.Touch = Touch;

global.navigator = {
userAgent: 'node.js',
};

Object.keys(dom.window)
.filter((key) => !blacklist.includes(key))
.concat(whitelist)
Expand Down

0 comments on commit 1f86f90

Please sign in to comment.