"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/core/schematics/test/preserve_query_params_migration_spec.ts" between
angular-11.0.1.tar.gz and angular-11.0.2.tar.gz

About: Angular is a development platform for building mobile and desktop web applications using Typescript/JavaScript.

preserve_query_params_migration_spec.ts  (angular-11.0.1):preserve_query_params_migration_spec.ts  (angular-11.0.2)
skipping to change at line 74 skipping to change at line 74
goHome() { goHome() {
this._router.navigate('/', {preserveQueryParams: true}); this._router.navigate('/', {preserveQueryParams: true});
} }
} }
`); `);
await runMigration(); await runMigration();
const content = tree.readContent('/index.ts'); const content = tree.readContent('/index.ts');
expect(content).toContain(`this._router.navigate('/', { queryParamsHandler : 'preserve' });`); expect(content).toContain(`this._router.navigate('/', { queryParamsHandlin g: 'preserve' });`);
}); });
it('`createUrlTree` function', async () => { it('`createUrlTree` function', async () => {
writeFile('/index.ts', ` writeFile('/index.ts', `
import {Router} from '@angular/router'; import {Router} from '@angular/router';
class Navigator { class Navigator {
constructor(private _router: Router) {} constructor(private _router: Router) {}
goHome() { goHome() {
skipping to change at line 117 skipping to change at line 117
goHome() { goHome() {
this._router.createUrlTree(['/'], config); this._router.createUrlTree(['/'], config);
} }
} }
`); `);
await runMigration(); await runMigration();
const content = tree.readContent('/index.ts'); const content = tree.readContent('/index.ts');
expect(content).toContain( expect(content).toContain(
`const config = { replaceUrl: true, fragment: 'foo', state: {}, queryP aramsHandler: 'preserve' };`); `const config = { replaceUrl: true, fragment: 'foo', state: {}, queryP aramsHandling: 'preserve' };`);
}); });
it('should remove when the value is `false`', async () => { it('should remove when the value is `false`', async () => {
writeFile('/index.ts', ` writeFile('/index.ts', `
import {Router} from '@angular/router'; import {Router} from '@angular/router';
const config = {preserveQueryParams: false, replaceUrl: true, fragment: 'foo', state: {}}; const config = {preserveQueryParams: false, replaceUrl: true, fragment: 'foo', state: {}};
class Navigator { class Navigator {
constructor(private _router: Router) {} constructor(private _router: Router) {}
skipping to change at line 181 skipping to change at line 181
goHome() { goHome() {
this._router.navigate('/', {preserveQueryParams: true, replaceUrl: t rue, fragment: 'foo', state: {}}); this._router.navigate('/', {preserveQueryParams: true, replaceUrl: t rue, fragment: 'foo', state: {}});
} }
} }
`); `);
await runMigration(); await runMigration();
const content = tree.readContent('/index.ts'); const content = tree.readContent('/index.ts');
expect(content).toContain( expect(content).toContain(
`this._router.navigate('/', { replaceUrl: true, fragment: 'foo', state : {}, queryParamsHandler: 'preserve' });`); `this._router.navigate('/', { replaceUrl: true, fragment: 'foo', state : {}, queryParamsHandling: 'preserve' });`);
}); });
it('should remove when the value is `false`', async () => { it('should remove when the value is `false`', async () => {
writeFile('/index.ts', ` writeFile('/index.ts', `
import {Router} from '@angular/router'; import {Router} from '@angular/router';
class Navigator { class Navigator {
constructor(private _router: Router) {} constructor(private _router: Router) {}
goHome() { goHome() {
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)