-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dashboard-editor' of github.com:carbon-design-system/ca…
…rbon-addons-iot-react into breakpoint-switcher
- Loading branch information
Showing
106 changed files
with
19,628 additions
and
5,309 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,4 @@ package-lock.json | |
.npmrc | ||
results | ||
|
||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# .kodiak.toml | ||
version = 1 | ||
|
||
[merge] | ||
automerge_label = "status: ready to merge 🎉" | ||
method = "merge" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from 'react'; | ||
import { render, screen, waitFor } from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
|
||
import CardCodeEditor from './CardCodeEditor'; | ||
import { isValidCallback } from './CardCodeEditor.story'; | ||
|
||
describe('CardEditor', () => { | ||
it('should show error notification editor value is invalid', async () => { | ||
const handleOnCopy = jest.fn(); | ||
const { container } = render( | ||
<CardCodeEditor | ||
onSubmit={isValidCallback} | ||
onCopy={handleOnCopy} | ||
initialValue="/* write your code here */" | ||
onClose={() => {}} | ||
/> | ||
); | ||
const save = screen.queryByText('Save'); | ||
userEvent.click(save); | ||
await waitFor(() => expect(screen.queryByRole('alert')).toBeTruthy()); | ||
userEvent.click(container.querySelector('.bx--inline-notification__close-button')); | ||
await waitFor(() => expect(screen.queryByRole('alert')).toBeFalsy()); | ||
}); | ||
|
||
it('should expand when expand icon is clicked', async () => { | ||
const handleOnCopy = jest.fn(); | ||
const { container } = render( | ||
<CardCodeEditor | ||
onSubmit={isValidCallback} | ||
onCopy={handleOnCopy} | ||
initialValue="/* write your code here */" | ||
onClose={() => {}} | ||
/> | ||
); | ||
const expand = screen.queryByText('Expand'); | ||
userEvent.click(expand); | ||
await waitFor(() => | ||
expect(container.querySelector('.iot--editor__expanded')).toBeInTheDocument() | ||
); | ||
}); | ||
|
||
it('should copy editor value when copy icon is clicked', async () => { | ||
const handleOnCopy = jest.fn(); | ||
const { container } = render( | ||
<CardCodeEditor | ||
onSubmit={isValidCallback} | ||
onCopy={handleOnCopy} | ||
initialValue="/* write your code here */" | ||
onClose={() => {}} | ||
/> | ||
); | ||
const copy = container.querySelector('.iot--editor-copy'); | ||
userEvent.click(copy); | ||
expect(handleOnCopy).toHaveBeenCalledWith('/* write your code here */'); | ||
}); | ||
}); |
Oops, something went wrong.