更新单测

This commit is contained in:
qinhaoyan 2024-10-28 14:08:55 +08:00
parent dc71457509
commit de02dc3bec

View File

@ -169,7 +169,7 @@ test('Renderer:anchorNav with horizontal', () => {
}); });
// 3.默认定位到某个区域 // 3.默认定位到某个区域
test('Renderer:anchorNav with active', async () => { test('Renderer:anchorNav with active by index', async () => {
const {container} = render( const {container} = render(
amisRender( amisRender(
{ {
@ -180,7 +180,27 @@ test('Renderer:anchorNav with active', async () => {
className: 'one', className: 'one',
active: 2, active: 2,
links: defaultLinks links: defaultLinks
}, }
]
},
{},
makeEnv({})
)
);
await wait(500);
expect(
container.querySelector('.one .cxd-AnchorNav-link.is-active')
).toHaveTextContent('兴趣爱好');
});
test('Renderer:anchorNav with active by href', async () => {
const {container} = render(
amisRender(
{
type: 'page',
body: [
{ {
type: 'anchor-nav', type: 'anchor-nav',
className: 'two', className: 'two',
@ -199,9 +219,8 @@ test('Renderer:anchorNav with active', async () => {
await wait(500); await wait(500);
expect( debugger;
container.querySelector('.one .cxd-AnchorNav-link.is-active')
).toHaveTextContent('兴趣爱好');
expect( expect(
container.querySelector('.two .cxd-AnchorNav-link.is-active') container.querySelector('.two .cxd-AnchorNav-link.is-active')
).toHaveTextContent('工作信息'); ).toHaveTextContent('工作信息');