mirror of
https://github.com/britzl/monarch.git
synced 2025-09-27 10:02:21 +02:00
Implement better behaviour for replace() on popups (#64)
This commit is contained in:
@@ -329,10 +329,49 @@ return function()
|
||||
assert(wait_until_shown(POPUP2), "Popup2 was never shown")
|
||||
assert_stack({ SCREEN1, POPUP1, POPUP2 })
|
||||
monarch.replace(SCREEN2)
|
||||
assert(wait_until_shown(SCREEN2), "Popup2 was never shown")
|
||||
assert(wait_until_shown(SCREEN2), "Screen2 was never shown")
|
||||
assert_stack({ SCREEN2 })
|
||||
end)
|
||||
|
||||
it("should replace a popup", function()
|
||||
monarch.show(SCREEN1)
|
||||
assert(wait_until_shown(SCREEN1), "Screen1 was never shown")
|
||||
assert_stack({ SCREEN1 })
|
||||
monarch.show(POPUP1)
|
||||
assert(wait_until_shown(POPUP1), "Popup1 was never shown")
|
||||
assert_stack({ SCREEN1, POPUP1 })
|
||||
monarch.replace(POPUP2)
|
||||
assert(wait_until_shown(POPUP2), "Popup2 was never shown")
|
||||
assert_stack({ SCREEN1, POPUP2 })
|
||||
end)
|
||||
|
||||
it("should replace a pop-up two levels down", function()
|
||||
monarch.show(SCREEN1)
|
||||
assert(wait_until_shown(SCREEN1), "Screen1 was never shown")
|
||||
assert_stack({ SCREEN1 })
|
||||
monarch.show(POPUP1)
|
||||
assert(wait_until_shown(POPUP1), "Popup1 was never shown")
|
||||
assert_stack({ SCREEN1, POPUP1 })
|
||||
monarch.show(POPUP2)
|
||||
assert(wait_until_shown(POPUP2), "Popup2 was never shown")
|
||||
assert_stack({ SCREEN1, POPUP1, POPUP2 })
|
||||
monarch.show(POPUP2, { pop = 2 })
|
||||
assert(wait_until_shown(POPUP2), "Popup2 was never shown")
|
||||
assert_stack({ SCREEN1, POPUP2 })
|
||||
end)
|
||||
|
||||
it("shouldn't over-pop popups", function()
|
||||
monarch.show(SCREEN1)
|
||||
assert(wait_until_shown(SCREEN1), "Screen1 was never shown")
|
||||
assert_stack({ SCREEN1 })
|
||||
monarch.show(POPUP1)
|
||||
assert(wait_until_shown(POPUP1), "Popup1 was never shown")
|
||||
assert_stack({ SCREEN1, POPUP1 })
|
||||
monarch.show(POPUP2, { pop = 10 })
|
||||
assert(wait_until_shown(POPUP2), "Popup2 was never shown")
|
||||
assert_stack({ SCREEN1, POPUP2 })
|
||||
end)
|
||||
|
||||
it("should be able to get the id of the screen at the top and bottom of the stack", function()
|
||||
assert(monarch.top() == nil)
|
||||
assert(monarch.bottom() == nil)
|
||||
|
Reference in New Issue
Block a user