• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CenterForOpenScience / ember-osf-web / 8572628743

05 Apr 2024 04:09PM UTC coverage: 65.858% (-2.3%) from 68.147%
8572628743

Pull #2185

github

web-flow
Merge 8cf5772d8 into f8c2d0077
Pull Request #2185: [DRAFT] [ENG-5346] Added the public preregistration to the author assertions page

2642 of 4314 branches covered (61.24%)

Branch coverage included in aggregate %.

14 of 288 new or added lines in 23 files covered. (4.86%)

20 existing lines in 4 files now uncovered.

6156 of 9045 relevant lines covered (68.06%)

217.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

7.69
/app/preprints/-components/submit/author-assertions/data-link-widget/data-link/component.ts
1
import Component from '@glimmer/component';
2
import { action } from '@ember/object';
3
import { inject as service } from '@ember/service';
4
import Intl from 'ember-intl/services/intl';
5
import { ValidationObject } from 'ember-changeset-validations';
6
import { validatePresence } from 'ember-changeset-validations/validators';
7
import buildChangeset from 'ember-osf-web/utils/build-changeset';
8

9

10
/**
11
 * The Data Link Args
12
 */
13
interface DataLinkArgs {
14
    remove: (__:number) => {};
15
    update: (_: string, __:number) => {};
16
    value: string;
17
    index: number;
18
}
19

20

21
interface DataLinkForm {
22
    value: string;
23
}
24

25
const DataLinkFormValidation: ValidationObject<DataLinkForm> = {
1✔
26
    value: validatePresence({
27
        presence: true,
28
        ignoreBlank: false,
29
        type: 'empty',
30
    }),
31
};
32

33
/**
34
 * The Data Link Component
35
 */
36
export default class PublicPreregistration extends Component<DataLinkArgs>{
37
    @service intl!: Intl;
38

39

NEW
40
    dataLinkFormChangeset = buildChangeset(
×
41
        {value: this.args.value || undefined},
×
42
        DataLinkFormValidation,
43
    );
44

45
    @action
46
    public async onUpdate(): Promise<void> {
NEW
47
        this.dataLinkFormChangeset.validate();
×
NEW
48
        if (this.dataLinkFormChangeset.isInvalid) {
×
NEW
49
            this.args.update('', this.args.index);
×
NEW
50
            return;
×
51
        }
NEW
52
        this.dataLinkFormChangeset.execute();
×
NEW
53
        await this.args.update(this.dataLinkFormChangeset.get('value'), this.args.index);
×
54
    }
55

56
    @action
57
    public async removeLink(): Promise<void> {
NEW
58
        await this.args.remove(this.args.index);
×
59
    }
60
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc