prettier/tests/typescript_decorators/__snapshots__/jsfmt.spec.js.snap

339 lines
6.6 KiB
Plaintext

// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`argument-list-preserve-line.ts 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
class Foo {
constructor(
@inject(Bar)
private readonly bar: IBar,
@inject(MyProcessor)
private readonly myProcessor: IMyProcessor,
@inject(InjectionTypes.AnotherThing)
private readonly anotherThing: IAnotherThing | undefined,
) { }
}
=====================================output=====================================
class Foo {
constructor(
@inject(Bar)
private readonly bar: IBar,
@inject(MyProcessor)
private readonly myProcessor: IMyProcessor,
@inject(InjectionTypes.AnotherThing)
private readonly anotherThing: IAnotherThing | undefined
) {}
}
================================================================================
`;
exports[`decorator-type-assertion.ts 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
@(bind as ClassDecorator)
class Decorated {
}
@(<ClassDecorator>bind)
class Decorated {
}
=====================================output=====================================
@(bind as ClassDecorator)
class Decorated {}
@(<ClassDecorator>bind)
class Decorated {}
================================================================================
`;
exports[`decorators.js 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
export class TestTextFileService {
constructor(
@ILifecycleService lifecycleService,
) {
}
}
@commonEditorContribution
export class TabCompletionController {
}
@Component({
selector: 'angular-component',
})
class AngularComponent {
@Input() myInput: string;
}
=====================================output=====================================
export class TestTextFileService {
constructor(@ILifecycleService lifecycleService) {}
}
@commonEditorContribution
export class TabCompletionController {}
@Component({
selector: "angular-component"
})
class AngularComponent {
@Input() myInput: string;
}
================================================================================
`;
exports[`decorators-comments.js 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
class Foo1 {
@foo
// comment
async method() {}
}
class Foo2 {
@foo
// comment
private method() {}
}
class Foo3 {
@foo
// comment
*method() {}
}
class Foo4 {
@foo
// comment
async *method() {}
}
class Something {
@foo()
// comment
readonly property: Array<string>
}
class Something {
@foo()
// comment
abstract property: Array<string>
}
class Something {
@foo()
// comment
abstract method(): Array<string>
}
=====================================output=====================================
class Foo1 {
@foo
// comment
async method() {}
}
class Foo2 {
@foo
// comment
private method() {}
}
class Foo3 {
@foo
// comment
*method() {}
}
class Foo4 {
@foo
// comment
async *method() {}
}
class Something {
@foo()
// comment
readonly property: Array<string>;
}
class Something {
@foo()
// comment
abstract property: Array<string>;
}
class Something {
@foo()
// comment
abstract method(): Array<string>;
}
================================================================================
`;
exports[`inline-decorators.ts 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
@d1
@d2(foo)
@d3.bar
@d4.baz()
class Class1 {}
class Class2 {
@d1
@d2(foo)
@d3.bar
@d4.baz()
method1() {}
@d1
method2() {}
@d2(foo)
method3() {}
@d3.bar
method4() {}
}
class Class3 {
@d1 fieldA;
@d2(foo) fieldB;
@d3.bar fieldC;
@d4.baz() fieldD;
constructor (
@d1 private x: number,
@d2(foo) private y: number,
@d3('foo') private z: number,
@d4({
x: string
}) private a: string,
) {}
}
@decorated class Foo {}
class Bar {
@decorated method() {}
}
class MyContainerComponent {
@ContentChildren(MyComponent) components: QueryListSomeBigName<MyComponentThat>;
}
=====================================output=====================================
@d1
@d2(foo)
@d3.bar
@d4.baz()
class Class1 {}
class Class2 {
@d1
@d2(foo)
@d3.bar
@d4.baz()
method1() {}
@d1
method2() {}
@d2(foo)
method3() {}
@d3.bar
method4() {}
}
class Class3 {
@d1 fieldA;
@d2(foo) fieldB;
@d3.bar fieldC;
@d4.baz() fieldD;
constructor(
@d1 private x: number,
@d2(foo) private y: number,
@d3("foo") private z: number,
@d4({
x: string
})
private a: string
) {}
}
@decorated
class Foo {}
class Bar {
@decorated method() {}
}
class MyContainerComponent {
@ContentChildren(MyComponent) components: QueryListSomeBigName<
MyComponentThat
>;
}
================================================================================
`;
exports[`interface.ts 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
// invalid place but shouldn't be removed
@hello()
interface MyInterface {
id: string;
}
=====================================output=====================================
// invalid place but shouldn't be removed
@hello()
interface MyInterface {
id: string;
}
================================================================================
`;