Add create(a, { props }) syntax (#42)

* Add new create syntax

* Add new create syntax to changelog

* Fix new create syntax test
This commit is contained in:
11poe 2024-11-16 21:20:49 +01:00 committed by GitHub
parent 8799988851
commit 44fe65ee5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 70 additions and 40 deletions

View file

@ -721,6 +721,19 @@ TEST("create()", wrap_root(function()
local source = vide.source
local cleanup = vide.cleanup
do CASE "create(\"ClassName\", props) syntax"
local frame = create("Frame", { BackgroundTransparency = 0.5, Name = "Foo" })
CHECK(frame.BackgroundTransparency == 0.5)
CHECK(frame.Name == "Foo")
end
do CASE "create(Instance, props) syntax"
local frame0 = create("Frame", { BackgroundTransparency = 0.5, Name = "Foo" })
local frame = create(frame0, { BackgroundTransparency = 1 })
CHECK(frame.BackgroundTransparency == 1)
CHECK(frame.Name == "Foo")
end
do CASE "apply default properties"
local defaults = require "../src/defaults"
local frame = create "Frame" {} :: Instance & { BorderSizePixel: any, BorderColor3: any }