semmet-angular 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils/component-test-files/__name@dasherize__/__name@dasherize__.e2e-spec.ts.template +10 -0
- package/src/utils/component-test-files/__name@dasherize__/__name@dasherize__.spec.ts.template +23 -0
- package/src/utils/generate-component.js +6 -2
- package/src/utils/generate-component.js.map +1 -1
- package/src/utils/generate-component.ts +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semmet-angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Angular schematics that generate real, ARIA-conformant standalone components (Accordion, Tabs, Dialog, Disclosure, Tooltip...) with signals-based state and keyboard interaction built in.",
|
|
5
5
|
"publisher": "danilodevsilva",
|
|
6
6
|
"license": "MIT",
|
package/src/utils/component-test-files/__name@dasherize__/__name@dasherize__.e2e-spec.ts.template
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { expect, test } from '@playwright/test';
|
|
2
|
+
|
|
3
|
+
test.describe('<%= classify(name) %>', () => {
|
|
4
|
+
test('is rendered and reachable by its Angular selector', async ({ page }) => {
|
|
5
|
+
await page.goto('/');
|
|
6
|
+
|
|
7
|
+
const component = page.locator('<%= selector %>').first();
|
|
8
|
+
await expect(component).toBeVisible();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { <%= classify(name) %> } from './<%= dasherize(name) %>';
|
|
3
|
+
|
|
4
|
+
describe('<%= classify(name) %>', () => {
|
|
5
|
+
let fixture: ComponentFixture<<%= classify(name) %>>;
|
|
6
|
+
|
|
7
|
+
beforeEach(async () => {
|
|
8
|
+
await TestBed.configureTestingModule({
|
|
9
|
+
imports: [<%= classify(name) %>],
|
|
10
|
+
}).compileComponents();
|
|
11
|
+
|
|
12
|
+
fixture = TestBed.createComponent(<%= classify(name) %>);
|
|
13
|
+
fixture.detectChanges();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('creates the component', () => {
|
|
17
|
+
expect(fixture.componentInstance).toBeTruthy();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('renders through the configured selector', () => {
|
|
21
|
+
expect(fixture.nativeElement.matches('<%= selector %>')).toBeTrue();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -20,11 +20,15 @@ function createAriaComponentSchematic() {
|
|
|
20
20
|
const selector = `${project.prefix ? `${project.prefix}-` : ''}${core_1.strings.dasherize(name)}`;
|
|
21
21
|
(0, validation_1.validateHtmlSelector)(selector);
|
|
22
22
|
(0, validation_1.validateClassName)(core_1.strings.classify(name));
|
|
23
|
-
const
|
|
23
|
+
const componentTemplateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
24
24
|
(0, schematics_1.applyTemplates)({ ...core_1.strings, name, selector }),
|
|
25
25
|
(0, schematics_1.move)(parsedPath.path),
|
|
26
26
|
]);
|
|
27
|
-
|
|
27
|
+
const testTemplateSource = (0, schematics_1.apply)((0, schematics_1.url)('../utils/component-test-files'), [
|
|
28
|
+
(0, schematics_1.applyTemplates)({ ...core_1.strings, name, selector }),
|
|
29
|
+
(0, schematics_1.move)(parsedPath.path),
|
|
30
|
+
]);
|
|
31
|
+
return (0, schematics_1.chain)([(0, schematics_1.mergeWith)(componentTemplateSource), (0, schematics_1.mergeWith)(testTemplateSource)]);
|
|
28
32
|
});
|
|
29
33
|
}
|
|
30
34
|
//# sourceMappingURL=generate-component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-component.js","sourceRoot":"","sources":["generate-component.ts"],"names":[],"mappings":";;AAaA,
|
|
1
|
+
{"version":3,"file":"generate-component.js","sourceRoot":"","sources":["generate-component.ts"],"names":[],"mappings":";;AA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AAC,CAAC,IAAA,sBAAS,EAAC,uBAAuB,CAAC,EAAE,IAAA,sBAAS,EAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -22,11 +22,15 @@ export function createAriaComponentSchematic(): (options: ComponentSchematicOpti
|
|
|
22
22
|
validateHtmlSelector(selector);
|
|
23
23
|
validateClassName(strings.classify(name));
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const componentTemplateSource = apply(url('./files'), [
|
|
26
|
+
applyTemplates({ ...strings, name, selector }),
|
|
27
|
+
move(parsedPath.path),
|
|
28
|
+
]);
|
|
29
|
+
const testTemplateSource = apply(url('../utils/component-test-files'), [
|
|
26
30
|
applyTemplates({ ...strings, name, selector }),
|
|
27
31
|
move(parsedPath.path),
|
|
28
32
|
]);
|
|
29
33
|
|
|
30
|
-
return chain([mergeWith(
|
|
34
|
+
return chain([mergeWith(componentTemplateSource), mergeWith(testTemplateSource)]);
|
|
31
35
|
});
|
|
32
36
|
}
|