Skip to content

Commit ff838d4

Browse files
committed
use component tags in tests
1 parent 7938f9b commit ff838d4

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"devDependencies": {
3333
"@activewidgets/options": "0.0.9",
3434
"@activewidgets/puppeteer": "0.0.3",
35-
"@activewidgets/testing": "0.0.1",
35+
"@activewidgets/testing": "0.0.2",
3636
"@angular/common": "^8",
3737
"@angular/compiler": "^8",
3838
"@angular/compiler-cli": "^8",

test/adapter/angular.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import {getQueriesForElement} from '@testing-library/dom';
44
import {TestBed} from '@angular/core/testing';
5-
import {AxModule} from '@activewidgets/components';
5+
import * as components from '@activewidgets/components';
66

77
import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing';
88

@@ -11,8 +11,22 @@ import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angul
1111
platformBrowserDynamicTesting()
1212
);
1313

14+
let AxModule = components.AxModule;
1415

15-
export function render(Component, props){
16+
let tags = {};
17+
18+
Object.keys(components).forEach(name => {
19+
tags['ax-' + name.toLowerCase()] = components[name];
20+
});
21+
22+
23+
export function render(comp, props){
24+
25+
let Component = tags[comp];
26+
27+
if (!Component){
28+
throw new Error('component not found - ' + comp);
29+
}
1630

1731
TestBed.configureTestingModule({
1832
imports: [AxModule]

0 commit comments

Comments
 (0)