Skip to content
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
6 changes: 3 additions & 3 deletions src/sidebar/components/SidebarTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function SidebarTabs({
tabCountsSummaryPieces.push(`${noteCount} ${term}`);
}
if (orphanCount > 0) {
const term = pluralize(noteCount, 'orphan', 'orphans');
const term = pluralize(noteCount, 'unanchored', 'unanchored');
tabCountsSummaryPieces.push(`${orphanCount} ${term}`);
}
const tabCountsSummary = tabCountsSummaryPieces.join(', ');
Expand Down Expand Up @@ -180,11 +180,11 @@ function SidebarTabs({
count={orphanCount}
isWaitingToAnchor={isWaitingToAnchorAnnotations}
isSelected={selectedTab === 'orphan'}
label="Orphans"
label="Unanchored"
name="orphan"
onSelect={() => selectTab('orphan')}
>
Orphans
Unanchored
</Tab>
)}
</div>
Expand Down
31 changes: 14 additions & 17 deletions src/sidebar/components/test/SidebarTabs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,31 +162,28 @@ describe('SidebarTabs', () => {
});
});

describe('orphans tab', () => {
it('should display orphans tab if there is 1 or more orphans', () => {
describe('unanchored tab', () => {
it('should display unanchored tab if there is 1 or more orphans', () => {
stubTabCounts({ orphan: 1 });
const wrapper = createComponent();

const orphanTab = wrapper.find('Tab[label="Orphans"]');
assert.isTrue(orphanTab.exists());
const unanchoredTab = wrapper.find('Tab[label="Unanchored"]');
assert.isTrue(unanchoredTab.exists());
});

it('should display orphans tab as selected when it is active', () => {
it('should display unanchored tab as selected when it is active', () => {
fakeStore.selectedTab.returns('orphan');
stubTabCounts({ orphan: 1 });

const wrapper = createComponent();

const orphanTab = wrapper.find('Tab[label="Orphans"]');
assert.isTrue(orphanTab.find('LinkButton').prop('pressed'));
const unanchoredTab = wrapper.find('Tab[label="Unanchored"]');
assert.isTrue(unanchoredTab.find('LinkButton').prop('pressed'));
});

it('should not display orphans tab if there are 0 orphans', () => {
it('should not display unanchored tab if there are 0 orphans', () => {
const wrapper = createComponent();

const orphanTab = wrapper.find('Tab[label="Orphans"]');

assert.isFalse(orphanTab.exists());
assert.isFalse(wrapper.exists('Tab[label="Unanchored"]'));
});
});

Expand Down Expand Up @@ -257,12 +254,12 @@ describe('SidebarTabs', () => {
[
{ label: 'Annotations', tab: 'annotation' },
{ label: 'Page Notes', tab: 'note' },
{ label: 'Orphans', tab: 'orphan' },
{ label: 'Unanchored', tab: 'orphan' },
].forEach(({ label, tab }) => {
it(`should change the selected tab when "${label}" tab is clicked`, () => {
// Pre-select a different tab than the one we are about to click.
fakeStore.selectedTab.returns('other-tab');
// Make the "Orphans" tab appear.
// Make the "Unanchored" tab appear.
stubTabCounts({ orphan: 1 });

const wrapper = createComponent();
Expand Down Expand Up @@ -305,23 +302,23 @@ describe('SidebarTabs', () => {
note: 0,
orphan: 4,
},
message: '4 orphans',
message: '4 unanchored',
},
{
tabCounts: {
annotation: 2,
note: 3,
orphan: 4,
},
message: '2 annotations, 3 notes, 4 orphans',
message: '2 annotations, 3 notes, 4 unanchored',
},
{
tabCounts: {
annotation: 1,
note: 1,
orphan: 1,
},
message: '1 annotation, 1 note, 1 orphan',
message: '1 annotation, 1 note, 1 unanchored',
},
].forEach(({ tabCounts, message }) => {
it('reports annotation count to screen readers', () => {
Expand Down