Skip to content
This repository was archived by the owner on Jan 22, 2018. It is now read-only.

Commit 9c1125a

Browse files
author
Kamil Kisiela
committed
chore(unit-testing): add helpers
1 parent 431e140 commit 9c1125a

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

package.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,13 @@ Package.onTest(function(api) {
109109
110110
'velocity:helpers',
111111
'velocity:console-reporter',
112+
'jquery',
112113
'angular:[email protected]',
113114
'wieldo:angular-formly-templates-material'
114115
]);
115116

116117
api.addFiles([
118+
'tests/client/test-utils.js',
117119
'tests/client/formly-material-spec.js'
118120
], client);
119121
});

tests/client/test-utils.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
testUtils = class testUtils {
2+
static fixTypeTemplateUrl(formlyConfig, typeName) {
3+
let type = formlyConfig.getType(typeName, true);
4+
type.templateUrl = type.templateUrl.replace(
5+
"/packages/wieldo:angular-formly-templates-material/lib/",
6+
"wieldo_angular-formly-templates-material_lib/"
7+
);
8+
}
9+
10+
static fixWrapperTemplateUrl(formlyConfig, wrapperName) {
11+
let wrapper = formlyConfig.getWrapper(wrapperName, true);
12+
wrapper.templateUrl = wrapper.templateUrl.replace(
13+
"/packages/wieldo:angular-formly-templates-material/lib/",
14+
"wieldo_angular-formly-templates-material_lib/"
15+
);
16+
}
17+
18+
static fixFieldsTypes(formlyConfig, fields) {
19+
fields.forEach((field) => {
20+
testUtils.fixTypeTemplateUrl(formlyConfig, field.type);
21+
});
22+
}
23+
24+
static formTemplate = `<form name="testForm"><formly-form fields="fields" form="testForm"></formly-form></form>`;
25+
};

0 commit comments

Comments
 (0)