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

IgniteUI / igniteui-angular-wrappers / 4427504397

pending completion
4427504397

push

github

GitHub
Update README.md

281 of 305 branches covered (92.13%)

Branch coverage included in aggregate %.

668 of 713 relevant lines covered (93.69%)

219.79 hits per line

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

58.33
/projects/igniteui-angular-wrappers/src/lib/igvalidator/igvalidator.component.ts
1
import { Component, IterableDiffers, ElementRef, KeyValueDiffers, ChangeDetectorRef, Renderer2, OnInit } from '@angular/core';
2
import { IgControlBase } from '../igcontrolbase/igcontrolbase';
3

4
declare var jQuery: any;
5

6
@Component({
7
    selector: 'ig-validator',
8
    template: '<ng-content></ng-content>',
9
    inputs: [
10
      'widgetId',
11
      'options',
12
      'changeDetectionInterval',
13
      'disabled',
14
      'create',
15
      'onchange',
16
      'onblur',
17
      'onsubmit',
18
      'required',
19
      'number',
20
      'date',
21
      'email',
22
      'lengthRange',
23
      'valueRange',
24
      'creditCard',
25
      'pattern',
26
      'messageTarget',
27
      'errorMessage',
28
      'successMessage',
29
      'threshold',
30
      'equalTo',
31
      'custom',
32
      'fields',
33
      'notificationOptions',
34
      'requiredIndication',
35
      'optionalIndication'
36
    ],
37
    outputs: [
38
      'validating',
39
      'validated',
40
      'success',
41
      'error',
42
      'errorShowing',
43
      'errorHiding',
44
      'errorShown',
45
      'errorHidden',
46
      'successShowing',
47
      'successHiding',
48
      'successShown',
49
      'successHidden',
50
      'formValidating',
51
      'formValidated',
52
      'formError',
53
      'formSuccess'
54
    ]
55
})
56
export class IgValidatorComponent extends IgControlBase<IgValidator> implements OnInit {
1✔
57
    constructor(el: ElementRef, renderer: Renderer2, differs: IterableDiffers, kvalDiffers: KeyValueDiffers, cdr: ChangeDetectorRef) {
58
        super(el, renderer, differs, kvalDiffers, cdr);
1✔
59
    }
60

61
    ngOnInit() {
62
        let evtName;
63
        this._el = jQuery(document).find('#' + this.widgetId);
1✔
64
        jQuery(this._el)[this._widgetName](this.options);
1✔
65
        this._events = new Map<string, string>();
1✔
66

67
        for (const propt in jQuery.ui[this._widgetName].prototype.events) {
1✔
68
          if (jQuery.ui[this._widgetName].prototype.events.hasOwnProperty(prompt)) {
16!
69
            evtName = this._widgetName.toLowerCase() + propt.toLowerCase();
×
70
            this._events[evtName] = propt;
×
71
            jQuery(this._el).on(evtName, (evt, ui) => {
×
72
                this[this._events[evt.type]].emit({ event: evt, ui });
×
73
            });
74
          }
75
        }
76
    }
77

78
    /**
79
     * Trigger validation and show errors for invalid fields.
80
     *
81
     * @param field    Optional field object, its selector or zero-based index to check.
82
     *  Only has effect with fields collection and skips other fields.
83
     */
84
    /* istanbul ignore next */
85
    public validate(field?: object): boolean { return; }
86

87
    /**
88
     * Trigger validation but do not display error messages.
89
     *
90
     * @param field    Optional field object, its selector or zero-based index to check.
91
     * Only has effect with fields collection and skips other fields.
92
     */
93
    /* istanbul ignore next */
94
    public isValid(field?: object): boolean { return; }
95

96
    /**
97
     * Hide any possible message(s) (either messageTarget or igNotifier).
98
     *                         Note: When the validator has a fields colleciton, not passing a field will hide messages on all fields.
99
     *
100
     * @param field    Optional field object, its selector or zero-based index to hide message for.
101
     */
102
    /* istanbul ignore next */
103
    public hide(field?: object): void { return; }
104

105
    /**
106
     * Gets all current error messages for invalid field(s).
107
     * Note that this method does not valdiate and states and messages are only updated on validation, so
108
     * this can be used on formValidated event or after validate/isValid method calls.
109
     *
110
     * @param field    Optional field object, selector or zero-based index for a single field to get error message for.
111
     */
112
    /* istanbul ignore next */
113
    public getErrorMessages(field?: object): any[] { return; }
114

115
    /**
116
     * Check for currently displayed message(s). Takes an optional field.
117
     *                         Note: When the validator has a fields colleciton, not passing a
118
     *      field will return a cumulative true even if just one field has a visible message.
119
     *
120
     * @param field    Optional field object, selector or zero-based index for a single field to get error message for.
121
     */
122
    /* istanbul ignore next */
123
    public isMessageDisplayed(field?: object): boolean { return; }
124

125
    /**
126
     * Gets the notifier for the igValidator or for a single filed.
127
     *
128
     * @param field    Optional field object, its selector or zero-based index to get notifier for.
129
     */
130
    /* istanbul ignore next */
131
    public notifier(field?: object): object { return; }
132

133
    /**
134
     * Adds an new input to the fields collection and initializes it with the validator.
135
     * Note: Additional fields are only accepted if the validator has been created with the collection.
136
     *
137
     * @param field    An object with the field selector and options.
138
     */
139
    /* istanbul ignore next */
140
    public addField(field: object): void { return; }
141

142
    /**
143
     * Removes an input from the fields collection.
144
     *
145
     * @param field    The field object to remove, its zero-based index or selector.
146
     */
147
    /* istanbul ignore next */
148
    public removeField(field: object): void { return; }
149

150
    /**
151
     * Updates a field in the validator collection.
152
     * Used to reinitialize field in case a control has been created after the validator or to pass in new options.
153
     *
154
     * @param field    The field object to update, its zero-based index or selector.
155
     * @param fieldOptions    New options to apply to the field.
156
     */
157
    /* istanbul ignore next */
158
    public updateField(field: object, fieldOptions?: object): void { return; }
159

160
    /**
161
     * Destroys the validator widget.
162
     */
163
    /* istanbul ignore next */
164
    public destroy(): void { return; }
165
}
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