mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-11 17:56:37 +08:00
fix(waf): complete geography match options
Use full country and ISO subdivision data, show localized country names with codes, and add searchable region selection.
This commit is contained in:
@@ -52,7 +52,7 @@ it('creates any normalized valid geography code', async () => {
|
||||
const onChange = vi.fn();
|
||||
render(<NodeProperties node={node} ipGroups={[]} onChange={onChange} />);
|
||||
fireEvent.click(screen.getByRole('button', { name: '国家代码' }));
|
||||
fireEvent.change(await screen.findByPlaceholderText('输入代码并添加'), {
|
||||
fireEvent.change(await screen.findByPlaceholderText('搜索名称或代码'), {
|
||||
target: { value: 'nz' },
|
||||
});
|
||||
fireEvent.click(screen.getByRole('button', { name: '添加代码' }));
|
||||
@@ -62,3 +62,17 @@ it('creates any normalized valid geography code', async () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('shows localized country names together with their codes', async () => {
|
||||
const node: WAFRuleNode = {
|
||||
id: 'geo',
|
||||
type: 'geo_match',
|
||||
position: { x: 0, y: 0 },
|
||||
config: { countries: [], regions: [] },
|
||||
};
|
||||
render(<NodeProperties node={node} ipGroups={[]} onChange={vi.fn()} />);
|
||||
fireEvent.click(screen.getByRole('button', { name: '国家代码' }));
|
||||
expect(await screen.findByText('中国')).toBeInTheDocument();
|
||||
expect(screen.getByText('CN')).toBeInTheDocument();
|
||||
expect(screen.getByText(/共 249 个国家\/地区/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user