Skip to content

Resolves issue 2143 #2155

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

Merged
merged 3 commits into from
Jan 25, 2020
Merged
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
2 changes: 1 addition & 1 deletion app/components/crate-list-newest.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ol>
{{#each @crates as |crate index|}}
<li>
<LinkTo @route="crate.version" @models={{array crate.id crate.newest_version}} class="name" data-test-crate-link={{index}}>
<LinkTo @route="crate" @model={{crate.id}} class="name" data-test-crate-link={{index}}>
<span>{{ crate.name }} ({{ crate.newest_version }})</span>
<div class='arrow-in-list'>
{{svg-jar "right-arrow"}}
Expand Down
10 changes: 9 additions & 1 deletion app/templates/crate/version.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,15 @@
{{#unless this.currentVersion.yanked}}
<div id='crate-downloads'>
<div class='stats'>
<h3>Stats Overview</h3>
{{#if this.downloadsContext.num}}
<h3 data-test-crate-stats-label>
Stats Overview for {{this.downloadsContext.num}}
<LinkTo @route="crate" @model={{this.crate}}>(see all)</LinkTo>
</h3>

{{else}}
<h3 data-test-crate-stats-label>Stats Overview</h3>
{{/if}}
<div class='stat'>
<span class='num'>
{{svg-jar "download"}}
Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/crate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module('Acceptance | crate page', function(hooks) {
await visit('/');
await click('[data-test-just-updated] [data-test-crate-link="0"]');

assert.equal(currentURL(), '/crates/nanomsg/0.6.1');
assert.equal(currentURL(), '/crates/nanomsg');
assert.equal(title(), 'nanomsg - crates.io: Rust Package Registry');

assert.dom('[data-test-heading] [data-test-crate-name]').hasText('nanomsg');
Expand All @@ -76,6 +76,7 @@ module('Acceptance | crate page', function(hooks) {

assert.dom('[data-test-heading] [data-test-crate-name]').hasText('nanomsg');
assert.dom('[data-test-heading] [data-test-crate-version]').hasText('0.6.1');
assert.dom('[data-test-crate-stats-label]').hasText('Stats Overview');
});

test('visiting /crates/nanomsg/', async function(assert) {
Expand All @@ -91,6 +92,7 @@ module('Acceptance | crate page', function(hooks) {

assert.dom('[data-test-heading] [data-test-crate-name]').hasText('nanomsg');
assert.dom('[data-test-heading] [data-test-crate-version]').hasText('0.6.1');
assert.dom('[data-test-crate-stats-label]').hasText('Stats Overview');
});

test('visiting /crates/nanomsg/0.6.0', async function(assert) {
Expand All @@ -106,6 +108,7 @@ module('Acceptance | crate page', function(hooks) {

assert.dom('[data-test-heading] [data-test-crate-name]').hasText('nanomsg');
assert.dom('[data-test-heading] [data-test-crate-version]').hasText('0.6.0');
assert.dom('[data-test-crate-stats-label]').hasText('Stats Overview for 0.6.0 (see all)');
});

test('navigating to the all versions page', async function(assert) {
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/front-page-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ module('Acceptance | front page', function(hooks) {
assert.dom('[data-test-total-crates]').hasText('23');

assert.dom('[data-test-new-crates] [data-test-crate-link="0"]').hasText('Inflector (0.1.6)');
assert.dom('[data-test-new-crates] [data-test-crate-link="0"]').hasAttribute('href', '/crates/Inflector/0.1.6');
assert.dom('[data-test-new-crates] [data-test-crate-link="0"]').hasAttribute('href', '/crates/Inflector');

assert.dom('[data-test-most-downloaded] [data-test-crate-link="0"]').hasText('serde');
assert.dom('[data-test-most-downloaded] [data-test-crate-link="0"]').hasAttribute('href', '/crates/serde');

assert.dom('[data-test-just-updated] [data-test-crate-link="0"]').hasText('nanomsg (0.6.1)');
assert.dom('[data-test-just-updated] [data-test-crate-link="0"]').hasAttribute('href', '/crates/nanomsg/0.6.1');
assert.dom('[data-test-just-updated] [data-test-crate-link="0"]').hasAttribute('href', '/crates/nanomsg');

percySnapshot(assert);
});
Expand Down