Compare commits

...

4 Commits

Author SHA1 Message Date
Joe Li
edde61fd29 Merge remote-tracking branch 'origin/master' into HEAD 2026-07-24 07:03:21 -07:00
suvankardas216
a1142b0f91 fix(dataset): disable duplicate button when name is empty (#42217)
Co-authored-by: AS-MAC-1123 <as-mac-1123@AS-MAC-1123.local>
Co-authored-by: Evan Rusackas <evan@rusackas.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-24 00:24:37 -07:00
Joe Li
9726c734ef Merge remote-tracking branch 'origin/master' into HEAD 2026-07-23 07:03:13 -07:00
Joe Li
fd95f94a18 chore: fix spacing in AGENTS.md 2026-07-22 12:41:47 -07:00
4 changed files with 35 additions and 3 deletions

View File

@@ -297,7 +297,7 @@ pre-commit run eslint # Frontend linting
## Platform-Specific Instructions
- **[CLAUDE.md](CLAUDE.md)** - For Claude/Anthropic tools
- **[.github/copilot-instructions.md](.github/copilot-instructions.md)** - For GitHub Copilot
- **[.github/copilot-instructions.md](.github/copilot-instructions.md)** - For GitHub Copilot
- **[GEMINI.md](GEMINI.md)** - For Google Gemini tools
- **[GPT.md](GPT.md)** - For OpenAI/ChatGPT tools
- **[.cursor/rules/dev-standard.mdc](.cursor/rules/dev-standard.mdc)** - For Cursor editor

View File

@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
under the License
-->
# Change Log

View File

@@ -106,6 +106,19 @@ test('modal opens when dataset is provided', async () => {
).toBeInTheDocument();
});
test('duplicate button is disabled when modal first opens', async () => {
const onHide = jest.fn();
const onDuplicate = jest.fn();
renderModal(mockDataset, onHide, onDuplicate);
const duplicateButton = await screen.findByRole('button', {
name: /duplicate/i,
});
expect(duplicateButton).toBeDisabled();
});
test('modal does not open when dataset is null', () => {
const onHide = jest.fn();
const onDuplicate = jest.fn();
@@ -194,6 +207,21 @@ test('pressing Enter key triggers duplicate action', async () => {
});
});
test('pressing Enter with empty input does not trigger duplicate action', async () => {
const onHide = jest.fn();
const onDuplicate = jest.fn();
renderModal(mockDataset, onHide, onDuplicate);
const input = await screen.findByTestId('duplicate-modal-input');
// Press Enter without typing a name
await userEvent.type(input, '{enter}');
// onPressEnter should not bypass the disabled state
expect(onDuplicate).not.toHaveBeenCalled();
});
test('modal closes when onHide is called', async () => {
const onHide = jest.fn();
const onDuplicate = jest.fn();

View File

@@ -34,7 +34,7 @@ const DuplicateDatasetModal: FunctionComponent<DuplicateDatasetModalProps> = ({
onDuplicate,
}) => {
const [show, setShow] = useState<boolean>(false);
const [disableSave, setDisableSave] = useState<boolean>(false);
const [disableSave, setDisableSave] = useState<boolean>(true);
const [newDuplicateDatasetName, setNewDuplicateDatasetName] =
useState<string>('');
@@ -45,11 +45,15 @@ const DuplicateDatasetModal: FunctionComponent<DuplicateDatasetModalProps> = ({
};
const duplicateDataset = () => {
if (disableSave) {
return;
}
onDuplicate(newDuplicateDatasetName);
};
useEffect(() => {
setNewDuplicateDatasetName('');
setDisableSave(true);
setShow(dataset !== null);
}, [dataset]);