Sub topic 12
Long Text, Empty States and Missing Images
A design file shows the page in its best moment. Names fit on one line, every card has a photo, and every list has items. Real content does not behave this way. This chapter covers how to test a built page against the content it will actually receive.
Prerequisites: you know the CSS box model, Flexbox and Grid basics, and how to edit the DOM in browser DevTools. You have already done the layout, spacing and responsive checks from earlier chapters.
Why content edge cases belong in a visual QA pass
A design is a sample. It cannot show every possible string or data state. When the build meets real data, three kinds of failure appear:
- Overflow: text or media pushes past its container, overlaps a neighbor, or forces horizontal scrolling.
- Absence: a list, image or field has nothing to show, and the page shows a blank hole or a broken-looking fragment.
- Failure: an image does not load, so the browser shows a broken-image icon or collapses the layout.
The design may not show these states. Ask the designer whether they exist. If the design is silent, you are not checking for a mismatch. You are checking that the build degrades gracefully, and you report what you find as a question or a suggestion, not as a defect against the spec.
Long text
What to test
Pick the components that show user or CMS content: titles, names, button labels, navigation items, table cells, breadcrumbs, tags and card descriptions. For each, test four kinds of text:
| Test string | What it exposes |
|---|---|
| Very long sentence with normal spaces | Wrapping, line count, card height mismatch |
| One long word with no spaces (`Pneumonoultramicroscopicsilicovolcanoconiosis`) | Horizontal overflow |
| Long unbroken string such as an email address or URL | Overflow in narrow columns |
| Very short text (one character) | Buttons and tags that collapse or look wrong |
Also test text in the longest language you ship. German and Finnish words are often much longer than English ones. A button that fits "Save" may not fit "Speichern".
Injecting test text in DevTools
You do not need to change the source or the database. Edit the text in the Elements panel, or run a snippet in the console. This one replaces the text of every element matching a selector and puts the original back when you call the returned function.
function stressText(selector, replacement) {
const nodes = [...document.querySelectorAll(selector)];
const originals = nodes.map((n) => n.textContent);
nodes.forEach((n) => {
n.textContent = replacement;
});
return function restore() {
nodes.forEach((n, i) => {
n.textContent = originals[i];
});
};
}
const longTitle =
'An unusually long product title that keeps going well past what the designer imagined would fit';
const restore = stressText('.card h2', longTitle);
// Inspect the page, then undo:
// restore();Change .card h2 to a selector that exists on your page. The snippet changes text only in the live DOM, so reloading the page also resets it.
What to look for
- Overflow. Does text cross the container edge or cause a horizontal scrollbar? Test at 320 px as well as desktop widths.
- Truncation. If the design uses an ellipsis, check that the build truncates at the intended line count. A single-line ellipsis needs three properties together, and removing any one breaks it.
- Equal-height cards. When one card has a long title, do its neighbors stretch, or does the row break apart?
- Hidden information. If text is truncated, can the user still reach the full text, for example through a title attribute, a detail page or an expand control?
A typical CSS fix for the common cases looks like this:
/* Single-line truncation with an ellipsis */
.truncate-one {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Truncate after three lines */
.truncate-three {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
line-clamp: 3;
overflow: hidden;
}
/* Let long words and URLs break instead of overflowing */
.wrap-anywhere {
overflow-wrap: anywhere;
}A frequent gotcha: a child of a Flexbox or Grid container will not shrink below its content width unless you set min-width: 0 on it. If a truncation rule appears to do nothing, check the parent layout first.
Empty states
An empty state is what a screen shows when there is no data: a new account with no orders, a search with no results, a filter that matches nothing, or a cleared inbox.
States to trigger
- First use: the user has never created anything.
- No results: a search or filter returns zero items.
- Cleared: the user deleted everything.
- Partial: a field is optional and blank, such as a missing subtitle, phone number or avatar.
You can create these without touching the backend. Use DevTools to delete the list items from the DOM, or use the Network panel's request blocking to stop a data request, and see what the page shows.
What to check
- Is there a designed empty state, and does the build match it in copy, illustration, spacing and button style?
- If there is none, does the page show a heading with nothing under it, a table header with no rows, or a zero-height container that leaves odd spacing?
- Do counters and labels still make sense? "0 results" is fine. "1 results" or "undefined" is not.
- Do optional fields leave a gap? A hidden subtitle should not leave its margin behind. This often happens when the margin sits on the empty element instead of on its neighbor.
The CSS :empty selector and the Grid gap property help here. :empty matches an element with no children, including no text nodes, so whitespace inside the element can stop it from matching. Check this in DevTools before you rely on it.
Missing and failed images
Three different cases
| Case | Cause | What the user sees by default |
|---|---|---|
| No image provided | The data field is empty | Nothing, or a collapsed box |
| Image fails to load | Bad URL, 404, network failure, blocked request | Broken-image icon and alt text |
| Image loads slowly | Slow connection | Empty space, then a layout jump |
How to test
- Open the Network panel, right-click an image request, and choose Block request URL. Reload.
- Edit the
srcattribute to a path that does not exist. - Throttle the network to a slow preset and watch how the layout shifts as images arrive.
- Remove the
srcattribute from an avatar or thumbnail to test the "no image" case.
What to check
- Reserved space. Does the image container keep its size when the image is missing? Setting
widthandheightattributes or CSSaspect-ratioprevents a layout jump when the image arrives late. - Fallback. Is there a placeholder, initials avatar or neutral background, as the design intends?
- Alt text. Failed images show their
alttext. Check that it is meaningful and fits its container. A decorative image should havealt="". - Cropping. With
object-fit: cover, check that unusual shapes (very tall, very wide, tiny) still crop acceptably and that faces or key content are not cut off.
.thumb {
aspect-ratio: 4 / 3;
width: 100%;
object-fit: cover;
background-color: #e5e7eb; /* visible placeholder while loading or on failure */
}A repeatable pass
For each component, record which state you tested. A report that says "card title overflows" is hard to reproduce. A report that says "card title overflows when it is 90 characters long at 375 px" can be fixed.
Common errors in this kind of testing
- Testing only with the placeholder text from the design. It was chosen to fit.
- Fixing the symptom in DevTools and forgetting that the edit disappears on reload. Copy the working CSS into your report.
- Treating every missing state as a defect. Missing from the design means a question, not a mismatch.
- Testing at one width. Overflow often appears only at 320 to 375 px.
- Forgetting right-to-left or non-Latin text if the site supports them.
Exercise
A product card title is truncated with white-space: nowrap; overflow: hidden; text-overflow: ellipsis;, but at 375 px the long title still pushes the card wider than the screen. The card is a child of a Flexbox row. What is the most likely cause, and what one-line fix would you try first?
Show answer
A Flexbox child has min-width: auto by default, so it will not shrink below the width of its content, and the unbroken title keeps the card wide. Set min-width: 0 on the card (or on the text container inside it) so it can shrink and the ellipsis rule can take effect.
Exercise
You find that a profile page shows a gap where an optional subtitle should be when the user has not entered one. The design only shows a profile with a subtitle. Should you file this as a mismatch with the design? How would you word the report?
Show answer
No. The design does not specify the no-subtitle state, so it is not a mismatch. Report it as an open question or suggestion, for example: "When the subtitle is empty, a 16 px gap remains between the name and the bio. The design does not show this state. Can the gap be removed, for example by moving the margin onto the following element?" Include the state you tested and the viewport width.