Skip to content

lastest and master are not in version selector on second open #309

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 2 commits into from
Jan 29, 2019
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 addon/components/docs-header/version-selector/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default Component.extend({
return [
latest,
primary,
...versions.removeObjects([ latest, primary ]).sortBy('key')
...A(versions.reject(v => [ latest, primary ].includes(v))).sortBy('key')
].filter(Boolean);
}),

Expand Down
6 changes: 6 additions & 0 deletions tests/acceptance/version-selector-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ module('Acceptance | Version selector test', function(hooks) {

assert.dom('[data-test-id="version"]:nth-child(1)').includesText('Latest', 'latest is rendered first');
assert.dom('[data-test-id="version"]:nth-child(1)').includesText('v0.1.0', 'latest renders a tag if present');

await click('[data-test-id="current-version"]'); // close it
await click('[data-test-id="current-version"]'); // open a scond time

assert.dom('[data-test-id="version"]:nth-child(1)').includesText('Latest', 'latest is rendered on second open');
assert.dom('[data-test-id="version"]:nth-child(2)').includesText('master', 'master is rendered on second open');
});

module('with a custom primary branch configured', function(hooks) {
Expand Down