Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions spec/System/TestImport_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,30 @@ Implicits: 0]])
end
assert.truthy(found)
end)

it("remembers the persisted sharing website across build initialization", function()
local previousWebsite = main.lastExportedWebsite
local previousSessionWebsite = main.lastExportWebsite
main.lastExportedWebsite = "POBBin"
main.lastExportWebsite = nil
newBuild()
local selected = build.importTab.controls.exportFrom:GetSelValue().id
local control = build.importTab.controls.exportFrom
for index, site in ipairs(control.list) do
if site.id == "PoBCodes" then
control:SetSel(index)
break
end
end
local savedWebsite = main.lastExportedWebsite
main.lastExportWebsite = nil
newBuild()
local restored = build.importTab.controls.exportFrom:GetSelValue().id
main.lastExportedWebsite = previousWebsite
main.lastExportWebsite = previousSessionWebsite
assert.are.equal("POBBin", selected)
assert.are.equal("PoBCodes", savedWebsite)
assert.are.equal("PoBCodes", restored)
end)

end)
4 changes: 2 additions & 2 deletions src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -533,10 +533,10 @@ function ImportTabClass:ImportTab(build)
local exportWebsitesList = getExportSitesFromImportList()

self.controls.exportFrom = new("DropDownControl"):DropDownControl({ "LEFT", self.controls.generateCodeCopy, "RIGHT" }, { 8, 0, 120, 20 }, exportWebsitesList, function(_, selectedWebsite)
main.lastExportWebsite = selectedWebsite.id
main.lastExportedWebsite = selectedWebsite.id
self.exportWebsiteSelected = selectedWebsite.id
end)
self.controls.exportFrom:SelByValue(self.exportWebsiteSelected or main.lastExportWebsite or "Pastebin", "id")
self.controls.exportFrom:SelByValue(self.exportWebsiteSelected or main.lastExportedWebsite or exportWebsitesList[1].id, "id")
self.controls.generateCodeByLink = new("ButtonControl"):ButtonControl({ "LEFT", self.controls.exportFrom, "RIGHT" }, { 8, 0, 100, 20 }, "Share", function()
local exportWebsite = exportWebsitesList[self.controls.exportFrom.selIndex]
local subScriptId = buildSites.UploadBuild(self.controls.generateCodeOut.buf, exportWebsite)
Expand Down
Loading