Skip to content

Commit

Permalink
test: ✨ add snapshot test for Divider with custom title and width
Browse files Browse the repository at this point in the history
* Introduced a new test case for the `Divider` component to validate rendering with a custom title and width.
* Updated snapshot files to reflect the new test case.
  • Loading branch information
okineadev committed Dec 21, 2024
1 parent 23fd7c0 commit d4f3f3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/__snapshots__/divider.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ exports[`divider with custom width 1`] = `"\x1B[90m─────────

exports[`divider with custom padding 1`] = `" \x1B[90m────────────────────────────────────────────────────────────────────────────────────────────────\x1B[39m"`;

exports[`divider with custom title and width 1`] = `"\x1B[90m───────\x1B[39m \x1B[37mTitle\x1B[39m \x1B[90m──────\x1B[39m"`;

exports[`divider with title and custom titlePadding 1`] = `"\x1B[90m─────────────────────────────────────────────\x1B[39m \x1B[37mTitle\x1B[39m \x1B[90m────────────────────────────────────────────\x1B[39m"`;

exports[`divider with title and custom titleColor 1`] = `"\x1B[90m───────────────────────────────────────────────\x1B[39m \x1B[34mTitle\x1B[39m \x1B[90m──────────────────────────────────────────────\x1B[39m"`;
Expand All @@ -25,5 +27,3 @@ exports[`divider with custom dividerChar 1`] = `"\x1B[90m=======================
exports[`divider with custom dividerColor 1`] = `"\x1B[31m────────────────────────────────────────────────────────────────────────────────────────────────────\x1B[39m"`;

exports[`divider with all custom props 1`] = `" \x1B[33m******\x1B[39m \x1B[32mCustom Title\x1B[39m \x1B[33m******\x1B[39m"`;

exports[`divider with title and other box props (flexGrow, etc.) 1`] = `" \x1B[37mTitle\x1B[39m"`;
5 changes: 5 additions & 0 deletions tests/divider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ test('divider with custom padding', () => {
expect(lastFrame()).toMatchSnapshot()
})

test('divider with custom title and width', () => {
const { lastFrame } = render(<Divider title="Title" width={20} />)
expect(lastFrame()).toMatchSnapshot()
})

test('divider with title and custom titlePadding', () => {
const { lastFrame } = render(<Divider title="Title" titlePadding={3} />)
expect(lastFrame()).toMatchSnapshot()
Expand Down

0 comments on commit d4f3f3b

Please sign in to comment.