-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into multichoice
- Loading branch information
Showing
13 changed files
with
406 additions
and
4 deletions.
There are no files selected for viewing
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,31 @@ | ||
name: Node.js Build and Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '21' | ||
|
||
- name: Install Dependencies | ||
run: npm install | ||
|
||
- name: Test | ||
run: npm run citest | ||
|
||
- name: Build | ||
run: npm run build |
File renamed without changes.
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,49 @@ | ||
import React from 'react'; | ||
import { test, describe, it, expect, vi, beforeEach } from 'vitest'; | ||
import { render, fireEvent, cleanup } from '@testing-library/react'; | ||
import { ActionDialogsContext } from 'react-dialog-mui'; | ||
import { AlertExample } from './AlertExample'; | ||
import { ChoiceExample } from './ChoiceExample'; | ||
import { ConfirmExample } from './ConfirmExample'; | ||
import { | ||
ModalExample, | ||
ModalExampleWithChildComponent, | ||
ModalExampleWithFormSubmit, | ||
ModalExampleWithManualDismiss, | ||
} from './ModalExample'; | ||
import { PromptExample } from './PromptExample'; | ||
|
||
// Replace the original Dialog with the mock component | ||
vi.mock('@mui/material', async (importOriginal) => { | ||
const mod = await importOriginal<typeof import('@mui/material')>(); | ||
return { | ||
...mod, | ||
Dialog: (props) => { | ||
return <div>{props.children}</div>; | ||
}, | ||
}; | ||
}); | ||
|
||
it('AlertExample should render the component', async () => { | ||
const component = render( | ||
<ActionDialogsContext> | ||
<AlertExample /> | ||
</ActionDialogsContext>, | ||
); | ||
const button = component.container.querySelector('button'); | ||
expect(button?.innerHTML).toMatchInlineSnapshot(`"My Action"`); | ||
|
||
// open modal and test content | ||
fireEvent.click(button); | ||
expect( | ||
component.container.querySelector('.MuiDialogTitle-root')?.textContent, | ||
).toMatchInlineSnapshot(`"Query Result"`); | ||
expect( | ||
component.container.querySelector('.MuiDialogContent-root')?.textContent, | ||
).toMatchInlineSnapshot( | ||
`"The query has successfully executed, yielding 200 records in 15 seconds."`, | ||
); | ||
expect( | ||
component.container.querySelector('.MuiDialogActions-root')?.textContent, | ||
).toMatchInlineSnapshot(`"Acknowledge"`); | ||
}); |
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,46 @@ | ||
import React from 'react'; | ||
import { test, describe, it, expect, vi, beforeEach } from 'vitest'; | ||
import { render, fireEvent, cleanup } from '@testing-library/react'; | ||
import { ActionDialogsContext } from 'react-dialog-mui'; | ||
import { AlertExample } from './AlertExample'; | ||
import { ChoiceExample } from './ChoiceExample'; | ||
import { ConfirmExample } from './ConfirmExample'; | ||
import { | ||
ModalExample, | ||
ModalExampleWithChildComponent, | ||
ModalExampleWithFormSubmit, | ||
ModalExampleWithManualDismiss, | ||
} from './ModalExample'; | ||
import { PromptExample } from './PromptExample'; | ||
|
||
// Replace the original Dialog with the mock component | ||
vi.mock('@mui/material', async (importOriginal) => { | ||
const mod = await importOriginal<typeof import('@mui/material')>(); | ||
return { | ||
...mod, | ||
Dialog: (props) => { | ||
return <div>{props.children}</div>; | ||
}, | ||
}; | ||
}); | ||
|
||
it('ChoiceExample should render the component', async () => { | ||
const component = render( | ||
<ActionDialogsContext> | ||
<ChoiceExample /> | ||
</ActionDialogsContext>, | ||
); | ||
const button = component.container.querySelector('button'); | ||
expect(button?.innerHTML).toMatchInlineSnapshot(`"Switch Session"`); | ||
|
||
// open modal and test content | ||
fireEvent.click(button); | ||
expect( | ||
component.container.querySelector('.MuiDialogTitle-root')?.textContent, | ||
).toMatchInlineSnapshot(`"Switch session"`); | ||
expect( | ||
component.container.querySelector('.MuiDialogContent-root')?.textContent, | ||
).toMatchInlineSnapshot( | ||
`"Select one of the following sessions:Session 1Session 2Session 3Session 4Apply"`, | ||
); | ||
}); |
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,44 @@ | ||
import React from 'react'; | ||
import { test, describe, it, expect, vi, beforeEach } from 'vitest'; | ||
import { render, fireEvent, cleanup } from '@testing-library/react'; | ||
import { ActionDialogsContext } from 'react-dialog-mui'; | ||
import { AlertExample } from './AlertExample'; | ||
import { ChoiceExample } from './ChoiceExample'; | ||
import { ConfirmExample } from './ConfirmExample'; | ||
import { | ||
ModalExample, | ||
ModalExampleWithChildComponent, | ||
ModalExampleWithFormSubmit, | ||
ModalExampleWithManualDismiss, | ||
} from './ModalExample'; | ||
import { PromptExample } from './PromptExample'; | ||
|
||
// Replace the original Dialog with the mock component | ||
vi.mock('@mui/material', async (importOriginal) => { | ||
const mod = await importOriginal<typeof import('@mui/material')>(); | ||
return { | ||
...mod, | ||
Dialog: (props) => { | ||
return <div>{props.children}</div>; | ||
}, | ||
}; | ||
}); | ||
|
||
it('ConfirmExample should render the component', async () => { | ||
const component = render( | ||
<ActionDialogsContext> | ||
<ConfirmExample /> | ||
</ActionDialogsContext>, | ||
); | ||
const button = component.container.querySelector('button'); | ||
expect(button?.innerHTML).toMatchInlineSnapshot(`"Delete Query?"`); | ||
|
||
// open modal and test content | ||
fireEvent.click(button); | ||
expect( | ||
component.container.querySelector('.MuiDialogTitle-root')?.textContent, | ||
).toMatchInlineSnapshot(`"Confirmation?"`); | ||
expect( | ||
component.container.querySelector('.MuiDialogContent-root')?.textContent, | ||
).toMatchInlineSnapshot(`"Do you want to delete this query?"`); | ||
Check failure on line 43 in src/stories/ConfirmExample.test.tsx GitHub Actions / buildsrc/stories/ConfirmExample.test.tsx > ConfirmExample should render the component
|
||
}); |
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,46 @@ | ||
import React from 'react'; | ||
import { test, describe, it, expect, vi, beforeEach } from 'vitest'; | ||
import { render, fireEvent, cleanup } from '@testing-library/react'; | ||
import { ActionDialogsContext } from 'react-dialog-mui'; | ||
import { ModalExample } from './ModalExample'; | ||
import { ChoiceExample } from './ChoiceExample'; | ||
import { ConfirmExample } from './ConfirmExample'; | ||
import { | ||
ModalExample, | ||
ModalExampleWithChildComponent, | ||
ModalExampleWithFormSubmit, | ||
ModalExampleWithManualDismiss, | ||
} from './ModalExample'; | ||
import { PromptExample } from './PromptExample'; | ||
|
||
// Replace the original Dialog with the mock component | ||
vi.mock('@mui/material', async (importOriginal) => { | ||
const mod = await importOriginal<typeof import('@mui/material')>(); | ||
return { | ||
...mod, | ||
Dialog: (props) => { | ||
return <div>{props.children}</div>; | ||
}, | ||
}; | ||
}); | ||
|
||
it('ModalExample should render the component', async () => { | ||
const component = render( | ||
<ActionDialogsContext> | ||
<ModalExample /> | ||
</ActionDialogsContext>, | ||
); | ||
const button = component.container.querySelector('button'); | ||
expect(button?.innerHTML).toMatchInlineSnapshot(`"Show Details"`); | ||
|
||
// open modal and test content | ||
fireEvent.click(button); | ||
expect( | ||
component.container.querySelector('.MuiDialogTitle-root')?.textContent, | ||
).toMatchInlineSnapshot(`"Query Details"`); | ||
expect( | ||
component.container | ||
.querySelector('.MuiDialogContent-root') | ||
?.textContent.includes(`Name: Sample Mocked QueryStatus: PendingCreated Date:`), | ||
).toBe(true); | ||
}); |
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,47 @@ | ||
import React from 'react'; | ||
import { test, describe, it, expect, vi, beforeEach } from 'vitest'; | ||
import { render, fireEvent, cleanup } from '@testing-library/react'; | ||
import { ActionDialogsContext } from 'react-dialog-mui'; | ||
import { AlertExample } from './AlertExample'; | ||
import { ChoiceExample } from './ChoiceExample'; | ||
import { ConfirmExample } from './ConfirmExample'; | ||
import { | ||
ModalExample, | ||
ModalExampleWithChildComponent, | ||
ModalExampleWithFormSubmit, | ||
ModalExampleWithManualDismiss, | ||
} from './ModalExample'; | ||
import { PromptExample } from './PromptExample'; | ||
|
||
// Replace the original Dialog with the mock component | ||
vi.mock('@mui/material', async (importOriginal) => { | ||
const mod = await importOriginal<typeof import('@mui/material')>(); | ||
return { | ||
...mod, | ||
Dialog: (props) => { | ||
return <div>{props.children}</div>; | ||
}, | ||
}; | ||
}); | ||
|
||
it('PromptExample should render the component', async () => { | ||
const component = render( | ||
<ActionDialogsContext> | ||
<PromptExample /> | ||
</ActionDialogsContext>, | ||
); | ||
const button = component.container.querySelector('button'); | ||
expect(button?.innerHTML).toMatchInlineSnapshot(`"Rename Query?"`); | ||
|
||
// open modal and test content | ||
fireEvent.click(button); | ||
expect( | ||
component.container.querySelector('.MuiDialogTitle-root')?.textContent, | ||
).toMatchInlineSnapshot(`"Rename Query"`); | ||
expect( | ||
component.container.querySelector('.MuiDialogContent-root')?.textContent, | ||
).toMatchInlineSnapshot(`"New Query NameNew Query Name"`); | ||
expect( | ||
component.container.querySelector('.MuiDialogActions-root')?.textContent, | ||
).toMatchInlineSnapshot(`"Save"`); | ||
}); |
Oops, something went wrong.