local D=script.Parent.Parent.Parent local w=require(D.LuauPolyfill)local W=w.Array local c=w.Object local a=require(script.Parent.Parent.jsHelpers.document)local o=require(D.JestGlobals)local C=o.expect local t=o.test local V=o.jest local L=(require(script.Parent.Parent["\103\101\116-\113\117\101\114\105\101\115-\102\111\114-\101\108\101\109\101\110\116"])).getQueriesForElement local M=require(script.Parent.Parent.queries)t("\117\115\101\115 \100\101\102\097\117\108\116 \113\117\101\114\105\101\115",function()local D=Instance.new("\070\114\097\109\101")D.Parent=a local w=L(D);(C(W.sort(c.keys(w)))).toEqual(W.sort(c.keys(M)))end)t("\097\099\099\101\112\116\115 \099\117\115\116\111\109 \113\117\101\114\105\101\115",function()local D=Instance.new("\070\114\097\109\101")D.Parent=a local w=V.fn()local W=L(D,c.assign({},M,{customQuery=w}));(C(W.customQuery)).toBeDefined()end)t("\098\105\110\100\115 \102\117\110\099\116\105\111\110\115 \116\111 \099\111\110\116\097\105\110\101\114",function()local D=Instance.new("\070\114\097\109\101")D.Parent=a local w=V.fn()local function W(D)return w(D)end local c=L(D,{customQuery=W})c.customQuery();(C(w)).toHaveBeenCalledWith(D)end)return{}
-- ROBLOX upstream: https://github.com/testing-library/dom-testing-library/blob/v8.14.0/src/__tests__/get-queries-for-element.js
local Packages = script.Parent.Parent.Parent

local LuauPolyfill = require(Packages.LuauPolyfill)
local Array = LuauPolyfill.Array
local Object = LuauPolyfill.Object

local document = require(script.Parent.Parent.jsHelpers.document)

local JestGlobals = require(Packages.JestGlobals)
local expect = JestGlobals.expect
local test = JestGlobals.test
local jest = JestGlobals.jest

local getQueriesForElement = require(script.Parent.Parent["get-queries-for-element"]).getQueriesForElement
local queries = require(script.Parent.Parent.queries)
test("uses default queries", function()
	local container = Instance.new("Frame")
	container.Parent = document
	local boundQueries = getQueriesForElement(container)
	-- ROBLOX deviation START: sorting keys, to ensure items match
	expect(Array.sort(Object.keys(boundQueries))).toEqual(Array.sort(Object.keys(queries)))
	-- ROBLOX deviation END
end)
test("accepts custom queries", function()
	local container = Instance.new("Frame")
	container.Parent = document
	local customQuery = jest.fn()
	local boundQueries = getQueriesForElement(container, Object.assign({}, queries, { customQuery = customQuery }))
	expect(boundQueries.customQuery).toBeDefined()
end)
test("binds functions to container", function()
	local container = Instance.new("Frame")
	container.Parent = document
	local mock = jest.fn()
	local function customQuery(element)
		return mock(element)
	end
	local boundQueries = getQueriesForElement(container, { customQuery = customQuery })
	boundQueries.customQuery()
	expect(mock).toHaveBeenCalledWith(container)
end)

return {}
