Change header visibility in left pane

This commit is contained in:
Fedor Indutny 2025-01-31 14:06:01 -08:00 committed by GitHub
parent f657d1ba83
commit 53eb51a370
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 68 additions and 68 deletions

View file

@ -67,7 +67,7 @@ describe('LeftPaneInboxHelper', () => {
assert.strictEqual(helper.getRowCount(), 3);
});
it("returns the number of pinned conversations if that's all there is", () => {
it("returns the number of pinned conversations + 1 (for the header) if that's all there is", () => {
const helper = new LeftPaneInboxHelper({
...defaultProps,
pinnedConversations: [
@ -77,7 +77,7 @@ describe('LeftPaneInboxHelper', () => {
],
});
assert.strictEqual(helper.getRowCount(), 3);
assert.strictEqual(helper.getRowCount(), 3 + 1);
});
it('adds 2 rows for each header if there are pinned and non-pinned conversations,', () => {
@ -134,7 +134,7 @@ describe('LeftPaneInboxHelper', () => {
);
});
it("returns the pinned conversation's index if there are only pinned conversations", () => {
it("returns the pinned conversation's index + 1 (for the header) if there are only pinned conversations", () => {
const pinnedConversations = [
getDefaultConversation(),
getDefaultConversation(),
@ -146,11 +146,11 @@ describe('LeftPaneInboxHelper', () => {
assert.strictEqual(
helper.getRowIndexToScrollTo(pinnedConversations[0].id),
0
1
);
assert.strictEqual(
helper.getRowIndexToScrollTo(pinnedConversations[1].id),
1
2
);
});
@ -226,7 +226,7 @@ describe('LeftPaneInboxHelper', () => {
assert.isUndefined(helper.getRow(1));
});
it("returns pinned conversations if that's all there are", () => {
it("returns header and pinned conversations if that's all there are", () => {
const pinnedConversations = [
getDefaultConversation(),
getDefaultConversation(),
@ -237,18 +237,22 @@ describe('LeftPaneInboxHelper', () => {
pinnedConversations,
});
assert.deepEqual(helper.getRow(0), {
assert.deepEqual(
_testHeaderText(helper.getRow(0)),
'icu:LeftPane--pinned'
);
assert.deepEqual(helper.getRow(1), {
type: RowType.Conversation,
conversation: pinnedConversations[0],
});
assert.deepEqual(helper.getRow(1), {
assert.deepEqual(helper.getRow(2), {
type: RowType.Conversation,
conversation: pinnedConversations[1],
});
assert.isUndefined(helper.getRow(2));
assert.isUndefined(helper.getRow(3));
});
it('returns pinned conversations and an archive button if there are no non-pinned conversations', () => {
it('returns header, pinned conversations and an archive button if there are no non-pinned conversations', () => {
const pinnedConversations = [
getDefaultConversation(),
getDefaultConversation(),
@ -260,19 +264,23 @@ describe('LeftPaneInboxHelper', () => {
archivedConversations: [getDefaultConversation()],
});
assert.deepEqual(helper.getRow(0), {
assert.deepEqual(
_testHeaderText(helper.getRow(0)),
'icu:LeftPane--pinned'
);
assert.deepEqual(helper.getRow(1), {
type: RowType.Conversation,
conversation: pinnedConversations[0],
});
assert.deepEqual(helper.getRow(1), {
assert.deepEqual(helper.getRow(2), {
type: RowType.Conversation,
conversation: pinnedConversations[1],
});
assert.deepEqual(helper.getRow(2), {
assert.deepEqual(helper.getRow(3), {
type: RowType.ArchiveButton,
archivedConversationsCount: 1,
});
assert.isUndefined(helper.getRow(3));
assert.isUndefined(helper.getRow(4));
});
it("returns non-pinned conversations if that's all there are", () => {