return function()local D=require(script.Parent.Component)local F=require(script.Parent.ElementKind)local t=require(script.Parent.GlobalConfig)local v=require(script.Parent.Logging)local G=require(script.Parent.Type)local u=require(script.Parent.Portal)local K=require(script.Parent.PropMarkers.Children)local H=require(script.Parent.createElement)it("\115\104\111\117\108\100 \099\114\101\097\116\101 \110\101\119 \112\114\105\109\105\116\105\118\101 \101\108\101\109\101\110\116\115",function()local D=H("\070\114\097\109\101");(expect(D)).to.be.ok();(expect(G.of(D))).to.equal(G.Element);(expect(F.of(D))).to.equal(F.Host)end)it("\115\104\111\117\108\100 \099\114\101\097\116\101 \110\101\119 \102\117\110\099\116\105\111\110\097\108 \101\108\101\109\101\110\116\115",function()local D=H(function() end);(expect(D)).to.be.ok();(expect(G.of(D))).to.equal(G.Element);(expect(F.of(D))).to.equal(F.Function)end)it("\115\104\111\117\108\100 \099\114\101\097\116\101 \110\101\119 \115\116\097\116\101\102\117\108 \099\111\109\112\111\110\101\110\116\115",function()local t=D:extend("\070\111\111")local v=H(t);(expect(v)).to.be.ok();(expect(G.of(v))).to.equal(G.Element);(expect(F.of(v))).to.equal(F.Stateful)end)it("\115\104\111\117\108\100 \099\114\101\097\116\101 \110\101\119 \112\111\114\116\097\108 \101\108\101\109\101\110\116\115",function()local D=H(u);(expect(D)).to.be.ok();(expect(G.of(D))).to.equal(G.Element);(expect(F.of(D))).to.equal(F.Portal)end)it("\115\104\111\117\108\100 \097\099\099\101\112\116 \112\114\111\112\115",function()local D=H("\083\116\114\105\110\103\086\097\108\117\101",{Value="\070\111\111"});(expect(D)).to.be.ok();(expect(D.props.Value)).to.equal("\070\111\111")end)it("\115\104\111\117\108\100 \097\099\099\101\112\116 \112\114\111\112\115 \097\110\100 \099\104\105\108\100\114\101\110",function()local D=H("\073\110\116\086\097\108\117\101")local F=H("\083\116\114\105\110\103\086\097\108\117\101",{Value="\070\111\111"},{Child=D});(expect(F)).to.be.ok();(expect(F.props.Value)).to.equal("\070\111\111");(expect(F.props[K])).to.be.ok();(expect(F.props[K].Child)).to.equal(D)end)it("\115\104\111\117\108\100 \097\099\099\101\112\116 \099\104\105\108\100\114\101\110 \119\105\116\104 \119\105\116\104\111\117\116 \112\114\111\112\115",function()local D=H("\073\110\116\086\097\108\117\101")local F=H("\083\116\114\105\110\103\086\097\108\117\101",nil,{Child=D});(expect(F)).to.be.ok();(expect(F.props[K])).to.be.ok();(expect(F.props[K].Child)).to.equal(D)end)it("\115\104\111\117\108\100 \119\097\114\110 \111\110\099\101 \105\102 \099\104\105\108\100\114\101\110 \105\115 \115\112\101\099\105\102\105\101\100 \105\110 \116\119\111 \100\105\102\102\101\114\101\110\116 \119\097\121\115",function()local D=v.capture(function()for D=1,2,1 do H("\070\114\097\109\101",{[K]={}},{})end end);(expect(#D.warnings)).to.equal(1);(expect(D.warnings[1]:find("\099\114\101\097\116\101\069\108\101\109\101\110\116"))).to.be.ok();(expect(D.warnings[1]:find("\067\104\105\108\100\114\101\110"))).to.be.ok()end)it("\115\104\111\117\108\100 \104\097\118\101 \097 \096\115\111\117\114\099\101\096 \109\101\109\098\101\114 \105\102 \101\108\101\109\101\110\116\084\114\097\099\105\110\103 \105\115 \115\101\116",function()local D={elementTracing=true}t.scoped(D,function()local D=H("\083\116\114\105\110\103\086\097\108\117\101");(expect(D.source)).to.be.a("\115\116\114\105\110\103")end)end)end
return function()
	local Component = require(script.Parent.Component)
	local ElementKind = require(script.Parent.ElementKind)
	local GlobalConfig = require(script.Parent.GlobalConfig)
	local Logging = require(script.Parent.Logging)
	local Type = require(script.Parent.Type)
	local Portal = require(script.Parent.Portal)
	local Children = require(script.Parent.PropMarkers.Children)

	local createElement = require(script.Parent.createElement)

	it("should create new primitive elements", function()
		local element = createElement("Frame")

		expect(element).to.be.ok()
		expect(Type.of(element)).to.equal(Type.Element)
		expect(ElementKind.of(element)).to.equal(ElementKind.Host)
	end)

	it("should create new functional elements", function()
		local element = createElement(function()
		end)

		expect(element).to.be.ok()
		expect(Type.of(element)).to.equal(Type.Element)
		expect(ElementKind.of(element)).to.equal(ElementKind.Function)
	end)

	it("should create new stateful components", function()
		local Foo = Component:extend("Foo")

		local element = createElement(Foo)

		expect(element).to.be.ok()
		expect(Type.of(element)).to.equal(Type.Element)
		expect(ElementKind.of(element)).to.equal(ElementKind.Stateful)
	end)

	it("should create new portal elements", function()
		local element = createElement(Portal)

		expect(element).to.be.ok()
		expect(Type.of(element)).to.equal(Type.Element)
		expect(ElementKind.of(element)).to.equal(ElementKind.Portal)
	end)

	it("should accept props", function()
		local element = createElement("StringValue", {
			Value = "Foo",
		})

		expect(element).to.be.ok()
		expect(element.props.Value).to.equal("Foo")
	end)

	it("should accept props and children", function()
		local child = createElement("IntValue")

		local element = createElement("StringValue", {
			Value = "Foo",
		}, {
			Child = child,
		})

		expect(element).to.be.ok()
		expect(element.props.Value).to.equal("Foo")
		expect(element.props[Children]).to.be.ok()
		expect(element.props[Children].Child).to.equal(child)
	end)

	it("should accept children with without props", function()
		local child = createElement("IntValue")

		local element = createElement("StringValue", nil, {
			Child = child,
		})

		expect(element).to.be.ok()
		expect(element.props[Children]).to.be.ok()
		expect(element.props[Children].Child).to.equal(child)
	end)

	it("should warn once if children is specified in two different ways", function()
		local logInfo = Logging.capture(function()
			-- Using a loop here to ensure that multiple occurences of the same
			-- warning only cause output once.
			for _ = 1, 2 do
				createElement("Frame", {
					[Children] = {},
				}, {})
			end
		end)

		expect(#logInfo.warnings).to.equal(1)
		expect(logInfo.warnings[1]:find("createElement")).to.be.ok()
		expect(logInfo.warnings[1]:find("Children")).to.be.ok()
	end)

	it("should have a `source` member if elementTracing is set", function()
		local config = {
			elementTracing = true,
		}

		GlobalConfig.scoped(config, function()
			local element = createElement("StringValue")

			expect(element.source).to.be.a("string")
		end)
	end)
end