|
| 1 | +## Purpose |
| 2 | + |
| 3 | +Defines how a block's stored query-parameter conditions determine whether it is shown or hidden on the front end, and how the page is cleaned up after a block is hidden. |
| 4 | + |
| 5 | +## Requirements |
| 6 | + |
| 7 | +### Requirement: A block is shown if any of its stored conditions matches the current URL |
| 8 | +A block carries a set of query-parameter conditions (key/value pairs). On the front end, the system SHALL compare each condition's value against the current page URL's query string. The block SHALL be shown if at least one condition matches; it SHALL be hidden only if none of its conditions match. |
| 9 | + |
| 10 | +#### Scenario: Single condition matches |
| 11 | +- **WHEN** a block has one condition `key=value` and the current URL's query string contains `key=value` |
| 12 | +- **THEN** the block is shown |
| 13 | + |
| 14 | +#### Scenario: Single condition does not match a present, different value |
| 15 | +- **WHEN** a block has one condition `key=value` and the current URL's query string contains `key=other` |
| 16 | +- **THEN** the block is hidden |
| 17 | + |
| 18 | +#### Scenario: Single condition's query parameter is absent |
| 19 | +- **WHEN** a block has one condition `key=value` and the current URL's query string does not contain `key` at all |
| 20 | +- **THEN** the block is hidden |
| 21 | + |
| 22 | +#### Scenario: Any one of several conditions matching is enough to show the block |
| 23 | +- **WHEN** a block has conditions `a=1` and `b=2`, and the current URL's query string contains `b=2` but not `a=1` |
| 24 | +- **THEN** the block is shown |
| 25 | + |
| 26 | +#### Scenario: None of several conditions match |
| 27 | +- **WHEN** a block has conditions `a=1` and `b=2`, and the current URL's query string contains neither |
| 28 | +- **THEN** the block is hidden |
| 29 | + |
| 30 | +### Requirement: A shown block no longer carries its visibility marker |
| 31 | +Once a block is determined to be shown, the system SHALL remove the marker that identifies it as having conditional visibility, so it is not reprocessed on subsequent passes and carries no leftover marker in the rendered page. |
| 32 | + |
| 33 | +#### Scenario: Marker removed after a block is shown |
| 34 | +- **WHEN** a block's conditions cause it to be shown |
| 35 | +- **THEN** the block's conditional-visibility marker is removed from the rendered element |
| 36 | + |
| 37 | +### Requirement: Hiding a block does not remove unrelated page content |
| 38 | +When a block is hidden, the system SHALL remove ancestor elements that are left with no remaining content, so empty wrapper structure does not linger in the page. The system SHALL NOT remove an ancestor that still contains non-text content (for example, an image or embedded media) after the hidden block is removed, and SHALL NOT remove any element at or above the page's site root. |
| 39 | + |
| 40 | +#### Scenario: An ancestor left with no content is removed |
| 41 | +- **WHEN** a block is hidden and its immediate wrapper has no other content once the block is removed |
| 42 | +- **THEN** that wrapper is also removed |
| 43 | + |
| 44 | +#### Scenario: An ancestor with remaining non-text content is preserved |
| 45 | +- **WHEN** a block is hidden and its wrapper contains other non-text content (for example, an image) once the block is removed |
| 46 | +- **THEN** that wrapper and its non-text content are preserved |
| 47 | + |
| 48 | +#### Scenario: Cleanup never reaches above the site root |
| 49 | +- **WHEN** a block is hidden and every ancestor up to the page's site root ends up with no remaining content |
| 50 | +- **THEN** the site root and everything above it (including the document body and root element) are preserved |
0 commit comments