From f5e768196c057f2eadf6a9d1e51e2229186890c5 Mon Sep 17 00:00:00 2001 From: Katarina Golbang Date: Fri, 4 Nov 2022 15:42:03 +0100 Subject: [PATCH] #1815 put removable patterns (__ngContext__) into a list --- src/serializers/ng-snapshot.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/serializers/ng-snapshot.ts b/src/serializers/ng-snapshot.ts index 6e29569588..18d3eb0b86 100644 --- a/src/serializers/ng-snapshot.ts +++ b/src/serializers/ng-snapshot.ts @@ -38,6 +38,7 @@ interface PluginOptions { type Indent = (indentSpaces: string) => string; type Printer = (elementToSerialize: unknown) => string; +const attributesToRemovePatterns = ['__ngContext']; const ivyEnabled = (): boolean => { // Should be required lazily, since it will throw an exception // `Cannot resolve parameters...`. @@ -66,7 +67,7 @@ const print = (fixture: unknown, print: Printer, indent: Indent, opts: PluginOpt .map((node: VEDebugNode) => Array.from(node.renderElement.childNodes).map(print).join('')) .join(opts.edgeSpacing); } - const attributes = Object.keys(componentInstance).filter((key) => key !== '__ngContext__'); + const attributes = Object.keys(componentInstance).filter((key) => !attributesToRemovePatterns.includes(key)); if (attributes.length) { componentAttrs += attributes .sort()