|
5 | 5 | * Use of this source code is governed by an MIT-style license that can be
|
6 | 6 | * found in the LICENSE file at https://angular.io/license
|
7 | 7 | */
|
8 |
| - |
9 | 8 | import { map } from 'rxjs/operators';
|
10 | 9 | import { formatValidator } from './format-validator';
|
11 | 10 | import { htmlSelectorFormat } from './html-selector';
|
12 | 11 |
|
13 |
| - |
14 | 12 | describe('Schematics HTML selector format', () => {
|
15 | 13 | it('accepts correct selectors', done => {
|
16 | 14 | const data = { selector: 'my-selector' };
|
@@ -45,14 +43,25 @@ describe('Schematics HTML selector format', () => {
|
45 | 43 | .toPromise().then(done, done.fail);
|
46 | 44 | });
|
47 | 45 |
|
48 |
| - it('rejects selectors with non-letter after dash', done => { |
| 46 | + it('accepts selectors with non-letter after dash', done => { |
49 | 47 | const data = { selector: 'my-1selector' };
|
50 | 48 | const dataSchema = {
|
51 | 49 | properties: { selector: { type: 'string', format: 'html-selector' } },
|
52 | 50 | };
|
53 | 51 |
|
54 | 52 | formatValidator(data, dataSchema, [htmlSelectorFormat])
|
55 |
| - .pipe(map(result => expect(result.success).toBe(false))) |
| 53 | + .pipe(map(result => expect(result.success).toBe(true))) |
| 54 | + .toPromise().then(done, done.fail); |
| 55 | + }); |
| 56 | + |
| 57 | + it('accepts selectors with unicode', done => { |
| 58 | + const data = { selector: 'app-root😀' }; |
| 59 | + const dataSchema = { |
| 60 | + properties: { selector: { type: 'string', format: 'html-selector' } }, |
| 61 | + }; |
| 62 | + |
| 63 | + formatValidator(data, dataSchema, [htmlSelectorFormat]) |
| 64 | + .pipe(map(result => expect(result.success).toBe(true))) |
56 | 65 | .toPromise().then(done, done.fail);
|
57 | 66 | });
|
58 | 67 | });
|
0 commit comments