Get the outermost wrapper test-utils of VUEjs
P粉809110129
P粉809110129 2023-09-14 10:53:30
0
1
405

I'm writing a test for VueJS and I want to access the outermost layer of HTML. However, no matter what method I use, the outermost layer is always ignored. Anyway, I can access this outermost layer and do something with it (e.g. outermostLayer.removeAttribute('key'))

const originalHTML = '<main key="outermost-layer"><main>content</main></main>';     
const component = {
    template: originalHTML
};
const wrapper = mount(component);
await flushPromises();
console.log(wrapper.element.querySelector('main')); // only return the inner main       
console.log(wrapper.element.getElementsByTagName('main')); //only the inner one

P粉809110129
P粉809110129

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!