Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
&.disabled {
cursor: not-allowed;
pointer-events: none;
// Added background-color to match design system standards for disabled inputs
background-color: #{$input-colors-disabled-background-color} !important;
}
}

Expand Down Expand Up @@ -80,6 +82,8 @@
&:disabled,
&.disabled {
color: #{$disabled-color};
// Ensures textareas and inputs get the disabled background color
background-color: #{$input-colors-disabled-background-color};
}
}

Expand Down Expand Up @@ -248,6 +252,7 @@
&:disabled,
&.disabled {
cursor: not-allowed;
background-color: #{$input-colors-disabled-background-color};
}

@include with-icon-addon-colors(
Expand Down Expand Up @@ -311,4 +316,4 @@

@include typography.use-font-scale(p2m);
@include typography.use-text-ellipsis;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
import { render } from '../../testing';
import { render, screen } from '../../testing';

import TextAreaInput from './TextAreaInput';

describe('[TextAreaInput]', () => {
it('renders without crashing', () => {
render(<TextAreaInput />);
});
});
it('renders without crashing', () => {
render(<TextAreaInput />);
});

it('should have the disabled attribute when the disabled prop is true', () => {
render(<TextAreaInput disabled />);

const textArea = screen.getByRole('textbox');

expect(textArea).toBeDisabled();
expect(textArea).toHaveAttribute('disabled');
});

it('should be read-only when the readOnly prop is true', () => {
render(<TextAreaInput readOnly />);

const textArea = screen.getByRole('textbox');

// Note: readOnly elements are NOT 'disabled', but they are 'readOnly'
expect(textArea).not.toBeDisabled();
expect(textArea).toHaveAttribute('readonly');
});

it('should render an addon when provided', () => {
render(<TextAreaInput addon={<span data-testid='addon'>icon</span>} />);

const addon = screen.getByTestId('addon');
expect(addon).toBeInTheDocument();
});
});