File tree 2 files changed +4
-3
lines changed
packages/schematics/angular/universal
2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ function wrapBootstrapCall(options: UniversalOptions): Rule {
134
134
const triviaWidth = bootstrapCall . getLeadingTriviaWidth ( ) ;
135
135
const beforeText = `document.addEventListener('DOMContentLoaded', () => {\n`
136
136
+ ' ' . repeat ( triviaWidth > 2 ? triviaWidth + 1 : triviaWidth ) ;
137
- const afterText = `\n${ triviaWidth > 2 ? ' ' . repeat ( triviaWidth - 1 ) : '' } );` ;
137
+ const afterText = `\n${ triviaWidth > 2 ? ' ' . repeat ( triviaWidth - 1 ) : '' } } );` ;
138
138
139
139
// in some cases we need to cater for a trailing semicolon such as;
140
140
// bootstrap().catch(err => console.log(err));
Original file line number Diff line number Diff line change @@ -150,10 +150,11 @@ describe('Universal Schematic', () => {
150
150
const tree = schematicRunner . runSchematic ( 'universal' , defaultOptions , appTree ) ;
151
151
const filePath = '/projects/bar/src/main.ts' ;
152
152
const contents = tree . readContent ( filePath ) ;
153
- expect ( contents ) . toMatch ( / d o c u m e n t .a d d E v e n t L i s t e n e r \( ' D O M C o n t e n t L o a d e d ' , \( \) = > { / ) ;
153
+ expect ( contents )
154
+ . toMatch ( / d o c u m e n t .a d d E v e n t L i s t e n e r \( ' D O M C o n t e n t L o a d e d ' , \( \) = > { [ \w \W ] + ; [ \r \n ] } \) ; / ) ;
154
155
} ) ;
155
156
156
- it ( 'should wrap the bootstrap decleration in a DOMContentLoaded event handler' , ( ) => {
157
+ it ( 'should wrap the bootstrap declaration in a DOMContentLoaded event handler' , ( ) => {
157
158
const filePath = '/projects/bar/src/main.ts' ;
158
159
appTree . overwrite (
159
160
filePath ,
You can’t perform that action at this time.
0 commit comments