webfontloader 1.2.0 → 1.2.1
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.
- data/CHANGELOG +9 -0
- data/Gemfile +2 -8
- data/README.md +31 -32
- data/Rakefile +2 -33
- data/docs/EVENTS.md +10 -1
- data/docs/MODULES.md +4 -3
- data/lib/webfontloader.rb +1 -1
- data/spec/ascender/ascenderscript_spec.js +43 -0
- data/spec/core/cssclassname_spec.js +42 -0
- data/spec/core/cssfontfamilyname_spec.js +38 -0
- data/spec/core/domhelper_spec.js +158 -0
- data/spec/core/eventdispatcher_spec.js +209 -0
- data/spec/core/font_spec.js +218 -0
- data/spec/core/fontmoduleloader_spec.js +55 -0
- data/spec/core/fontruler_spec.js +33 -0
- data/spec/core/fontvariationdescription_spec.js +67 -0
- data/spec/core/fontwatcher_spec.js +204 -0
- data/spec/core/fontwatchrunner_spec.js +398 -0
- data/spec/core/size_spec.js +17 -0
- data/spec/core/useragentparser_spec.js +921 -0
- data/spec/custom/customcss_spec.js +36 -0
- data/spec/fontdeck/fontdeckscript_spec.js +111 -0
- data/spec/fonts/LICENSE.txt +93 -0
- data/spec/fonts/nullfont.css +1 -0
- data/spec/fonts/nullfont1.css +1 -0
- data/spec/fonts/nullfont2.css +1 -0
- data/spec/fonts/nullfont3.css +1 -0
- data/spec/fonts/sourcesans.eot +0 -0
- data/spec/fonts/sourcesans.otf +0 -0
- data/spec/fonts/sourcesans.svg +2523 -0
- data/spec/fonts/sourcesans.ttf +0 -0
- data/spec/fonts/sourcesans.woff +0 -0
- data/spec/fonts/sourcesansa.css +1 -0
- data/spec/fonts/sourcesansb.css +1 -0
- data/spec/google/fontapiparser_spec.js +348 -0
- data/spec/google/fontapiurlbuilder_spec.js +40 -0
- data/spec/google/googlefontapi_spec.js +123 -0
- data/spec/google/lastresortwebkitfontwatchrunner_spec.js +145 -0
- data/spec/index.html +95 -0
- data/spec/monotype/monotypescript_spec.js +49 -0
- data/spec/typekit/typekitscript_spec.js +93 -0
- data/src/core/domhelper.js +6 -3
- data/src/core/fontruler.js +1 -1
- data/src/core/fontwatcher.js +5 -0
- data/src/core/fontwatchrunner.js +7 -4
- data/src/monotype/monotype_script.js +4 -3
- data/tools/jasmine-phantomjs/jasmine-phantomjs.js +26 -0
- data/tools/jasmine-phantomjs/terminal-reporter.js +177 -0
- data/tools/jasmine/MIT.LICENSE +20 -0
- data/tools/jasmine/jasmine-html.js +681 -0
- data/tools/jasmine/jasmine.css +82 -0
- data/tools/jasmine/jasmine.js +2600 -0
- data/webfontloader.gemspec +46 -25
- metadata +77 -42
- data/src-test/ascender/ascender_script_test.js +0 -51
- data/src-test/core/cssclassnametest.js +0 -42
- data/src-test/core/cssfontfamilynametest.js +0 -54
- data/src-test/core/domhelpertest.js +0 -151
- data/src-test/core/eventdispatchertest.js +0 -275
- data/src-test/core/fontmoduleloadertest.js +0 -30
- data/src-test/core/fonttest.js +0 -121
- data/src-test/core/fontvariationdescriptiontest.js +0 -76
- data/src-test/core/fontwatchertest.js +0 -287
- data/src-test/core/fontwatchrunnertest.js +0 -454
- data/src-test/core/useragenttest.js +0 -755
- data/src-test/custom/customcsstest.js +0 -35
- data/src-test/fontdeck/fontdeck_script_test.js +0 -116
- data/src-test/google/fontapiparsertest.js +0 -252
- data/src-test/google/fontapiurlbuildertest.js +0 -71
- data/src-test/google/googlefontapitest.js +0 -185
- data/src-test/google/lastresortwebkitfontwatchrunnertest.js +0 -204
- data/src-test/monotype/monotype_script_test.js +0 -304
- data/src-test/typekit/typekit_script_test.js +0 -195
- data/tools/jstestdriver/JsTestDriver-1.2.1.jar +0 -0
@@ -0,0 +1,209 @@
|
|
1
|
+
describe('EventDispatcher', function () {
|
2
|
+
var EventDispatcher = webfont.EventDispatcher,
|
3
|
+
DomHelper = webfont.DomHelper,
|
4
|
+
domHelper = new DomHelper(window),
|
5
|
+
element = null
|
6
|
+
eventDispatcher = null,
|
7
|
+
namespace = 'ns',
|
8
|
+
nullFn = function () {},
|
9
|
+
callbacks = {
|
10
|
+
loading: nullFn,
|
11
|
+
active: nullFn,
|
12
|
+
inactive: nullFn,
|
13
|
+
fontloading: nullFn,
|
14
|
+
fontactive: nullFn,
|
15
|
+
fontinactive: nullFn
|
16
|
+
};
|
17
|
+
|
18
|
+
beforeEach(function () {
|
19
|
+
element = domHelper.createElement();
|
20
|
+
eventDispatcher = new EventDispatcher(domHelper, element, callbacks, namespace);
|
21
|
+
|
22
|
+
spyOn(callbacks, 'loading');
|
23
|
+
spyOn(callbacks, 'active');
|
24
|
+
spyOn(callbacks, 'inactive');
|
25
|
+
spyOn(callbacks, 'fontloading');
|
26
|
+
spyOn(callbacks, 'fontactive');
|
27
|
+
spyOn(callbacks, 'fontinactive');
|
28
|
+
});
|
29
|
+
|
30
|
+
describe('#dispatchLoading', function () {
|
31
|
+
beforeEach(function () {
|
32
|
+
eventDispatcher.dispatchLoading();
|
33
|
+
});
|
34
|
+
|
35
|
+
it('should call the correct callback', function () {
|
36
|
+
expect(callbacks.loading).toHaveBeenCalled();
|
37
|
+
});
|
38
|
+
|
39
|
+
it('should set the correct class name', function () {
|
40
|
+
expect(element.className).toEqual('ns-loading');
|
41
|
+
});
|
42
|
+
});
|
43
|
+
|
44
|
+
describe('#dispatchFontLoading', function () {
|
45
|
+
beforeEach(function () {
|
46
|
+
eventDispatcher.dispatchFontLoading('My Family', 'n4');
|
47
|
+
});
|
48
|
+
|
49
|
+
it('should call the correct callback', function () {
|
50
|
+
expect(callbacks.fontloading).toHaveBeenCalledWith('My Family', 'n4');
|
51
|
+
});
|
52
|
+
|
53
|
+
it('should set the correct class name', function () {
|
54
|
+
expect(element.className).toEqual('ns-myfamily-n4-loading');
|
55
|
+
});
|
56
|
+
});
|
57
|
+
|
58
|
+
describe('#dispatchFontInactive', function () {
|
59
|
+
beforeEach(function () {
|
60
|
+
eventDispatcher.dispatchFontInactive('My Family', 'n4');
|
61
|
+
});
|
62
|
+
|
63
|
+
it('should call the correct callback', function () {
|
64
|
+
expect(callbacks.fontinactive).toHaveBeenCalledWith('My Family', 'n4');
|
65
|
+
});
|
66
|
+
|
67
|
+
it('should set the correct class name', function () {
|
68
|
+
expect(element.className).toEqual('ns-myfamily-n4-inactive');
|
69
|
+
});
|
70
|
+
});
|
71
|
+
|
72
|
+
describe('#dispatchFontInactive - with loading class', function () {
|
73
|
+
beforeEach(function () {
|
74
|
+
eventDispatcher.dispatchFontLoading('My Family', 'n4');
|
75
|
+
eventDispatcher.dispatchFontInactive('My Family', 'n4');
|
76
|
+
});
|
77
|
+
|
78
|
+
it('should set the correct class name', function () {
|
79
|
+
expect(element.className).toEqual('ns-myfamily-n4-inactive');
|
80
|
+
});
|
81
|
+
});
|
82
|
+
|
83
|
+
describe('#dispatchFontInactive - with active class', function () {
|
84
|
+
beforeEach(function () {
|
85
|
+
eventDispatcher.dispatchFontActive('My Family', 'n4');
|
86
|
+
eventDispatcher.dispatchFontInactive('My Family', 'n4');
|
87
|
+
});
|
88
|
+
|
89
|
+
it('should not append the inactive class name', function () {
|
90
|
+
expect(element.className).toEqual('ns-myfamily-n4-active');
|
91
|
+
});
|
92
|
+
|
93
|
+
it('should still call the correct callback', function () {
|
94
|
+
expect(callbacks.fontinactive).toHaveBeenCalledWith('My Family', 'n4');
|
95
|
+
});
|
96
|
+
});
|
97
|
+
|
98
|
+
describe('#dispatchFontActive', function () {
|
99
|
+
beforeEach(function () {
|
100
|
+
eventDispatcher.dispatchFontActive('My Family', 'n4');
|
101
|
+
});
|
102
|
+
|
103
|
+
it('should call the correct callback', function () {
|
104
|
+
expect(callbacks.fontactive).toHaveBeenCalledWith('My Family', 'n4');
|
105
|
+
});
|
106
|
+
|
107
|
+
it('should set the correct class name', function () {
|
108
|
+
expect(element.className).toEqual('ns-myfamily-n4-active');
|
109
|
+
});
|
110
|
+
});
|
111
|
+
|
112
|
+
describe('#dispatchFontActive - with loading class', function () {
|
113
|
+
beforeEach(function () {
|
114
|
+
eventDispatcher.dispatchFontLoading('My Family', 'n4');
|
115
|
+
eventDispatcher.dispatchFontActive('My Family', 'n4');
|
116
|
+
});
|
117
|
+
|
118
|
+
it('should set the correct class name', function () {
|
119
|
+
expect(element.className).toEqual('ns-myfamily-n4-active');
|
120
|
+
});
|
121
|
+
});
|
122
|
+
|
123
|
+
describe('#dispatchFontActive - with inactive class', function () {
|
124
|
+
beforeEach(function () {
|
125
|
+
eventDispatcher.dispatchFontInactive('My Family', 'n4');
|
126
|
+
eventDispatcher.dispatchFontActive('My Family', 'n4');
|
127
|
+
});
|
128
|
+
|
129
|
+
it('should set the correct class', function () {
|
130
|
+
expect(element.className).toEqual('ns-myfamily-n4-active');
|
131
|
+
});
|
132
|
+
});
|
133
|
+
|
134
|
+
describe('#dispatchInactive', function () {
|
135
|
+
beforeEach(function () {
|
136
|
+
eventDispatcher.dispatchInactive();
|
137
|
+
});
|
138
|
+
|
139
|
+
it('should call the correct callback', function () {
|
140
|
+
expect(callbacks.inactive).toHaveBeenCalled();
|
141
|
+
});
|
142
|
+
|
143
|
+
it('should set the correct class name', function () {
|
144
|
+
expect(element.className).toEqual('ns-inactive');
|
145
|
+
});
|
146
|
+
});
|
147
|
+
|
148
|
+
describe('#dispatchInactive - with loading class', function () {
|
149
|
+
beforeEach(function () {
|
150
|
+
eventDispatcher.dispatchLoading();
|
151
|
+
eventDispatcher.dispatchInactive();
|
152
|
+
});
|
153
|
+
|
154
|
+
it('should set the correct class name', function () {
|
155
|
+
expect(element.className).toEqual('ns-inactive');
|
156
|
+
});
|
157
|
+
});
|
158
|
+
|
159
|
+
describe('#dispatchInactive - with active class', function () {
|
160
|
+
beforeEach(function () {
|
161
|
+
eventDispatcher.dispatchActive();
|
162
|
+
eventDispatcher.dispatchInactive();
|
163
|
+
});
|
164
|
+
|
165
|
+
it('should not set the the inactive class', function () {
|
166
|
+
expect(element.className).toEqual('ns-active');
|
167
|
+
});
|
168
|
+
|
169
|
+
it('should still call the inactive callback', function () {
|
170
|
+
expect(callbacks.inactive).toHaveBeenCalled();
|
171
|
+
});
|
172
|
+
});
|
173
|
+
|
174
|
+
describe('#dispatchActive', function () {
|
175
|
+
beforeEach(function () {
|
176
|
+
eventDispatcher.dispatchActive();
|
177
|
+
});
|
178
|
+
|
179
|
+
it('should call the correct callback', function () {
|
180
|
+
expect(callbacks.active).toHaveBeenCalled();
|
181
|
+
});
|
182
|
+
|
183
|
+
it('should set the correct class name', function () {
|
184
|
+
expect(element.className).toEqual('ns-active');
|
185
|
+
});
|
186
|
+
});
|
187
|
+
|
188
|
+
describe('#dispatchActive - with loading class', function () {
|
189
|
+
beforeEach(function () {
|
190
|
+
eventDispatcher.dispatchLoading();
|
191
|
+
eventDispatcher.dispatchActive();
|
192
|
+
});
|
193
|
+
|
194
|
+
it('should set the correct class name', function () {
|
195
|
+
expect(element.className).toEqual('ns-active');
|
196
|
+
});
|
197
|
+
});
|
198
|
+
|
199
|
+
describe('#dispatchActive - with inactive class', function () {
|
200
|
+
beforeEach(function () {
|
201
|
+
eventDispatcher.dispatchInactive();
|
202
|
+
eventDispatcher.dispatchActive();
|
203
|
+
});
|
204
|
+
|
205
|
+
it('should set the correct class name', function () {
|
206
|
+
expect(element.className).toEqual('ns-active');
|
207
|
+
});
|
208
|
+
});
|
209
|
+
});
|
@@ -0,0 +1,218 @@
|
|
1
|
+
describe('WebFont', function () {
|
2
|
+
var WebFont = webfont.WebFont,
|
3
|
+
UserAgent = webfont.UserAgent,
|
4
|
+
BrowserInfo = webfont.BrowserInfo,
|
5
|
+
FontModuleLoader = webfont.FontModuleLoader,
|
6
|
+
fontModuleLoader = null,
|
7
|
+
userAgent = null;
|
8
|
+
|
9
|
+
beforeEach(function () {
|
10
|
+
userAgent = new UserAgent('Firefox', '3.6', 'Gecko', '1.9.2', 'Macintosh', '10.6', undefined, new BrowserInfo(true, false));
|
11
|
+
fontModuleLoader = new FontModuleLoader();
|
12
|
+
});
|
13
|
+
|
14
|
+
describe('font load', function () {
|
15
|
+
var font = null,
|
16
|
+
testModule = null;
|
17
|
+
|
18
|
+
beforeEach(function () {
|
19
|
+
font = new WebFont(window, fontModuleLoader, function (func, timeout) { func(); }, userAgent);
|
20
|
+
font.addModule('test', function (conf, domHelper) {
|
21
|
+
testModule = new function () {
|
22
|
+
this.conf = conf;
|
23
|
+
this.domHelper = domHelper;
|
24
|
+
this.loadCalled = true;
|
25
|
+
this.supportUserAgentCalled = false;
|
26
|
+
};
|
27
|
+
|
28
|
+
testModule.load = function (onReady) {
|
29
|
+
this.loadCalled = true;
|
30
|
+
onReady([]);
|
31
|
+
};
|
32
|
+
|
33
|
+
testModule.supportUserAgent = function (ua, support) {
|
34
|
+
this.supportUserAgentCalled = true;
|
35
|
+
support(true);
|
36
|
+
};
|
37
|
+
|
38
|
+
return testModule;
|
39
|
+
});
|
40
|
+
});
|
41
|
+
|
42
|
+
it('should not start loading', function () {
|
43
|
+
expect(font.moduleFailedLoading_).toEqual(0);
|
44
|
+
expect(font.moduleLoading_).toEqual(0);
|
45
|
+
});
|
46
|
+
|
47
|
+
it('should fail to load a module', function () {
|
48
|
+
var loading = jasmine.createSpy('loading');
|
49
|
+
|
50
|
+
font.load({
|
51
|
+
test: {
|
52
|
+
somedata: 'in french a cow says meuh'
|
53
|
+
},
|
54
|
+
loading: loading
|
55
|
+
});
|
56
|
+
|
57
|
+
expect(font.moduleFailedLoading_).toEqual(1);
|
58
|
+
expect(font.moduleLoading_).toEqual(0);
|
59
|
+
expect(testModule).not.toBeNull();
|
60
|
+
|
61
|
+
expect(testModule.conf).not.toBeUndefined();
|
62
|
+
expect(testModule.conf).not.toBeNull();
|
63
|
+
|
64
|
+
expect(testModule.domHelper).not.toBeNull();
|
65
|
+
expect(testModule.domHelper).not.toBeUndefined();
|
66
|
+
|
67
|
+
expect(testModule.domHelper.getMainWindow()).toEqual(window);
|
68
|
+
expect(testModule.domHelper.getLoadWindow()).toEqual(window);
|
69
|
+
|
70
|
+
expect(testModule.conf.somedata).toEqual('in french a cow says meuh');
|
71
|
+
expect(testModule.loadCalled).toBe(true);
|
72
|
+
expect(testModule.supportUserAgentCalled).toBe(true);
|
73
|
+
expect(loading).toHaveBeenCalled();
|
74
|
+
});
|
75
|
+
});
|
76
|
+
|
77
|
+
describe('font load with context', function () {
|
78
|
+
var font = null,
|
79
|
+
testModule = null,
|
80
|
+
fakeMainWindow = {};
|
81
|
+
|
82
|
+
beforeEach(function () {
|
83
|
+
font = new WebFont(fakeMainWindow, fontModuleLoader, function (func, timeout) { func(); }, userAgent);
|
84
|
+
font.addModule('test', function (conf, domHelper) {
|
85
|
+
testModule = new function () {
|
86
|
+
this.domHelper = domHelper;
|
87
|
+
};
|
88
|
+
testModule.load = function () {};
|
89
|
+
testModule.supportUserAgent = function (ua, support) {
|
90
|
+
support(true);
|
91
|
+
};
|
92
|
+
|
93
|
+
return testModule;
|
94
|
+
});
|
95
|
+
});
|
96
|
+
|
97
|
+
it('should load with the correct context', function () {
|
98
|
+
font.load({
|
99
|
+
test: {
|
100
|
+
somedata: 'in french a cow says meuh'
|
101
|
+
},
|
102
|
+
context: window
|
103
|
+
});
|
104
|
+
|
105
|
+
expect(testModule.domHelper).not.toBeNull();
|
106
|
+
expect(testModule.domHelper).not.toBeUndefined();
|
107
|
+
|
108
|
+
expect(testModule.domHelper.getMainWindow()).toEqual(fakeMainWindow);
|
109
|
+
expect(testModule.domHelper.getLoadWindow()).toEqual(window);
|
110
|
+
});
|
111
|
+
});
|
112
|
+
|
113
|
+
describe('module failed to provide families and descriptions because it did not initialize properly', function () {
|
114
|
+
var font = null,
|
115
|
+
testModule = null,
|
116
|
+
inactive = jasmine.createSpy('inactive'),
|
117
|
+
active = jasmine.createSpy('active');
|
118
|
+
|
119
|
+
beforeEach(function () {
|
120
|
+
font = new WebFont(window, fontModuleLoader, function (func, timeout) { func(); }, new UserAgent('Firefox', '3.6', 'Gecko', '1.9.2', 'Macintosh', '10.6', undefined, new BrowserInfo(true, false)));
|
121
|
+
font.addModule('test', function (conf, domHelper) {
|
122
|
+
testModule = new function () {
|
123
|
+
this.conf = conf;
|
124
|
+
this.families = [];
|
125
|
+
this.descriptions = {};
|
126
|
+
};
|
127
|
+
|
128
|
+
testModule.getFontWatchRunnerCtor = function () {
|
129
|
+
function FakeFontWatchRunner(activeCallback, inactiveCallback) {
|
130
|
+
this.inactive = inactiveCallback;
|
131
|
+
this.active = activeCallback;
|
132
|
+
};
|
133
|
+
|
134
|
+
FakeFontWatchRunner.prototype.start = function () {
|
135
|
+
if (conf.id) {
|
136
|
+
this.active('Font1', 'n4');
|
137
|
+
} else {
|
138
|
+
this.inactive('Font1', 'n4');
|
139
|
+
}
|
140
|
+
};
|
141
|
+
|
142
|
+
return FakeFontWatchRunner;
|
143
|
+
};
|
144
|
+
|
145
|
+
testModule.supportUserAgent = function (userAgent, support) {
|
146
|
+
if (conf.id) {
|
147
|
+
// The monotype module only initializes font
|
148
|
+
// and description if there is a kit id.
|
149
|
+
this.families = ['Font1'];
|
150
|
+
this.description = { 'Font1': ['n4'] };
|
151
|
+
}
|
152
|
+
support(true);
|
153
|
+
};
|
154
|
+
testModule.load = function (onReady) {
|
155
|
+
onReady(this.families, this.description);
|
156
|
+
};
|
157
|
+
|
158
|
+
return testModule;
|
159
|
+
});
|
160
|
+
});
|
161
|
+
|
162
|
+
it('should load with a project id', function () {
|
163
|
+
font.load({
|
164
|
+
test: {
|
165
|
+
id: 'hello world'
|
166
|
+
},
|
167
|
+
inactive: inactive,
|
168
|
+
active: active
|
169
|
+
});
|
170
|
+
|
171
|
+
expect(testModule).not.toBeNull();
|
172
|
+
expect(active).toHaveBeenCalled();
|
173
|
+
});
|
174
|
+
|
175
|
+
it('should not load without a project id', function () {
|
176
|
+
font.load({
|
177
|
+
test: {
|
178
|
+
},
|
179
|
+
inactive: inactive,
|
180
|
+
active: active
|
181
|
+
});
|
182
|
+
|
183
|
+
expect(testModule).not.toBeNull();
|
184
|
+
expect(inactive).toHaveBeenCalled();
|
185
|
+
});
|
186
|
+
});
|
187
|
+
|
188
|
+
describe('font inactive', function () {
|
189
|
+
var font = null,
|
190
|
+
testModule = null;
|
191
|
+
|
192
|
+
beforeEach(function () {
|
193
|
+
font = new WebFont(window, fontModuleLoader, function (func, timeout) { func(); }, new UserAgent('Firefox', '3.6', 'Gecko', '1.9.2', 'Macintosh', '10.6', undefined, new BrowserInfo(false, false)));
|
194
|
+
font.addModule('test', function (conf, domHelper) {
|
195
|
+
testModule = new function () {
|
196
|
+
this.conf = conf;
|
197
|
+
this.loadCalled = false;
|
198
|
+
};
|
199
|
+
testModule.load = function () {};
|
200
|
+
return testModule;
|
201
|
+
});
|
202
|
+
});
|
203
|
+
|
204
|
+
it('should load with the correct context', function () {
|
205
|
+
var inactive = jasmine.createSpy('inactive');
|
206
|
+
|
207
|
+
font.load({
|
208
|
+
test: {
|
209
|
+
somedata: 'in french a cow says meuh'
|
210
|
+
},
|
211
|
+
inactive: inactive
|
212
|
+
});
|
213
|
+
|
214
|
+
expect(testModule).toBeNull()
|
215
|
+
expect(inactive).toHaveBeenCalled();
|
216
|
+
});
|
217
|
+
});
|
218
|
+
});
|
@@ -0,0 +1,55 @@
|
|
1
|
+
describe('FontModuleLoader', function () {
|
2
|
+
var FontModuleLoader = webfont.FontModuleLoader;
|
3
|
+
|
4
|
+
describe('#getModules', function () {
|
5
|
+
var fontModuleLoader = null;
|
6
|
+
|
7
|
+
beforeEach(function () {
|
8
|
+
fontModuleLoader = new FontModuleLoader();
|
9
|
+
});
|
10
|
+
|
11
|
+
it('should return an empty array without modules', function () {
|
12
|
+
var modules = fontModuleLoader.getModules();
|
13
|
+
|
14
|
+
expect(modules).not.toBeNull();
|
15
|
+
expect(modules.length).toEqual(0);
|
16
|
+
});
|
17
|
+
|
18
|
+
it('should have modules', function () {
|
19
|
+
fontModuleLoader.addModuleFactory('booh', function () {
|
20
|
+
return {
|
21
|
+
scary: true
|
22
|
+
};
|
23
|
+
});
|
24
|
+
|
25
|
+
fontModuleLoader.addModuleFactory('haha', function () {
|
26
|
+
return {
|
27
|
+
funny: true
|
28
|
+
};
|
29
|
+
});
|
30
|
+
|
31
|
+
fontModuleLoader.addModuleFactory('moo', function () {
|
32
|
+
return {
|
33
|
+
cowy: true
|
34
|
+
};
|
35
|
+
});
|
36
|
+
|
37
|
+
var modules = fontModuleLoader.getModules({
|
38
|
+
booh: {},
|
39
|
+
moo: {},
|
40
|
+
nothing: {}
|
41
|
+
});
|
42
|
+
|
43
|
+
expect(modules).not.toBeNull();
|
44
|
+
expect(modules.length).toEqual(2);
|
45
|
+
|
46
|
+
var module = modules[0];
|
47
|
+
expect(module).not.toBeNull();
|
48
|
+
expect(module.scary || module.cowy).toBe(true);
|
49
|
+
|
50
|
+
var module = modules[1];
|
51
|
+
expect(module).not.toBeNull();
|
52
|
+
expect(module.scary || module.cowy).toBe(true);
|
53
|
+
});
|
54
|
+
});
|
55
|
+
});
|