Skip to content

Commit 79636de

Browse files
committed
Redesign 404 page
The logo comes from https://www.rustacean.net
1 parent 7fa3dde commit 79636de

File tree

6 files changed

+56
-48
lines changed

6 files changed

+56
-48
lines changed

app/controllers/catch-all.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

app/styles/catch-all.module.css

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
.p404 {
2-
font-size: 120%;
3-
line-height: 3em;
1+
.wrapper {
2+
height: 100%;
3+
display: grid;
4+
place-items: center;
45
}
56

6-
.search-field {
7-
width: 100%;
8-
padding: 5px;
7+
.content {
8+
display: grid;
9+
place-items: center;
10+
margin: 25px 0;
11+
}
12+
13+
.logo {
14+
max-width: 200px;
15+
}
16+
17+
.link {
18+
font-weight: 500;
919
}

app/templates/catch-all.hbs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
<h1 data-test-404-header>Oops, that route doesn't exist!</h1>
1+
<div local-class="wrapper" data-test-404-page>
2+
<div local-class="content">
3+
{{svg-jar "cuddlyferris" local-class="logo"}}
24

3-
<form
4-
local-class='p404'
5-
data-test-404-search-form
6-
{{on "submit" (prevent-default this.search)}}
7-
>
8-
Perhaps a search of the site may help?
5+
<h1 local-class="title" data-test-title>Page not found</h1>
96

10-
<Input
11-
@type="text"
12-
local-class="search-field"
13-
placeholder="Search"
14-
aria-label="Search"
15-
@value={{this.header.searchValue}}
16-
required={{true}}
17-
data-test-404-search-input
18-
/>
19-
</form>
7+
<a href="javascript:history.back()" local-class="link">
8+
Go Back
9+
</a>
10+
</div>
11+
</div>

public/assets/cuddlyferris.svg

Lines changed: 21 additions & 0 deletions
Loading

tests/acceptance/404-test.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { currentURL, fillIn, triggerEvent, visit } from '@ember/test-helpers';
1+
import { currentURL, visit } from '@ember/test-helpers';
22
import { module, test } from 'qunit';
33

4+
import percySnapshot from '@percy/ember';
5+
46
import { setupApplicationTest } from 'cargo/tests/helpers';
57

68
module('Acceptance | 404', function (hooks) {
@@ -9,17 +11,9 @@ module('Acceptance | 404', function (hooks) {
911
test('/unknown-route shows a 404 page', async function (assert) {
1012
await visit('/unknown-route');
1113
assert.equal(currentURL(), '/unknown-route');
12-
assert.dom('[data-test-404-header]').exists();
13-
});
14-
15-
test('search on the 404 page works correctly', async function (assert) {
16-
await visit('/unknown-route');
17-
assert.dom('[data-test-404-search-input]').hasValue('');
18-
19-
await fillIn('[data-test-404-search-input]', 'rust');
20-
assert.dom('[data-test-404-search-input]').hasValue('rust');
14+
assert.dom('[data-test-404-page]').exists();
15+
assert.dom('[data-test-title]').hasText('Page not found');
2116

22-
await triggerEvent('[data-test-404-search-form]', 'submit');
23-
assert.equal(currentURL(), '/search?q=rust');
17+
await percySnapshot(assert);
2418
});
2519
});

tests/acceptance/token-invites-test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ module('Acceptance | /accept-invite/:token', function (hooks) {
1313
test('visiting to /accept-invite shows 404 page', async function (assert) {
1414
await visit('/accept-invite');
1515
assert.equal(currentURL(), '/accept-invite');
16-
assert.dom('main').containsText("Oops, that route doesn't exist!");
16+
assert.dom('[data-test-404-page]').exists();
17+
assert.dom('[data-test-title]').hasText('Page not found');
1718
});
1819

1920
test('visiting to /accept-invite/ shows 404 page', async function (assert) {
2021
await visit('/accept-invite/');
2122
assert.equal(currentURL(), '/accept-invite/');
22-
assert.dom('main').containsText("Oops, that route doesn't exist!");
23+
assert.dom('[data-test-404-page]').exists();
24+
assert.dom('[data-test-title]').hasText('Page not found');
2325
});
2426

2527
test('shows error for unknown token', async function (assert) {

0 commit comments

Comments
 (0)