@@ -57,7 +57,29 @@ describe('Browser Builder allow svg', () => {
57
57
host . scopedSync ( ) . read ( join ( outputPath , 'main.js' ) ) ,
58
58
) ;
59
59
60
- expect ( content ) . toContain ( 'ɵɵnamespaceSVG' ) ;
60
+ // Extract the AppComponent template function.
61
+ // Example function:
62
+ // function AppComponent_Template(rf, ctx) {
63
+ // if (rf & 1) {
64
+ // _angular_core__WEBPACK_IMPORTED_MODULE_1__.ay();
65
+ // _angular_core__WEBPACK_IMPORTED_MODULE_0__.dZ(0, "svg", 0)(1, "text", 1);
66
+ // _angular_core__WEBPACK_IMPORTED_MODULE_0__.fH(2, "Hello World");
67
+ // _angular_core__WEBPACK_IMPORTED_MODULE_0__.dY()();
68
+ // }
69
+ // }
70
+
71
+ const templateFnMatch = content . match (
72
+ / f u n c t i o n A p p C o m p o n e n t _ T e m p l a t e \( r f , c t x \) \s * \{ [ \s \n ] * i f \( r f & 1 \) \{ \n ( [ \s \S ] + ?) \n [ ] * \} / ,
73
+ ) ;
74
+ expect ( templateFnMatch ) . toBeDefined ( ) ;
75
+ const [ , templateCreate ] = templateFnMatch ! ;
76
+
77
+ const createLines = templateCreate . split ( '\n' ) ;
78
+ // Zero argument function first - that'd be ɵɵnamespaceSVG.
79
+ expect ( createLines [ 0 ] ) . toMatch ( / \b [ ^ ( ] + \( \) ; $ / ) ;
80
+ // Create element function second.
81
+ expect ( createLines [ 1 ] ) . toMatch ( / \b [ ^ ( ] + \( 0 , " s v g " , 0 \) / ) ;
82
+
61
83
expect ( host . scopedSync ( ) . exists ( normalize ( 'dist/app.component.svg' ) ) ) . toBe (
62
84
false ,
63
85
'should not copy app.component.svg to dist' ,
0 commit comments