Skip to content

Commit 159a4e3

Browse files
committed
style(spec): use tab indentation in TradeQuery test
1 parent 48859b1 commit 159a4e3

1 file changed

Lines changed: 50 additions & 50 deletions

File tree

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
describe("TradeQuery", function()
2-
describe("result dropdown tooltipFunc", function()
3-
-- Builds a TradeQuery with the strict minimum needed for
4-
-- PriceItemRowDisplay to construct row 1 without exploding. Only the
5-
-- two itemsTab subtables read by the slot lookup at the top of
6-
-- PriceItemRowDisplay need to be created here; everything else either
7-
-- lives behind a callback we never trigger, or is already initialized
8-
-- by the TradeQuery constructor.
9-
local function newTradeQuery(state)
10-
local tq = new("TradeQuery", { itemsTab = {} })
11-
tq.itemsTab.activeItemSet = {}
12-
tq.itemsTab.slots = {}
13-
tq.slotTables[1] = { slotName = "Ring 1" }
14-
if state.resultTbl then tq.resultTbl = state.resultTbl end
15-
if state.sortedResultTbl then tq.sortedResultTbl = state.sortedResultTbl end
16-
return tq
17-
end
2+
describe("result dropdown tooltipFunc", function()
3+
-- Builds a TradeQuery with the strict minimum needed for
4+
-- PriceItemRowDisplay to construct row 1 without exploding. Only the
5+
-- two itemsTab subtables read by the slot lookup at the top of
6+
-- PriceItemRowDisplay need to be created here; everything else either
7+
-- lives behind a callback we never trigger, or is already initialized
8+
-- by the TradeQuery constructor.
9+
local function newTradeQuery(state)
10+
local tq = new("TradeQuery", { itemsTab = {} })
11+
tq.itemsTab.activeItemSet = {}
12+
tq.itemsTab.slots = {}
13+
tq.slotTables[1] = { slotName = "Ring 1" }
14+
if state.resultTbl then tq.resultTbl = state.resultTbl end
15+
if state.sortedResultTbl then tq.sortedResultTbl = state.sortedResultTbl end
16+
return tq
17+
end
1818

19-
-- Builds row 1 of the trader UI and returns the dropdown that owns the
20-
-- tooltipFunc we want to exercise.
21-
local function buildRow1Dropdown(tq)
22-
tq:PriceItemRowDisplay(1, nil, 0, 20)
23-
return tq.controls.resultDropdown1
24-
end
19+
-- Builds row 1 of the trader UI and returns the dropdown that owns the
20+
-- tooltipFunc we want to exercise.
21+
local function buildRow1Dropdown(tq)
22+
tq:PriceItemRowDisplay(1, nil, 0, 20)
23+
return tq.controls.resultDropdown1
24+
end
2525

26-
it("returns early when sortedResultTbl[row_idx] is missing", function()
27-
-- No sorted results at all -> first guard must short-circuit.
28-
local tq = newTradeQuery({})
29-
local dropdown = buildRow1Dropdown(tq)
30-
local tooltip = new("Tooltip")
26+
it("returns early when sortedResultTbl[row_idx] is missing", function()
27+
-- No sorted results at all -> first guard must short-circuit.
28+
local tq = newTradeQuery({})
29+
local dropdown = buildRow1Dropdown(tq)
30+
local tooltip = new("Tooltip")
3131

32-
assert.has_no.errors(function()
33-
dropdown.tooltipFunc(tooltip, "DROP", 1, nil)
34-
end)
35-
assert.are.equal(0, #tooltip.lines)
36-
end)
32+
assert.has_no.errors(function()
33+
dropdown.tooltipFunc(tooltip, "DROP", 1, nil)
34+
end)
35+
assert.are.equal(0, #tooltip.lines)
36+
end)
3737

38-
it("returns early when the backing result entry has been cleared", function()
39-
-- The dropdown must be built against a valid result so that
40-
-- PriceItemRowDisplay's construction loop succeeds; we wipe
41-
-- resultTbl[1] only afterwards, to simulate a stale tooltip
42-
-- callback firing after the results were invalidated.
43-
local tq = newTradeQuery({
44-
resultTbl = { [1] = { [1] = { item_string = "Rarity: RARE\nBehemoth Hold\nGold Ring" } } },
45-
sortedResultTbl = { [1] = { { index = 1 } } },
46-
})
47-
local dropdown = buildRow1Dropdown(tq)
48-
tq.resultTbl[1] = {}
49-
local tooltip = new("Tooltip")
38+
it("returns early when the backing result entry has been cleared", function()
39+
-- The dropdown must be built against a valid result so that
40+
-- PriceItemRowDisplay's construction loop succeeds; we wipe
41+
-- resultTbl[1] only afterwards, to simulate a stale tooltip
42+
-- callback firing after the results were invalidated.
43+
local tq = newTradeQuery({
44+
resultTbl = { [1] = { [1] = { item_string = "Rarity: RARE\nBehemoth Hold\nGold Ring" } } },
45+
sortedResultTbl = { [1] = { { index = 1 } } },
46+
})
47+
local dropdown = buildRow1Dropdown(tq)
48+
tq.resultTbl[1] = {}
49+
local tooltip = new("Tooltip")
5050

51-
assert.has_no.errors(function()
52-
dropdown.tooltipFunc(tooltip, "DROP", 1, nil)
53-
end)
54-
assert.are.equal(0, #tooltip.lines)
55-
end)
56-
end)
51+
assert.has_no.errors(function()
52+
dropdown.tooltipFunc(tooltip, "DROP", 1, nil)
53+
end)
54+
assert.are.equal(0, #tooltip.lines)
55+
end)
56+
end)
5757
end)

0 commit comments

Comments
 (0)