-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use TestEZ instead of Nexus Unit Testing.
- Loading branch information
1 parent
fa79295
commit f7b41a9
Showing
8 changed files
with
187 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--[[ | ||
TheNexusAvenger | ||
Tests the ControllerIcon class. | ||
--]] | ||
--!strict | ||
|
||
local ControllerIcon = require(game:GetService("ReplicatedStorage"):WaitForChild("NexusButton"):WaitForChild("ControllerIcon")) | ||
|
||
return function() | ||
local TestControllerIcon = nil | ||
beforeEach(function() | ||
TestControllerIcon = ControllerIcon.new() | ||
end) | ||
afterEach(function() | ||
TestControllerIcon:Destroy() | ||
end) | ||
|
||
describe("A controller icon", function() | ||
it("should set an icon.", function() | ||
expect(TestControllerIcon.Icon).to.equal(nil) | ||
|
||
TestControllerIcon:SetIcon(Enum.KeyCode.ButtonA) | ||
expect(TestControllerIcon.Icon.Size).to.equal(UDim2.new(0.9, 0, 0.9, 0)) | ||
TestControllerIcon:SetIcon(Enum.KeyCode.ButtonL1) | ||
expect(TestControllerIcon.Icon.Size).to.equal(UDim2.new(0.9, 0, 0.45, 0)) | ||
|
||
TestControllerIcon:SetIcon(nil) | ||
expect(TestControllerIcon.Icon).to.equal(nil) | ||
end) | ||
|
||
it("should set a scale.", function() | ||
TestControllerIcon:SetIcon(Enum.KeyCode.ButtonA) | ||
|
||
TestControllerIcon:SetScale(0.6) | ||
expect(TestControllerIcon.Icon.Size).to.equal(UDim2.new(0.6, 0, 0.6, 0)) | ||
TestControllerIcon:SetIcon(Enum.KeyCode.ButtonL1) | ||
expect(TestControllerIcon.Icon.Size).to.equal(UDim2.new(0.6, 0, 0.3, 0)) | ||
end) | ||
end) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--[[ | ||
TheNexusAvenger | ||
Tests the ButtonFactory class. | ||
--]] | ||
--!strict | ||
|
||
_G.EnsureNexusWrappedInstanceSingleton = false | ||
local ButtonFactory = require(game:GetService("ReplicatedStorage"):WaitForChild("NexusButton"):WaitForChild("Factory"):WaitForChild("ButtonFactory")) | ||
|
||
return function() | ||
describe("A button factory", function() | ||
it("should set default properties.", function() | ||
local TestButtonFactory = ButtonFactory.new() | ||
TestButtonFactory:SetDefault("Name", "TestButton") | ||
TestButtonFactory:SetDefault("Size", UDim2.new(1, 2, 3, 4)) | ||
|
||
local Button1 = TestButtonFactory:Create() | ||
expect(Button1.Name).to.equal("TestButton") | ||
expect(Button1.Size).to.equal(UDim2.new(1, 2, 3, 4)) | ||
Button1:Destroy() | ||
|
||
TestButtonFactory:UnsetDefault("Name") | ||
local Button2 = TestButtonFactory:Create() | ||
expect(Button2.Name).never.to.equal("TestButton") | ||
expect(Button2.Size).to.equal(UDim2.new(1, 2, 3, 4)) | ||
Button2:Destroy() | ||
end) | ||
|
||
it("should be created from a default preset.", function() | ||
local TestButtonFactory = ButtonFactory.CreateDefault(Color3.new(0, 170 / 255, 1)) | ||
|
||
local Button = TestButtonFactory:Create() | ||
expect(Button.BackgroundColor3).to.equal(Color3.new(0, 170 / 255, 1)) | ||
expect(Button.BorderColor3).to.equal(Color3.new(0, 140 / 255, 225 / 255)) | ||
expect(Button.BorderTransparency).to.equal(0.25) | ||
Button:Destroy() | ||
end) | ||
end) | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--[[ | ||
TheNexusAvenger | ||
Tests the TextButtonFactory class. | ||
--]] | ||
--!strict | ||
|
||
_G.EnsureNexusWrappedInstanceSingleton = false | ||
local TextButtonFactory = require(game:GetService("ReplicatedStorage"):WaitForChild("NexusButton"):WaitForChild("Factory"):WaitForChild("TextButtonFactory")) | ||
|
||
return function() | ||
describe("A text button factory", function() | ||
it("should set default properties.", function() | ||
local TestButtonFactory = TextButtonFactory.new() | ||
TestButtonFactory:SetTextDefault("Text", "TestLabel") | ||
TestButtonFactory:SetTextDefault("Font", Enum.Font.Arcade) | ||
|
||
local Button1, TextLabel1 = TestButtonFactory:Create() | ||
expect(TextLabel1.Text).to.equal("TestLabel") | ||
expect(TextLabel1.Font).to.equal(Enum.Font.Arcade) | ||
Button1:Destroy() | ||
|
||
TestButtonFactory:UnsetTextDefault("Text") | ||
local Button2, TextLabel2 = TestButtonFactory:Create() | ||
expect(TextLabel2.Text).never.to.equal("TestLabel") | ||
expect(TextLabel2.Font).to.equal(Enum.Font.Arcade) | ||
Button2:Destroy() | ||
end) | ||
|
||
it("should be created from a default preset.", function() | ||
local TestButtonFactory = TextButtonFactory.CreateDefault(Color3.new(0, 170 / 255, 1)) | ||
|
||
local Button, TextLabel = TestButtonFactory:Create() | ||
expect(Button.BackgroundColor3).to.equal(Color3.new(0, 170 / 255, 1)) | ||
expect(Button.BorderColor3).to.equal(Color3.new(0, 140 / 255, 225 / 255)) | ||
expect(Button.BorderTransparency).to.equal(0.25) | ||
expect(TextLabel.Font).to.equal(Enum.Font.SourceSans) | ||
expect(TextLabel.TextColor3).to.equal(Color3.new(1, 1, 1)) | ||
expect(TextLabel.TextStrokeColor3).to.equal(Color3.new(0,0,0)) | ||
expect(TextLabel.TextStrokeTransparency).to.equal(0) | ||
expect(TextLabel.TextScaled).to.equal(true) | ||
Button:Destroy() | ||
end) | ||
end) | ||
end |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.