| 37 | }); |
| 38 | |
| 39 | function match(children, i, ...texts) { |
| 40 | if (children.length < i + texts.length) { |
| 41 | return false; |
| 42 | } |
| 43 | |
| 44 | for (let t = 0; t < texts.length; t++, i++) { |
| 45 | let text = texts[t]; |
| 46 | let child = children[i]; |
| 47 | |
| 48 | if (child.type === 'element') { |
| 49 | if (child.children && child.children[0] && child.children[0].value !== text) { |
| 50 | return false; |
| 51 | } |
| 52 | } else if (child.type === 'text') { |
| 53 | if (child.value !== text) { |
| 54 | return false; |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | return true; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * This undoes the above wrapping for display purposes. |