chore: include child nodes when parsing snapshot (#34318)
This commit is contained in:
parent
fe96104ce2
commit
ad365c3bc3
|
@ -180,8 +180,9 @@ export function parseAriaSnapshot(yaml: YamlLibrary, text: string, options: yaml
|
||||||
|
|
||||||
// - role "name":
|
// - role "name":
|
||||||
// - child
|
// - child
|
||||||
const valueIsSequence = value instanceof yaml.YAMLSeq ;
|
const valueIsSequence = value instanceof yaml.YAMLSeq;
|
||||||
if (valueIsSequence) {
|
if (valueIsSequence) {
|
||||||
|
container.children.push(childNode);
|
||||||
convertSeq(childNode, value as yamlTypes.YAMLSeq);
|
convertSeq(childNode, value as yamlTypes.YAMLSeq);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ export const InspectorTab: React.FunctionComponent<{
|
||||||
<div style={{ margin: '0 10px 10px', flex: 'auto' }}>
|
<div style={{ margin: '0 10px 10px', flex: 'auto' }}>
|
||||||
<CodeMirrorWrapper
|
<CodeMirrorWrapper
|
||||||
text={highlightedElement.ariaSnapshot || ''}
|
text={highlightedElement.ariaSnapshot || ''}
|
||||||
|
language='yaml'
|
||||||
wrapLines={false}
|
wrapLines={false}
|
||||||
highlight={ariaSnapshotErrors}
|
highlight={ariaSnapshotErrors}
|
||||||
onChange={onAriaEditorChange} />
|
onChange={onAriaEditorChange} />
|
||||||
|
|
|
@ -670,3 +670,15 @@ test('should not unshift actual template text', async ({ page }) => {
|
||||||
- heading "title" [level=1]
|
- heading "title" [level=1]
|
||||||
- heading "title 2" [level=1]`);
|
- heading "title 2" [level=1]`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should not match what is not matched', async ({ page }) => {
|
||||||
|
await page.setContent(`<p>Text</p>`);
|
||||||
|
const error = await expect(page.locator('body')).toMatchAriaSnapshot(`
|
||||||
|
- paragraph:
|
||||||
|
- button "bogus"
|
||||||
|
`).catch(e => e);
|
||||||
|
expect(stripAnsi(error.message)).toContain(`
|
||||||
|
- - paragraph:
|
||||||
|
- - button "bogus"
|
||||||
|
+ - paragraph: Text`);
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue