Skip to content

Commit

Permalink
Merge pull request #12 from elgreco247/remove-screen
Browse files Browse the repository at this point in the history
window.__TL__.screen is not needed anymore
  • Loading branch information
lsoares authored Mar 4, 2024
2 parents 1cb8d4c + bac2599 commit 9176076
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/src/main/resources/testing-library.js

Large diffs are not rendered by default.

18 changes: 3 additions & 15 deletions testing-library/src/testing-library.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {queryAllByRole, queryAllByLabelText, queryAllByPlaceholderText, queryAllByText, queryAllByDisplayValue, queryAllByAltText, queryAllByTitle, queryAllByTestId,
screen, fireEvent} from '@testing-library/dom'
fireEvent} from '@testing-library/dom'

window.__TL__ = {
queryAllByRole,
Expand All @@ -10,7 +10,6 @@ window.__TL__ = {
queryAllByAltText,
queryAllByTitle,
queryAllByTestId,
screen,
fireEvent
}

Expand All @@ -24,18 +23,7 @@ if (/Firefox/.test(navigator.userAgent)) {
queryAllByDisplayValue : (container, value, options) => queryAllByDisplayValue (container, wrapTextMatch(value), wrapTextOptions(options)),
queryAllByAltText : (container, text, options) => queryAllByAltText (container, wrapTextMatch(text), wrapTextOptions(options)),
queryAllByTitle : (container, title, options) => queryAllByTitle (container, wrapTextMatch(title), wrapTextOptions(options)),
queryAllByTestId : (container, text, options) => queryAllByTestId (container, wrapTextMatch(text), wrapTextOptions(options)),
screen: {
...window.__TL__.screen,
queryAllByRole : (role, options) => screen.queryAllByRole (role, wrapRoleOptions(options)),
queryAllByLabelText : (text, options) => screen.queryAllByLabelText (wrapTextMatch(text), wrapTextOptions(options)),
queryAllByPlaceholderText : (text, options) => screen.queryAllByPlaceholderText (wrapTextMatch(text), wrapTextOptions(options)),
queryAllByText : (text, options) => screen.queryAllByText (wrapTextMatch(text), wrapTextOptions(options)),
queryAllByDisplayValue : (value, options) => screen.queryAllByDisplayValue (wrapTextMatch(value), wrapTextOptions(options)),
queryAllByAltText : (text, options) => screen.queryAllByAltText (wrapTextMatch(text), wrapTextOptions(options)),
queryAllByTitle : (title, options) => screen.queryAllByTitle (wrapTextMatch(title), wrapTextOptions(options)),
queryAllByTestId : (text, options) => screen.queryAllByTestId (wrapTextMatch(text), wrapTextOptions(options)),
}
queryAllByTestId : (container, text, options) => queryAllByTestId (container, wrapTextMatch(text), wrapTextOptions(options)),
}
function wrapRoleOptions(options) {
return options && { ...options,
Expand All @@ -59,4 +47,4 @@ if (/Firefox/.test(navigator.userAgent)) {
}
return maybeFunc
}
}
}

0 comments on commit 9176076

Please sign in to comment.