Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Assert the rendered state, not an empty inline style string
Assert the intended rendered visibility or computed style; checking an empty inline-style value alone does not establish what the user sees.
Bad example
| 1 | ad.ensureVisibility(); |
| 2 | expect(container.style.display).toBe(''); |
Explanation (EN)
An empty inline display string does not establish the rendered visibility.
Objašnjenje (HR)
Prazan inline display ne dokazuje stvarnu vidljivost elementa.
Good example
| 1 | ad.ensureVisibility(); |
| 2 | await expect.element(container).toBeVisible(); |
Explanation (EN)
The assertion follows the visible-state contract instead of one possible implementation detail.
Objašnjenje (HR)
Provjera prati očekivanu vidljivost umjesto jednog mogućeg detalja implementacije.
Notes (EN)
When the test contract is user-visible state, assert visibility or the specific computed style through a real rendering environment.
Exceptions / Tradeoffs (EN)
display other than none alone does not prove visibility: hidden ancestors, visibility, opacity and geometry can matter. An inline-style assertion remains valid when removing that inline override is itself the contract.