| 35 | |
| 36 | |
| 37 | async def test_hover_update_styles(): |
| 38 | app = MyApp(ansi_color=False) |
| 39 | async with app.run_test() as pilot: |
| 40 | button = app.query_one(Button) |
| 41 | assert button.pseudo_classes == { |
| 42 | "blur", |
| 43 | "can-focus", |
| 44 | "dark", |
| 45 | "enabled", |
| 46 | "first-of-type", |
| 47 | "last-of-type", |
| 48 | "last-child", |
| 49 | "even", |
| 50 | "empty", |
| 51 | } |
| 52 | |
| 53 | # Take note of the initial background colour |
| 54 | initial_background = button.styles.background |
| 55 | await pilot.hover(Button) |
| 56 | |
| 57 | # We've hovered, so ensure the pseudoclass is present and background changed |
| 58 | assert button.pseudo_classes == { |
| 59 | "blur", |
| 60 | "can-focus", |
| 61 | "dark", |
| 62 | "enabled", |
| 63 | "hover", |
| 64 | "first-of-type", |
| 65 | "last-of-type", |
| 66 | "last-child", |
| 67 | "even", |
| 68 | "empty", |
| 69 | } |
| 70 | assert button.styles.background != initial_background |
| 71 | |
| 72 | |
| 73 | def test_setting_title(): |