diff --git a/src/Models/Core/MainModule/BTKPlugin/init.spec.lua b/src/Models/Core/MainModule/BTKPlugin/init.spec.lua new file mode 100644 index 0000000..9b5717a --- /dev/null +++ b/src/Models/Core/MainModule/BTKPlugin/init.spec.lua @@ -0,0 +1,16 @@ +return function() + local BTKPlugin = require(script.Parent) + + describe("BTKPlugin", function() + it("should require ok", function() + expect(BTKPlugin).to.be.ok() + end) + + --[[ + --- @TODO no support for emulating plugins yet + it("should new ok", function() + expect(BTKPlugin:new()).to.be.ok() + end) + --]] + end) +end \ No newline at end of file diff --git a/src/Models/Core/MainModule/UI/Components/AssetItem.spec.lua b/src/Models/Core/MainModule/UI/Components/AssetItem.spec.lua new file mode 100644 index 0000000..da87596 --- /dev/null +++ b/src/Models/Core/MainModule/UI/Components/AssetItem.spec.lua @@ -0,0 +1,16 @@ +return function() + local AssetItem = require(script.Parent.AssetItem) + + describe("AssetItem", function() + it("should require ok", function() + expect(AssetItem).to.be.ok() + end) + + --[[ + --- @TODO cannot emulate marketplaceservice yet + it("should new ok", function() + expect(AssetItem:init()).to.be.ok() + end) + --]] + end) +end \ No newline at end of file diff --git a/src/Models/Core/MainModule/UI/Components/AssetsWidget.lua b/src/Models/Core/MainModule/UI/Components/AssetsWidget.lua index 85d1712..f40a038 100644 --- a/src/Models/Core/MainModule/UI/Components/AssetsWidget.lua +++ b/src/Models/Core/MainModule/UI/Components/AssetsWidget.lua @@ -11,6 +11,7 @@ local c = Roact.createElement local AssetsWidget = Roact.Component:extend("AssetsWidget") function AssetsWidget:init(props) + assert(props) self.state = { Plugin = props.Plugin, CurrentCategory = nil, diff --git a/src/Models/Core/MainModule/UI/Components/AssetsWidget.spec.lua b/src/Models/Core/MainModule/UI/Components/AssetsWidget.spec.lua new file mode 100644 index 0000000..c91e513 --- /dev/null +++ b/src/Models/Core/MainModule/UI/Components/AssetsWidget.spec.lua @@ -0,0 +1,15 @@ +return function() + local AssetsWidget = require(script.Parent.AssetsWidget) + + describe("AssetsWidget", function() + it("should require ok", function() + expect(AssetsWidget).to.be.ok() + end) + + it("should new ok", function() + expect(AssetsWidget:init({ + Plugin = "foo", + })).never.to.be.ok() + end) + end) +end \ No newline at end of file diff --git a/src/Models/Core/MainModule/UI/Components/ConfigurationWidget.spec.lua b/src/Models/Core/MainModule/UI/Components/ConfigurationWidget.spec.lua new file mode 100644 index 0000000..ecc8bd7 --- /dev/null +++ b/src/Models/Core/MainModule/UI/Components/ConfigurationWidget.spec.lua @@ -0,0 +1,15 @@ +return function() + local ConfigurationWidget = require(script.Parent.ConfigurationWidget) + + describe("ConfigurationWidget", function() + it("should require ok", function() + expect(ConfigurationWidget).to.be.ok() + end) + + --[[ @TODO no support for selection + it("should new ok", function() + expect(ConfigurationWidget:init({})).never.to.be.ok() + end) + --]] + end) +end \ No newline at end of file diff --git a/src/Models/Core/MainModule/UI/Components/Dropdown.spec.lua b/src/Models/Core/MainModule/UI/Components/Dropdown.spec.lua new file mode 100644 index 0000000..a7d4354 --- /dev/null +++ b/src/Models/Core/MainModule/UI/Components/Dropdown.spec.lua @@ -0,0 +1,13 @@ +return function() + local Dropdown = require(script.Parent.Dropdown) + + describe("Dropdown", function() + it("should require ok", function() + expect(Dropdown).to.be.ok() + end) + + it("should new ok", function() + expect(Dropdown:init({})).never.to.be.ok() + end) + end) +end \ No newline at end of file diff --git a/src/Models/Core/MainModule/UI/Components/TextLabel.spec.lua b/src/Models/Core/MainModule/UI/Components/TextLabel.spec.lua new file mode 100644 index 0000000..965cf5d --- /dev/null +++ b/src/Models/Core/MainModule/UI/Components/TextLabel.spec.lua @@ -0,0 +1,13 @@ +return function() + local TextLabel = require(script.Parent.TextLabel) + + describe("TextLabel", function() + it("should require ok", function() + expect(TextLabel).to.be.ok() + end) + + it("should new ok", function() + expect(TextLabel:init({})).never.to.be.ok() + end) + end) +end \ No newline at end of file diff --git a/src/Models/Core/MainModule/UI/init.spec.lua b/src/Models/Core/MainModule/UI/init.spec.lua new file mode 100644 index 0000000..005ba15 --- /dev/null +++ b/src/Models/Core/MainModule/UI/init.spec.lua @@ -0,0 +1,13 @@ +return function() + local UI = require(script.Parent) + + describe("UI", function() + it("should require ok", function() + expect(UI).to.be.ok() + end) + + it("should new ok", function() + expect(UI:new()).to.be.ok() + end) + end) +end \ No newline at end of file diff --git a/src/Models/Core/MainModule/scripts/Area.lua b/src/Models/Core/MainModule/scripts/Area.lua index f9b2bfc..f5b3537 100644 --- a/src/Models/Core/MainModule/scripts/Area.lua +++ b/src/Models/Core/MainModule/scripts/Area.lua @@ -7,14 +7,12 @@ local Area = Model:subclass(script.Name) Area:AddProperty({ Name = "AreaPart", Type = "ObjectValue", - ValueFn = function(self2) - return self2:GetPrimaryPart() - end, - SchemaFn = Schema:IsA("BasePart"), + SchemaFn = Schema.Optional(Schema:IsA("BasePart")), }) function Area:initialize(input) Model.initialize(self, input) + self:SetAreaPart(self:GetPrimaryPart()) local partValue = self:GetAreaPart() partValue.Anchored = true diff --git a/src/Models/Core/MainModule/scripts/Area.spec.lua b/src/Models/Core/MainModule/scripts/Area.spec.lua new file mode 100644 index 0000000..090173e --- /dev/null +++ b/src/Models/Core/MainModule/scripts/Area.spec.lua @@ -0,0 +1,18 @@ +return function() + local Area = require(script.Parent.Area) + + describe("Area", function() + it("should require ok", function() + expect(Area).to.be.ok() + end) + + --[[ + --- @TODO this fails now + it("should new ok", function() + expect(Area:new({ + Script = Instance.new("Script"), + })).to.be.ok() + end) + --]] + end) +end \ No newline at end of file diff --git a/src/Models/Core/MainModule/scripts/Collectable.lua b/src/Models/Core/MainModule/scripts/Collectable.lua index 44dd863..d1556d1 100644 --- a/src/Models/Core/MainModule/scripts/Collectable.lua +++ b/src/Models/Core/MainModule/scripts/Collectable.lua @@ -8,23 +8,19 @@ local Collectable = Model:subclass(script.Name) Collectable:AddProperty({ Name = "CollectablePart", Type = "ObjectValue", - ValueFn = function(self2) - return self2:GetPrimaryPart() - end, - SchemaFn = Schema:IsA("BasePart"), + SchemaFn = Schema.Optional(Schema:IsA("BasePart")), }) Collectable:AddProperty({ Name = "CollectableAttachment", Type = "ObjectValue", - ValueFn = function(self2) - return Instance.new("Attachment", self2:GetCollectablePart()) - end, - SchemaFn = Schema:IsA("Attachment"), + SchemaFn = Schema.Optional(Schema:IsA("Attachment")), }) function Collectable:initialize(input) Model.initialize(self, input) + self:SetCollectableAttachment(self:GetPrimaryPart()) + self:SetCollectableAttachment(Instance.new("Attachment", self:GetCollectablePart())) end return Collectable \ No newline at end of file diff --git a/src/Models/Core/MainModule/scripts/PlatformMover.lua b/src/Models/Core/MainModule/scripts/PlatformMover.lua index 3882345..bb26b6c 100644 --- a/src/Models/Core/MainModule/scripts/PlatformMover.lua +++ b/src/Models/Core/MainModule/scripts/PlatformMover.lua @@ -7,11 +7,6 @@ local PlatformMover = Model:subclass(script.Name) PlatformMover:AddProperty({ Name = "PlatformPart", Type = "ObjectValue", - ValueFn = function(self) - local a = self:GetPrimaryPart() - a.Anchored = true - return a - end, SchemaFn = Schema:IsA("BasePart"), }) PlatformMover:AddProperty({ @@ -37,6 +32,9 @@ PlatformMover:AddProperty({ function PlatformMover:initialize(input) Model.initialize(self, input) + local a = self:GetPrimaryPart() + a.Anchored = true + self:SetPlatformPart(a) self:GetStartPositionMarker().Transparency = 1 self:EndStartPositionMarker().Transparency = 1 diff --git a/src/Models/Core/MainModule/scripts/Tool.lua b/src/Models/Core/MainModule/scripts/Tool.lua index 322d6c3..7f3fd9d 100644 --- a/src/Models/Core/MainModule/scripts/Tool.lua +++ b/src/Models/Core/MainModule/scripts/Tool.lua @@ -10,9 +10,6 @@ local Tool = BaseScript:subclass(script.Name) Tool:AddProperty({ Name = "Owner", Type = "ObjectValue", - ValueFn = function(self) - self:_getOwner() - end, SchemaFn = Schema.Optional( Schema.CharacterModel ), @@ -27,6 +24,7 @@ Tool:AddProperty({ function Tool:initialize(input) BaseScript.initialize(self, input) + self:SetOwner(self:_getOwner()) self:AssertSchema(input.Root, Schema:IsA("Tool"))