Skip to content

Frontend: quote the crate name #11586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/routes/crate.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export default class CrateRoute extends Route {
return crate;
} catch (error) {
if (error instanceof NotFoundError) {
let title = `${crateName}: Crate not found`;
let title = `'${crateName}': Crate not found`;
this.router.replaceWith('catch-all', { transition, error, title });
} else {
let title = `${crateName}: Failed to load crate data`;
let title = `'${crateName}': Failed to load crate data`;
this.router.replaceWith('catch-all', { transition, error, title, tryAgain: true });
}
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/acceptance/crate-dependencies.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.describe('Acceptance | crate dependencies page', { tag: '@acceptance' }, ()
await page.goto('/crates/foo/1.0.0/dependencies');
await expect(page).toHaveURL('/crates/foo/1.0.0/dependencies');
await expect(page.locator('[data-test-404-page]')).toBeVisible();
await expect(page.locator('[data-test-title]')).toHaveText('foo: Crate not found');
await expect(page.locator('[data-test-title]')).toHaveText(`'foo': Crate not found`);
await expect(page.locator('[data-test-go-back]')).toBeVisible();
await expect(page.locator('[data-test-try-again]')).toHaveCount(0);
});
Expand All @@ -45,7 +45,7 @@ test.describe('Acceptance | crate dependencies page', { tag: '@acceptance' }, ()
await page.goto('/crates/foo/1.0.0/dependencies');
await expect(page).toHaveURL('/crates/foo/1.0.0/dependencies');
await expect(page.locator('[data-test-404-page]')).toBeVisible();
await expect(page.locator('[data-test-title]')).toHaveText('foo: Failed to load crate data');
await expect(page.locator('[data-test-title]')).toHaveText(`'foo': Failed to load crate data`);
await expect(page.locator('[data-test-go-back]')).toHaveCount(0);
await expect(page.locator('[data-test-try-again]')).toBeVisible();
});
Expand Down
4 changes: 2 additions & 2 deletions e2e/acceptance/crate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ test.describe('Acceptance | crate page', { tag: '@acceptance' }, () => {
await page.goto('/crates/nanomsg');
await expect(page).toHaveURL('/crates/nanomsg');
await expect(page.locator('[data-test-404-page]')).toBeVisible();
await expect(page.locator('[data-test-title]')).toHaveText('nanomsg: Crate not found');
await expect(page.locator('[data-test-title]')).toHaveText(`'nanomsg': Crate not found`);
await expect(page.locator('[data-test-go-back]')).toBeVisible();
await expect(page.locator('[data-test-try-again]')).toHaveCount(0);
});
Expand All @@ -92,7 +92,7 @@ test.describe('Acceptance | crate page', { tag: '@acceptance' }, () => {
await page.goto('/crates/nanomsg');
await expect(page).toHaveURL('/crates/nanomsg');
await expect(page.locator('[data-test-404-page]')).toBeVisible();
await expect(page.locator('[data-test-title]')).toHaveText('nanomsg: Failed to load crate data');
await expect(page.locator('[data-test-title]')).toHaveText(`'nanomsg': Failed to load crate data`);
await expect(page.locator('[data-test-go-back]')).toHaveCount(0);
await expect(page.locator('[data-test-try-again]')).toBeVisible();
});
Expand Down
4 changes: 2 additions & 2 deletions e2e/routes/crate/range.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ test.describe('Route | crate.range', { tag: '@routes' }, () => {
await page.goto('/crates/foo/range/^3');
await expect(page).toHaveURL('/crates/foo/range/%5E3');
await expect(page.locator('[data-test-404-page]')).toBeVisible();
await expect(page.locator('[data-test-title]')).toHaveText('foo: Crate not found');
await expect(page.locator('[data-test-title]')).toHaveText(`'foo': Crate not found`);
await expect(page.locator('[data-test-go-back]')).toBeVisible();
await expect(page.locator('[data-test-try-again]')).toHaveCount(0);
});
Expand All @@ -87,7 +87,7 @@ test.describe('Route | crate.range', { tag: '@routes' }, () => {
await page.goto('/crates/foo/range/^3');
await expect(page).toHaveURL('/crates/foo/range/%5E3');
await expect(page.locator('[data-test-404-page]')).toBeVisible();
await expect(page.locator('[data-test-title]')).toHaveText('foo: Failed to load crate data');
await expect(page.locator('[data-test-title]')).toHaveText(`'foo': Failed to load crate data`);
await expect(page.locator('[data-test-go-back]')).toHaveCount(0);
await expect(page.locator('[data-test-try-again]')).toBeVisible();
});
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/crate-dependencies-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module('Acceptance | crate dependencies page', function (hooks) {
await visit('/crates/foo/1.0.0/dependencies');
assert.strictEqual(currentURL(), '/crates/foo/1.0.0/dependencies');
assert.dom('[data-test-404-page]').exists();
assert.dom('[data-test-title]').hasText('foo: Crate not found');
assert.dom('[data-test-title]').hasText(`'foo': Crate not found`);
assert.dom('[data-test-go-back]').exists();
assert.dom('[data-test-try-again]').doesNotExist();
});
Expand All @@ -57,7 +57,7 @@ module('Acceptance | crate dependencies page', function (hooks) {
await visit('/crates/foo/1.0.0/dependencies');
assert.strictEqual(currentURL(), '/crates/foo/1.0.0/dependencies');
assert.dom('[data-test-404-page]').exists();
assert.dom('[data-test-title]').hasText('foo: Failed to load crate data');
assert.dom('[data-test-title]').hasText(`'foo': Failed to load crate data`);
assert.dom('[data-test-go-back]').doesNotExist();
assert.dom('[data-test-try-again]').exists();
});
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/crate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module('Acceptance | crate page', function (hooks) {
await visit('/crates/nanomsg');
assert.strictEqual(currentURL(), '/crates/nanomsg');
assert.dom('[data-test-404-page]').exists();
assert.dom('[data-test-title]').hasText('nanomsg: Crate not found');
assert.dom('[data-test-title]').hasText(`'nanomsg': Crate not found`);
assert.dom('[data-test-go-back]').exists();
assert.dom('[data-test-try-again]').doesNotExist();
});
Expand All @@ -98,7 +98,7 @@ module('Acceptance | crate page', function (hooks) {
await visit('/crates/nanomsg');
assert.strictEqual(currentURL(), '/crates/nanomsg');
assert.dom('[data-test-404-page]').exists();
assert.dom('[data-test-title]').hasText('nanomsg: Failed to load crate data');
assert.dom('[data-test-title]').hasText(`'nanomsg': Failed to load crate data`);
assert.dom('[data-test-go-back]').doesNotExist();
assert.dom('[data-test-try-again]').exists();
});
Expand Down
4 changes: 2 additions & 2 deletions tests/routes/crate/range-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module('Route | crate.range', function (hooks) {
await visit('/crates/foo/range/^3');
assert.strictEqual(currentURL(), '/crates/foo/range/%5E3');
assert.dom('[data-test-404-page]').exists();
assert.dom('[data-test-title]').hasText('foo: Crate not found');
assert.dom('[data-test-title]').hasText(`'foo': Crate not found`);
assert.dom('[data-test-go-back]').exists();
assert.dom('[data-test-try-again]').doesNotExist();
});
Expand All @@ -96,7 +96,7 @@ module('Route | crate.range', function (hooks) {
await visit('/crates/foo/range/^3');
assert.strictEqual(currentURL(), '/crates/foo/range/%5E3');
assert.dom('[data-test-404-page]').exists();
assert.dom('[data-test-title]').hasText('foo: Failed to load crate data');
assert.dom('[data-test-title]').hasText(`'foo': Failed to load crate data`);
assert.dom('[data-test-go-back]').doesNotExist();
assert.dom('[data-test-try-again]').exists();
});
Expand Down
Loading