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

Commit aa8053e

Browse files
author
Kamil Kisiela
committed
chore: make compatible with Meteor releases older then 1.2
1 parent c94f876 commit aa8053e

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

lib/client/formly-material.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function formlyMaterial() {
77
var self = this;
88

99
this.templateUrl = function (templateUrl) {
10-
return '/packages/wieldo:angular-formly-templates-material/' + templateUrl.replace(/^\//, "");
10+
return angularTemplateUrl('wieldo:angular-formly-templates-material', templateUrl);
1111
};
1212

1313
this.$get = function () {

package.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var client = 'client';
33
Package.describe({
44
name: "wieldo:angular-formly-templates-material",
55
summary: "Material design templates for angular-formly",
6-
version: "0.5.2",
6+
version: "0.6.0",
77

88
documentation: 'README.md',
99
git: 'https://github.com/wieldo/angular-formly-templates-material.git'
@@ -14,11 +14,13 @@ Package.onUse(function (api) {
1414
var packages = {
1515
use: [
1616
17+
1718
'pbastowski:[email protected]',
1819
'pbastowski:[email protected]',
1920
2021
],
2122
imply: [
23+
'mys:angular-template-url',
2224
'angular:[email protected]',
2325
'angular:[email protected]',
2426
'angular:[email protected]',
@@ -110,6 +112,7 @@ Package.onTest(function(api) {
110112
'velocity:helpers',
111113
'velocity:console-reporter',
112114
'jquery',
115+
'mys:version-compare',
113116
'angular:[email protected]',
114117
'wieldo:angular-formly-templates-material'
115118
]);

tests/client/formly-material-spec.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,48 @@ describe('formlyMaterial', () => {
44
//
55
let formlyMaterial;
66
let formlyMaterialPr;
7+
let prefix;
78

89
//
910
// tests
1011
//
11-
12+
1213
beforeEach(() => {
1314
angular.module('formlyMaterialMock', [])
1415
.config((formlyMaterialProvider) => {
1516
formlyMaterialPr = formlyMaterialProvider
1617
});
1718
module('formlyMaterial', 'formlyMaterialMock');
18-
19+
1920
angular.module('testApp', ['angular-meteor', 'formly', 'formlyMaterial', 'ngMock']);
2021
module('testApp');
2122

2223
inject(function ($templateCache, $httpBackend, _formlyMaterial_) {
2324
$httpBackend.whenGET(/\.html$/i).respond((method, url) => $templateCache.get(url));
2425
formlyMaterial = _formlyMaterial_;
2526
});
27+
28+
if (meteorVersionCompare.lt('1.2')) {
29+
prefix = "/packages/wieldo_angular-formly-templates-material_";
30+
} else {
31+
prefix = "/packages/wieldo:angular-formly-templates-material/";
32+
}
2633
});
2734

2835
it("should be injectable", () => {
2936
expect(formlyMaterial).toBeDefined();
3037
});
3138

3239
it("should be able to add prefix to templateUrl using factory", () => {
33-
const prefix = "/packages/wieldo:angular-formly-templates-material/";
34-
35-
expect(formlyMaterial.templateUrl("test.html")).toBe(prefix + "test.html");
36-
expect(formlyMaterial.templateUrl("/test.html")).toBe(prefix + "test.html");
37-
expect(formlyMaterial.templateUrl("/test/test.html")).toBe(prefix + "test/test.html");
40+
expect(formlyMaterial.templateUrl("client/test.html")).toBe(prefix + "client/test.html");
41+
expect(formlyMaterial.templateUrl("/client/test.html")).toBe(prefix + "client/test.html");
42+
expect(formlyMaterial.templateUrl("/client/test/test.html")).toBe(prefix + "client/test/test.html");
3843
});
3944

4045
it("should be able to add prefix to templateUrl using provider", () => {
41-
const prefix = "/packages/wieldo:angular-formly-templates-material/";
42-
43-
expect(formlyMaterialPr.templateUrl("test.html")).toBe(prefix + "test.html");
44-
expect(formlyMaterialPr.templateUrl("/test.html")).toBe(prefix + "test.html");
45-
expect(formlyMaterialPr.templateUrl("/test/test.html")).toBe(prefix + "test/test.html");
46+
expect(formlyMaterialPr.templateUrl("client/test.html")).toBe(prefix + "client/test.html");
47+
expect(formlyMaterialPr.templateUrl("/client/test.html")).toBe(prefix + "client/test.html");
48+
expect(formlyMaterialPr.templateUrl("/client/test/test.html")).toBe(prefix + "client/test/test.html");
4649
});
4750

4851
});

0 commit comments

Comments
 (0)