Angular2 how to unit test a custom validator directive?
<p>I wrote a very simple custom validator for an input field:</p>
<pre class="lang-js prettyprint-override"><code>import { Directive } from '@angular/core';
import { AbstractControl, NG_VALIDATORS } from '@angular/forms';

function numberValidator(c: AbstractControl) {
    if (!c.value) return null;
    return new RegExp('^[1-9][0-9]{6,9}$').test(c.value) ? null : {
        validateNumber: {
            valid: false
        }
    }
}

@Directive({
    selector: '[number-validator]',
    providers: [
        { provide: NG_VALIDATORS, multi: true, useValue: numberValidator }
    ]
})
export class NumberValidator {}
</code></pre>
<p>I would like to unit test this validator. I read <a href="https://angular.io/docs/ts/latest/guide/testing.html#!#attribute-directive" rel="nofollow noreferrer">Test an attribute directive</a> on the Angular2 page, but there is no css or html that changes. How can I unit test this validator?</p>