"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/angular_devkit/build_angular/src/babel/plugins/adjust-static-class-members_spec.ts" between
angular-cli-12.1.2.tar.gz and angular-cli-12.1.3.tar.gz

About: Angular CLI is a command line interface for Angular.

adjust-static-class-members_spec.ts  (angular-cli-12.1.2):adjust-static-class-members_spec.ts  (angular-cli-12.1.3)
skipping to change at line 185 skipping to change at line 185
testCaseNoChange(` testCaseNoChange(`
export default class CustomComponentEffects { export default class CustomComponentEffects {
constructor(_actions) { constructor(_actions) {
this._actions = _actions; this._actions = _actions;
this.doThis = this._actions; this.doThis = this._actions;
} }
} }
`); `);
}); });
it('does wrap not class with only side effect fields', () => { it('does wrap not default exported class with only side effect fields', () => {
testCaseNoChange(` testCaseNoChange(`
export default class CustomComponentEffects { export default class CustomComponentEffects {
constructor(_actions) { constructor(_actions) {
this._actions = _actions; this._actions = _actions;
this.doThis = this._actions; this.doThis = this._actions;
} }
} }
CustomComponentEffects.someFieldWithSideEffects = console.log('foo'); CustomComponentEffects.someFieldWithSideEffects = console.log('foo');
`); `);
}); });
it('does wrap not class with only side effect fields', () => {
testCaseNoChange(`
class CustomComponentEffects {
constructor(_actions) {
this._actions = _actions;
this.doThis = this._actions;
}
}
CustomComponentEffects.someFieldWithSideEffects = console.log('foo');
`);
});
it('wraps class with pure annotated side effect fields', () => {
testCase({
input: `
class CustomComponentEffects {
constructor(_actions) {
this._actions = _actions;
this.doThis = this._actions;
}
}
CustomComponentEffects.someFieldWithSideEffects = /*#__PURE__*/ console.
log('foo');
`,
expected: `
let CustomComponentEffects = /*#__PURE__*/ (() => {
class CustomComponentEffects {
constructor(_actions) {
this._actions = _actions;
this.doThis = this._actions;
}
}
CustomComponentEffects.someFieldWithSideEffects = /*#__PURE__*/ consol
e.log('foo');
return CustomComponentEffects;
})();
`,
});
});
it('wraps class with closure pure annotated side effect fields', () => {
testCase({
input: `
class CustomComponentEffects {
constructor(_actions) {
this._actions = _actions;
this.doThis = this._actions;
}
}
CustomComponentEffects.someFieldWithSideEffects = /* @pureOrBreakMyCode
*/ console.log('foo');
`,
expected: `
let CustomComponentEffects = /*#__PURE__*/ (() => {
class CustomComponentEffects {
constructor(_actions) {
this._actions = _actions;
this.doThis = this._actions;
}
}
CustomComponentEffects.someFieldWithSideEffects =
/* @pureOrBreakMyCode */
console.log('foo');
return CustomComponentEffects;
})();
`,
});
});
it('wraps exported class with a pure static field', () => { it('wraps exported class with a pure static field', () => {
testCase({ testCase({
input: ` input: `
export class CustomComponentEffects { export class CustomComponentEffects {
constructor(_actions) { constructor(_actions) {
this._actions = _actions; this._actions = _actions;
this.doThis = this._actions; this.doThis = this._actions;
} }
} }
CustomComponentEffects.someField = 42; CustomComponentEffects.someField = 42;
 End of changes. 2 change blocks. 
1 lines changed or deleted 73 lines changed or added

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