Skip to content
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

chore(Forms): rename Visibility test descriptions #4538

Merged
merged 1 commit into from
Feb 6, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Field, Iterate } from '../../..'

describe('useVisibility', () => {
describe('visibility', () => {
it('renders children when visible is true', () => {
it('should return true when visible is true', () => {
const { result } = renderHook(() =>
useVisibility({
visible: true,
Expand All @@ -15,7 +15,7 @@ describe('useVisibility', () => {
expect(result.current.check()).toBe(true)
})

it('does not render children when visible is false', () => {
it('should return false when visible is false', () => {
const { result } = renderHook(() =>
useVisibility({
visible: false,
Expand All @@ -24,7 +24,7 @@ describe('useVisibility', () => {
expect(result.current.check()).toBe(false)
})

it('renders children when target path is falsy, but visible prop is true', () => {
it('should return true when target path is falsy, but visible prop is true', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -42,7 +42,7 @@ describe('useVisibility', () => {
})

describe('pathDefined', () => {
it('renders children when target path is defined', () => {
it('should return true when target path is defined', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -57,7 +57,7 @@ describe('useVisibility', () => {
expect(result.current.check()).toBe(true)
})

it('does not render children when target path is not defined', () => {
it('should return false when target path is not defined', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -74,7 +74,7 @@ describe('useVisibility', () => {
})

describe('pathUndefined', () => {
it('does not render children when target path is not defined', () => {
it('should return false when target path is not defined', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -89,7 +89,7 @@ describe('useVisibility', () => {
expect(result.current.check()).toBe(false)
})

it('renders children when target path is defined', () => {
it('should return true when target path is defined', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -106,7 +106,7 @@ describe('useVisibility', () => {
})

describe('pathTruthy', () => {
it('renders children when target path is truthy', () => {
it('should return true when target path is truthy', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -121,7 +121,7 @@ describe('useVisibility', () => {
expect(result.current.check()).toBe(true)
})

it('does not render children when target path is not truthy', () => {
it('should return false when target path is not truthy', () => {
const { result } = renderHook(useVisibility, {
wrapper: ({ children }) => (
<Provider data={{ isFalsy: null }}>{children}</Provider>
Expand All @@ -134,7 +134,7 @@ describe('useVisibility', () => {
).toBe(false)
})

it('does not render children when target path is not defined', () => {
it('should return false when target path is not defined', () => {
const { result } = renderHook(useVisibility, {
wrapper: ({ children }) => (
<Provider data={{ isFalse: false }}>{children}</Provider>
Expand All @@ -149,7 +149,7 @@ describe('useVisibility', () => {
})

describe('pathFalsy', () => {
it('renders children when target path is falsy', () => {
it('should return true when target path is falsy', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -164,7 +164,7 @@ describe('useVisibility', () => {
expect(result.current.check()).toBe(true)
})

it('renders children when target path is not defined', () => {
it('should return true when target path is not defined', () => {
const { result } = renderHook(useVisibility, {
wrapper: ({ children }) => (
<Provider data={{ isFalse: false }}>{children}</Provider>
Expand All @@ -177,7 +177,7 @@ describe('useVisibility', () => {
).toBe(true)
})

it('does not render children when target path is not falsy', () => {
it('should return false when target path is not falsy', () => {
const { result } = renderHook(useVisibility, {
wrapper: ({ children }) => (
<Provider data={{ isTruthy: 'value' }}>{children}</Provider>
Expand All @@ -192,7 +192,7 @@ describe('useVisibility', () => {
})

describe('visibleWhen', () => {
it('should render children when hasValue matches', () => {
it('should return true when hasValue matches', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -210,7 +210,7 @@ describe('useVisibility', () => {
expect(result.current.check()).toBe(true)
})

it('should not render children when hasValue does not match', () => {
it('should return false when hasValue does not match', () => {
const { result } = renderHook(useVisibility, {
wrapper: ({ children }) => (
<Provider data={{ myPath: 'foo' }}>{children}</Provider>
Expand All @@ -226,7 +226,7 @@ describe('useVisibility', () => {
).toBe(false)
})

it('should not render children when path does not match', () => {
it('should return false when path does not match', () => {
const { result } = renderHook(useVisibility, {
wrapper: ({ children }) => (
<Provider data={{ myPath: 'foo' }}>{children}</Provider>
Expand All @@ -242,7 +242,7 @@ describe('useVisibility', () => {
).toBe(false)
})

it('should render children when withValue matches', () => {
it('should return true when withValue matches', () => {
const log = jest.spyOn(console, 'warn').mockImplementation()

const { result } = renderHook(
Expand All @@ -264,7 +264,7 @@ describe('useVisibility', () => {
log.mockRestore()
})

it('should not render children when withValue does not match', () => {
it('should return false when withValue does not match', () => {
const log = jest.spyOn(console, 'warn').mockImplementation()

const { result } = renderHook(useVisibility, {
Expand Down Expand Up @@ -476,7 +476,7 @@ describe('useVisibility', () => {
})

describe('visibleWhenNot', () => {
it('should render children when hasValue matches', () => {
it('should return true when hasValue matches', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -494,7 +494,7 @@ describe('useVisibility', () => {
expect(result.current.check()).toBe(false)
})

it('should not render children when hasValue does not match', () => {
it('should return false when hasValue does not match', () => {
const { result } = renderHook(useVisibility, {
wrapper: ({ children }) => (
<Provider data={{ myPath: 'foo' }}>{children}</Provider>
Expand Down Expand Up @@ -613,7 +613,7 @@ describe('useVisibility', () => {

describe('withinIterate', () => {
describe('visibility', () => {
it('renders children when target path is falsy, but visible prop is true', () => {
it('should return true when target path is falsy, but visible prop is true', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -636,7 +636,7 @@ describe('useVisibility', () => {
})

describe('pathDefined', () => {
it('renders children when target path is defined', () => {
it('should return true when target path is defined', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -658,7 +658,7 @@ describe('useVisibility', () => {
expect(result.current.check()).toBe(true)
})

it('does not render children when target path is not defined', () => {
it('should return false when target path is not defined', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -682,7 +682,7 @@ describe('useVisibility', () => {
})

describe('pathUndefined', () => {
it('does not render children when target path is not defined', () => {
it('should return false when target path is not defined', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -704,7 +704,7 @@ describe('useVisibility', () => {
expect(result.current.check()).toBe(false)
})

it('renders children when target path is defined', () => {
it('should return true when target path is defined', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -728,7 +728,7 @@ describe('useVisibility', () => {
})

describe('pathTruthy', () => {
it('renders children when target path is truthy', () => {
it('should return true when target path is truthy', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -746,7 +746,7 @@ describe('useVisibility', () => {
expect(result.current.check()).toBe(true)
})

it('does not render children when target path is not truthy', () => {
it('should return false when target path is not truthy', () => {
const { result } = renderHook(useVisibility, {
wrapper: ({ children }) => (
<Provider
Expand All @@ -765,7 +765,7 @@ describe('useVisibility', () => {
).toBe(false)
})

it('does not render children when target path is not defined', () => {
it('should return false when target path is not defined', () => {
const { result } = renderHook(useVisibility, {
wrapper: ({ children }) => (
<Provider
Expand All @@ -789,7 +789,7 @@ describe('useVisibility', () => {
})

describe('pathFalsy', () => {
it('renders children when target path is falsy', () => {
it('should return true when target path is falsy', () => {
const { result } = renderHook(
() =>
useVisibility({
Expand All @@ -813,7 +813,7 @@ describe('useVisibility', () => {
expect(result.current.check()).toBe(true)
})

it('renders children when target path is not defined', () => {
it('should return true when target path is not defined', () => {
const { result } = renderHook(useVisibility, {
wrapper: ({ children }) => (
<Provider data={{ myList: [{ isFalse: false }] }}>
Expand All @@ -831,7 +831,7 @@ describe('useVisibility', () => {
).toBe(true)
})

it('does not render children when target path is not falsy', () => {
it('should return false when target path is not falsy', () => {
const { result } = renderHook(useVisibility, {
wrapper: ({ children }) => (
<Provider data={{ myList: [{ isTruthy: 'value' }] }}>
Expand Down
Loading