Merge pull request #1832 from Textualize/batch-update

Batch update
This commit is contained in:
Will McGugan
2023-02-21 10:42:31 +00:00
committed by GitHub
10 changed files with 350 additions and 186 deletions

File diff suppressed because one or more lines are too long

17
tests/test_app.py Normal file
View File

@@ -0,0 +1,17 @@
from textual.app import App
def test_batch_update():
"""Test `batch_update` context manager"""
app = App()
assert app._batch_count == 0 # Start at zero
with app.batch_update():
assert app._batch_count == 1 # Increments in context manager
with app.batch_update():
assert app._batch_count == 2 # Nested updates
assert app._batch_count == 1 # Exiting decrements
assert app._batch_count == 0 # Back to zero