Unverified Commit 752d6e49 authored by Balázs Orbán's avatar Balázs Orbán Committed by GitHub

feat(error-overlay): style tweaks (#63522)

parent 043bbaa7
...@@ -255,8 +255,8 @@ export function Errors({ ...@@ -255,8 +255,8 @@ export function Errors({
<span>{activeIdx + 1}</span> of{' '} <span>{activeIdx + 1}</span> of{' '}
<span data-nextjs-dialog-header-total-count> <span data-nextjs-dialog-header-total-count>
{readyErrors.length} {readyErrors.length}
</span>{' '} </span>
unhandled error {' error'}
{readyErrors.length < 2 ? '' : 's'} {readyErrors.length < 2 ? '' : 's'}
</small> </small>
{versionInfo ? <VersionStalenessInfo {...versionInfo} /> : null} {versionInfo ? <VersionStalenessInfo {...versionInfo} /> : null}
...@@ -316,10 +316,10 @@ export const styles = css` ...@@ -316,10 +316,10 @@ export const styles = css`
margin-left: var(--size-gap-double); margin-left: var(--size-gap-double);
} }
.nextjs-container-errors-header small > span { .nextjs-container-errors-header small > span {
font-family: var(--font-stack-monospace); font-family: sans-serif;
} }
.nextjs-container-errors-header p { .nextjs-container-errors-header p {
font-family: var(--font-stack-monospace); font-family: sans-serif;
font-size: var(--size-font-small); font-size: var(--size-font-small);
line-height: var(--size-font-big); line-height: var(--size-font-big);
font-weight: bold; font-weight: bold;
...@@ -328,14 +328,13 @@ export const styles = css` ...@@ -328,14 +328,13 @@ export const styles = css`
white-space: pre-wrap; white-space: pre-wrap;
} }
.nextjs__container_errors_desc--error { .nextjs__container_errors_desc--error {
color: var(--color-ansi-red); padding-left: var(--size-gap);
border-left: 4px solid var(--color-accents-1);
color: var(--color-font);
} }
.nextjs__container_errors__extra { .nextjs__container_errors__extra {
margin: 20px 0; margin: 20px 0;
} }
nextjs__container_errors__extra__code {
margin: 10px 0;
}
.nextjs-container-errors-header > div > small { .nextjs-container-errors-header > div > small {
margin: 0; margin: 0;
margin-top: var(--size-gap-half); margin-top: var(--size-gap-half);
......
...@@ -3,6 +3,7 @@ import { sandbox } from 'development-sandbox' ...@@ -3,6 +3,7 @@ import { sandbox } from 'development-sandbox'
import { FileRef, nextTestSetup } from 'e2e-utils' import { FileRef, nextTestSetup } from 'e2e-utils'
import path from 'path' import path from 'path'
import { outdent } from 'outdent' import { outdent } from 'outdent'
import { getRedboxTotalErrorCount } from 'next-test-utils'
// https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js used as a reference // https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js used as a reference
...@@ -373,10 +374,7 @@ describe('Error overlay for hydration errors', () => { ...@@ -373,10 +374,7 @@ describe('Error overlay for hydration errors', () => {
await session.waitForAndOpenRuntimeError() await session.waitForAndOpenRuntimeError()
expect(await session.hasRedbox()).toBe(true) expect(await session.hasRedbox()).toBe(true)
const totalErrorCount = await browser expect(await getRedboxTotalErrorCount(browser)).toBe(1)
.elementByCss('[data-nextjs-dialog-header-total-count]')
.text()
expect(totalErrorCount).toBe('1')
const description = await session.getRedboxDescription() const description = await session.getRedboxDescription()
expect(description).toContain( expect(description).toContain(
...@@ -436,10 +434,7 @@ describe('Error overlay for hydration errors', () => { ...@@ -436,10 +434,7 @@ describe('Error overlay for hydration errors', () => {
await session.waitForAndOpenRuntimeError() await session.waitForAndOpenRuntimeError()
expect(await session.hasRedbox()).toBe(true) expect(await session.hasRedbox()).toBe(true)
const totalErrorCount = await browser expect(await getRedboxTotalErrorCount(browser)).toBe(1)
.elementByCss('[data-nextjs-dialog-header-total-count]')
.text()
expect(totalErrorCount).toBe('1')
const description = await session.getRedboxDescription() const description = await session.getRedboxDescription()
expect(description).toContain( expect(description).toContain(
......
...@@ -790,6 +790,13 @@ export async function getRedboxHeader(browser: BrowserInterface) { ...@@ -790,6 +790,13 @@ export async function getRedboxHeader(browser: BrowserInterface) {
) )
} }
export async function getRedboxTotalErrorCount(browser: BrowserInterface) {
return parseInt(
(await getRedboxHeader(browser)).match(/\d+ of (\d+) error/)?.[1],
10
)
}
export async function getRedboxSource(browser: BrowserInterface) { export async function getRedboxSource(browser: BrowserInterface) {
return retry( return retry(
() => () =>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment