next.js
9a768d5e - test: refactor metadata tests to test multi matches easier (#46746)

Commit
2 years ago
test: refactor metadata tests to test multi matches easier (#46746) Use some utils to match multiple dom nodes together #### Match multiple props for single DOM node ```tsx const matchDom = createDomMatcher(browser) await matchDom('meta', 'name="description"', { content: 'description' }) ``` #### Match multiple same pattern DOM nodes in html ```tsx const $ = await next.render$('html') const matchHtml = createHtmlMatcher($) await matchHtml('meta', 'name', 'property', { description: 'description', og: 'og:description' }) ``` #### Match same pattern DOM nodes in browser after hydration ```tsx const matchMultiDom = createMultiDomMatcher(browser) await matchMultiDom('meta', 'property', 'content', { description: 'description', 'og:title': 'title', 'twitter:title': 'title' }) ```
Author
Parents
Loading