test(@schematics/angular): fix component schematic tests on Windows

This commit is contained in:
Alan Agius 2020-02-17 14:28:15 +01:00 committed by Keen Yee Liau
parent bb7eee31c9
commit 8465538f9d

View File

@ -253,28 +253,28 @@ describe('Component Schematic', () => {
const options = { ...defaultOptions, displayBlock: true };
const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
const content = tree.readContent('/projects/bar/src/app/foo/foo.component.css');
expect(content).toMatch(/:host {\n display: block;\n}\n/);
expect(content).toMatch(/:host {\r?\n display: block;\r?\n}/);
});
it('should respect the displayBlock option when inlineStyle is `false` and use correct syntax for `scss`', async () => {
const options = { ...defaultOptions, displayBlock: true, style: 'scss' };
const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
const content = tree.readContent('/projects/bar/src/app/foo/foo.component.scss');
expect(content).toMatch(/:host {\n display: block;\n}\n/);
expect(content).toMatch(/:host {\r?\n display: block;\r?\n}/);
});
it('should respect the displayBlock option when inlineStyle is `false` and use correct syntax for `sass', async () => {
const options = { ...defaultOptions, displayBlock: true, style: 'sass' };
const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
const content = tree.readContent('/projects/bar/src/app/foo/foo.component.sass');
expect(content).toMatch(/\\:host\n display: block;\n/);
expect(content).toMatch(/\\:host\r?\n display: block;\r?\n/);
});
it('should respect the displayBlock option when inlineStyle is `true`', async () => {
const options = { ...defaultOptions, displayBlock: true, inlineStyle: true };
const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
expect(content).toMatch(/:host {\n(\s*)display: block;(\s*)}\n/);
expect(content).toMatch(/:host {\r?\n(\s*)display: block;(\s*)}\r?\n/);
});
it('should respect the style option', async () => {