Skip to content

Commit

Permalink
fix(serializers): remove __ngContext__ from snapshots (#1816)
Browse files Browse the repository at this point in the history
  • Loading branch information
jepetko authored and anh.pham committed Jan 26, 2023
1 parent 7ece1b2 commit 6997b0b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

exports[`snapshot should work 1`] = `
<foo
__ngContext__="0"
condition1={[Function Boolean]}
condition2="false"
value1={[Function String]}
Expand Down
3 changes: 2 additions & 1 deletion src/serializers/ng-snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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...`.
Expand Down Expand Up @@ -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);
const attributes = Object.keys(componentInstance).filter((key) => !attributesToRemovePatterns.includes(key));
if (attributes.length) {
componentAttrs += attributes
.sort()
Expand Down

0 comments on commit 6997b0b

Please sign in to comment.