mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
chore(ci): change fe test based on node 20 (#5657)
* chore(ci): change fe test based on node 20 * chore(ci): change setup-node to v4 * fix(client): fix test case * fix(client): fix test case
This commit is contained in:
parent
97358707f9
commit
60225a11c5
4
.github/workflows/nocobase-test-frontend.yml
vendored
4
.github/workflows/nocobase-test-frontend.yml
vendored
@ -33,14 +33,14 @@ jobs:
|
|||||||
frontend-test:
|
frontend-test:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node_version: ['18']
|
node_version: ['20']
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: node:${{ matrix.node_version }}
|
container: node:${{ matrix.node_version }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node_version }}
|
- name: Use Node.js ${{ matrix.node_version }}
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node_version }}
|
node-version: ${{ matrix.node_version }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
@ -12,6 +12,7 @@ import React from 'react';
|
|||||||
import App1 from '../demos/input';
|
import App1 from '../demos/input';
|
||||||
import App2 from '../demos/textarea';
|
import App2 from '../demos/textarea';
|
||||||
import App3 from '../demos/url';
|
import App3 from '../demos/url';
|
||||||
|
import App4 from '../demos/json';
|
||||||
import JSON5 from 'json5';
|
import JSON5 from 'json5';
|
||||||
import JSONInput from '../demos/new-demos/json';
|
import JSONInput from '../demos/new-demos/json';
|
||||||
import JSON5Input from '../demos/new-demos/json5';
|
import JSON5Input from '../demos/new-demos/json5';
|
||||||
@ -131,18 +132,13 @@ describe('Input.JSON', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should display the error when the value is invalid', async () => {
|
it('should display the error when the value is invalid', async () => {
|
||||||
const { container } = render(<JSONInput />);
|
const { container } = render(<App4 />);
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(screen.getByText('Test').innerHTML).toBe('Test');
|
|
||||||
});
|
|
||||||
|
|
||||||
const textarea = container.querySelector('textarea') as HTMLTextAreaElement;
|
const textarea = container.querySelector('textarea') as HTMLTextAreaElement;
|
||||||
await userEvent.clear(textarea);
|
fireEvent.change(textarea, { target: { value: '{"name":nocobase}' } });
|
||||||
// To escape special characters, use double curly braces
|
fireEvent.blur(textarea, { target: { value: '{"name":nocobase}' } });
|
||||||
await userEvent.type(textarea, '{{name:"nocobase"}');
|
expect(screen.getByText(/Unexpected token/)).toBeInTheDocument();
|
||||||
// mock blur event
|
});
|
||||||
await userEvent.click(document.body);
|
|
||||||
expect(screen.getByText(/Unexpected token n/)).toBeInTheDocument();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not display error when the value is valid JSON5', async () => {
|
it('should not display error when the value is valid JSON5', async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user