webfontloader 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/CHANGELOG +9 -0
  2. data/Gemfile +2 -8
  3. data/README.md +31 -32
  4. data/Rakefile +2 -33
  5. data/docs/EVENTS.md +10 -1
  6. data/docs/MODULES.md +4 -3
  7. data/lib/webfontloader.rb +1 -1
  8. data/spec/ascender/ascenderscript_spec.js +43 -0
  9. data/spec/core/cssclassname_spec.js +42 -0
  10. data/spec/core/cssfontfamilyname_spec.js +38 -0
  11. data/spec/core/domhelper_spec.js +158 -0
  12. data/spec/core/eventdispatcher_spec.js +209 -0
  13. data/spec/core/font_spec.js +218 -0
  14. data/spec/core/fontmoduleloader_spec.js +55 -0
  15. data/spec/core/fontruler_spec.js +33 -0
  16. data/spec/core/fontvariationdescription_spec.js +67 -0
  17. data/spec/core/fontwatcher_spec.js +204 -0
  18. data/spec/core/fontwatchrunner_spec.js +398 -0
  19. data/spec/core/size_spec.js +17 -0
  20. data/spec/core/useragentparser_spec.js +921 -0
  21. data/spec/custom/customcss_spec.js +36 -0
  22. data/spec/fontdeck/fontdeckscript_spec.js +111 -0
  23. data/spec/fonts/LICENSE.txt +93 -0
  24. data/spec/fonts/nullfont.css +1 -0
  25. data/spec/fonts/nullfont1.css +1 -0
  26. data/spec/fonts/nullfont2.css +1 -0
  27. data/spec/fonts/nullfont3.css +1 -0
  28. data/spec/fonts/sourcesans.eot +0 -0
  29. data/spec/fonts/sourcesans.otf +0 -0
  30. data/spec/fonts/sourcesans.svg +2523 -0
  31. data/spec/fonts/sourcesans.ttf +0 -0
  32. data/spec/fonts/sourcesans.woff +0 -0
  33. data/spec/fonts/sourcesansa.css +1 -0
  34. data/spec/fonts/sourcesansb.css +1 -0
  35. data/spec/google/fontapiparser_spec.js +348 -0
  36. data/spec/google/fontapiurlbuilder_spec.js +40 -0
  37. data/spec/google/googlefontapi_spec.js +123 -0
  38. data/spec/google/lastresortwebkitfontwatchrunner_spec.js +145 -0
  39. data/spec/index.html +95 -0
  40. data/spec/monotype/monotypescript_spec.js +49 -0
  41. data/spec/typekit/typekitscript_spec.js +93 -0
  42. data/src/core/domhelper.js +6 -3
  43. data/src/core/fontruler.js +1 -1
  44. data/src/core/fontwatcher.js +5 -0
  45. data/src/core/fontwatchrunner.js +7 -4
  46. data/src/monotype/monotype_script.js +4 -3
  47. data/tools/jasmine-phantomjs/jasmine-phantomjs.js +26 -0
  48. data/tools/jasmine-phantomjs/terminal-reporter.js +177 -0
  49. data/tools/jasmine/MIT.LICENSE +20 -0
  50. data/tools/jasmine/jasmine-html.js +681 -0
  51. data/tools/jasmine/jasmine.css +82 -0
  52. data/tools/jasmine/jasmine.js +2600 -0
  53. data/webfontloader.gemspec +46 -25
  54. metadata +77 -42
  55. data/src-test/ascender/ascender_script_test.js +0 -51
  56. data/src-test/core/cssclassnametest.js +0 -42
  57. data/src-test/core/cssfontfamilynametest.js +0 -54
  58. data/src-test/core/domhelpertest.js +0 -151
  59. data/src-test/core/eventdispatchertest.js +0 -275
  60. data/src-test/core/fontmoduleloadertest.js +0 -30
  61. data/src-test/core/fonttest.js +0 -121
  62. data/src-test/core/fontvariationdescriptiontest.js +0 -76
  63. data/src-test/core/fontwatchertest.js +0 -287
  64. data/src-test/core/fontwatchrunnertest.js +0 -454
  65. data/src-test/core/useragenttest.js +0 -755
  66. data/src-test/custom/customcsstest.js +0 -35
  67. data/src-test/fontdeck/fontdeck_script_test.js +0 -116
  68. data/src-test/google/fontapiparsertest.js +0 -252
  69. data/src-test/google/fontapiurlbuildertest.js +0 -71
  70. data/src-test/google/googlefontapitest.js +0 -185
  71. data/src-test/google/lastresortwebkitfontwatchrunnertest.js +0 -204
  72. data/src-test/monotype/monotype_script_test.js +0 -304
  73. data/src-test/typekit/typekit_script_test.js +0 -195
  74. data/tools/jstestdriver/JsTestDriver-1.2.1.jar +0 -0
@@ -1,35 +0,0 @@
1
- var CustomCssTest = TestCase('CustomCssTest');
2
-
3
- CustomCssTest.prototype.testFoo = function() {
4
- var links = [];
5
- var head = '';
6
-
7
- var fakeDomHelper = {
8
- createCssLink: function(link) {
9
- links.push(link);
10
- },
11
- insertInto: function(tag, e) {
12
- head = tag;
13
- }
14
- };
15
- var defaultModule = new webfont.CustomCss(fakeDomHelper, {
16
- families: [ 'Font1:n7', 'Font2:i4,i7', 'Font3' ], urls: [ 'http://moo',
17
- 'http://meuh' ]});
18
- var families = null;
19
- var variations = null;
20
-
21
- defaultModule.load(function(fontFamilies, fontVariations) { families = fontFamilies; variations = fontVariations;});
22
- assertEquals('head', head);
23
- assertEquals(2, links.length);
24
- assertEquals('http://moo', links[0]);
25
- assertEquals('http://meuh', links[1]);
26
- assertNotNull(families);
27
- assertEquals(3, families.length);
28
- assertEquals('Font1', families[0]);
29
- assertEquals('Font2', families[1]);
30
- assertEquals('Font3', families[2]);
31
- assertEquals('n7', variations["Font1"][0]);
32
- assertEquals('i4', variations["Font2"][0]);
33
- assertEquals('i7', variations["Font2"][1]);
34
- assertEquals(undefined, variations["Font3"]);
35
- };
@@ -1,116 +0,0 @@
1
- var FontdeckScriptTest = TestCase('FontdeckScriptTest');
2
-
3
- FontdeckScriptTest.prototype.testSupportAndLoadLifecycle = function() {
4
- var configuration = {
5
- 'id': '2282'
6
- };
7
- var apiResponse = {
8
- "domain" : "localhost",
9
- "cssurl" : "http://f.fontdeck.com/s/css/03BmCXiV2AHwX/Rp+OBFTfD2oFs/localhost/2282.css",
10
- "project" : 2282,
11
- "cssbase" : "http://f.fontdeck.com/s/css/03BmCXiV2AHwX/Rp+OBFTfD2oFs",
12
- "fonts" : [
13
- {
14
- "font_family" : "'Fertigo Pro Regular', Fertigo, Constantia, Palatino, serif",
15
- "font_size_adjust" : 0.508,
16
- "name" : "Fertigo Pro Regular",
17
- "style" : "normal",
18
- "weight" : "normal",
19
- "font_urls" : {
20
- "eot" : "http://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.eot",
21
- "ttf" : "http://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.ttf",
22
- "woff" : "http://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.woff",
23
- "svg" : "http://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.svg#104"
24
- },
25
- "id" : 104
26
- },
27
- {
28
- "font_family" : "'Bodoni Display Bold Italic', Georgia, 'Times New Roman', Times, serif",
29
- "font_size_adjust" : 0.45,
30
- "name" : "Bodoni Display Bold Italic",
31
- "style" : "italic",
32
- "weight" : "bold",
33
- "font_urls" : {
34
- "eot" : "http://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.eot",
35
- "ttf" : "http://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.ttf",
36
- "woff" : "http://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.woff",
37
- "svg" : "http://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.svg#2256"
38
- },
39
- "id" : 2256
40
- }
41
- ]
42
- };
43
- var insert = '';
44
- var global = {
45
- // No hostname to verify fallback behavior for empty iframe
46
- location: {}
47
- };
48
- var src = '';
49
- var fakeDomHelper = {
50
- insertInto: function(tag, e) {
51
- insert = tag;
52
- },
53
- createScriptSrc: function(srcLink) {
54
- src = srcLink;
55
- },
56
- getLoadWindow: function() {
57
- return global;
58
- },
59
- getMainWindow: function() {
60
- return {
61
- location: {
62
- hostname: 'test-host-name'
63
- }
64
- };
65
- },
66
- getProtocol: function() {
67
- return 'https:';
68
- }
69
- };
70
- var fontdeck = new webfont.FontdeckScript(fakeDomHelper, configuration);
71
-
72
- // supportUserAgent
73
- var userAgent = 'user agent';
74
- var isSupport = null;
75
-
76
- fontdeck.supportUserAgent(userAgent, function(support) { isSupport = support; });
77
- assertEquals('head', insert);
78
- assertEquals('https://f.fontdeck.com/s/css/js/test-host-name/2282.js', src);
79
- assertEquals(null, isSupport);
80
-
81
- assertNotNull(global.__webfontfontdeckmodule__);
82
- assertNotNull(global.__webfontfontdeckmodule__['2282']);
83
-
84
- // Call the callback function passing in dummy API response.
85
- global.__webfontfontdeckmodule__['2282'](true, apiResponse);
86
-
87
- assertEquals(fontdeck.fontFamilies_, [apiResponse.fonts[0].name, apiResponse.fonts[1].name]);
88
- assertEquals(fontdeck.fontVariations_[apiResponse.fonts[0].name], ['n4']);
89
- assertEquals(fontdeck.fontVariations_[apiResponse.fonts[1].name], ['i7']);
90
-
91
- assertEquals(true, isSupport);
92
- };
93
-
94
- FontdeckScriptTest.prototype.testNoProjectId = function() {
95
- var configuration = {
96
- 'id': null
97
- };
98
- var insert = '';
99
- var src = '';
100
- var fakeDomHelper = {
101
- getLoadWindow: function() {
102
- return {};
103
- }
104
- };
105
- var fontdeck = new webfont.FontdeckScript(fakeDomHelper, configuration);
106
-
107
- // supportUserAgent
108
- var userAgent = 'user agent';
109
- var isSupport = null;
110
-
111
- fontdeck.supportUserAgent(userAgent, function(support) { isSupport = support; });
112
-
113
- assertEquals(fontdeck.fontFamilies_, []);
114
- assertEquals(fontdeck.fontVariations_, []);
115
- assertEquals(true, isSupport);
116
- }
@@ -1,252 +0,0 @@
1
- var FontApiParserTest = TestCase('FontApiParserTest');
2
-
3
- FontApiParserTest.prototype.testParsedValuesAreCoherent = function() {
4
- var fontFamilies = [ 'Tangerine', 'Droid Serif:bi',
5
- 'Yanone Kaffeesatz:200,300,400,700',
6
- 'Cantarell:italic,b', 'Exo:100italic', 'Lobster:200n'];
7
- var fontApiParser = new webfont.FontApiParser(fontFamilies);
8
-
9
- fontApiParser.parse();
10
- var parsedFontFamilies = fontApiParser.getFontFamilies();
11
-
12
- assertEquals(6, parsedFontFamilies.length);
13
- assertEquals('Tangerine', parsedFontFamilies[0]);
14
- assertEquals('Droid Serif', parsedFontFamilies[1]);
15
- assertEquals('Yanone Kaffeesatz', parsedFontFamilies[2]);
16
- assertEquals('Cantarell', parsedFontFamilies[3]);
17
- assertEquals('Exo', parsedFontFamilies[4]);
18
- assertEquals('Lobster', parsedFontFamilies[5]);
19
- var variations = fontApiParser.getVariations();
20
-
21
- var tangerine = variations['Tangerine'];
22
- assertNotNull(tangerine);
23
- assertEquals(1, tangerine.length);
24
- assertEquals('n4', tangerine[0]);
25
-
26
- var droidSerif = variations['Droid Serif'];
27
- assertNotNull(droidSerif);
28
- assertEquals(1, droidSerif.length);
29
- assertEquals('i7', droidSerif[0]);
30
-
31
- var yanoneKaffeesatz = variations['Yanone Kaffeesatz'];
32
- assertNotNull(yanoneKaffeesatz);
33
- assertEquals(4, yanoneKaffeesatz.length);
34
- assertEquals('n2', yanoneKaffeesatz[0]);
35
- assertEquals('n3', yanoneKaffeesatz[1]);
36
- assertEquals('n4', yanoneKaffeesatz[2]);
37
- assertEquals('n7', yanoneKaffeesatz[3]);
38
-
39
- var cantarell = variations['Cantarell'];
40
- assertNotNull(cantarell);
41
- assertEquals(2, cantarell.length);
42
- assertEquals('i4', cantarell[0]);
43
- assertEquals('n7', cantarell[1]);
44
-
45
- var exo = variations['Exo'];
46
- assertNotNull(exo);
47
- assertEquals(1, exo.length);
48
- assertEquals('i1', exo[0]);
49
-
50
- var lobster = variations['Lobster'];
51
- assertNotNull(lobster);
52
- assertEquals(1, lobster.length);
53
- assertEquals('n2', lobster[0]);
54
- };
55
-
56
- FontApiParserTest.prototype.testMixOfNumericWeightAndStyle = function() {
57
- var fontFamilies = [ 'Nobile:700i,b,200i,r,i700' ];
58
- var fontApiParser = new webfont.FontApiParser(fontFamilies);
59
-
60
- fontApiParser.parse();
61
- var parsedFontFamilies = fontApiParser.getFontFamilies();
62
-
63
- assertEquals(1, parsedFontFamilies.length);
64
- assertEquals('Nobile', parsedFontFamilies[0]);
65
- var variations = fontApiParser.getVariations();
66
-
67
- var nobile = variations['Nobile'];
68
- assertNotNull(nobile);
69
- assertEquals(4, nobile.length);
70
- assertEquals('i7', nobile[0]);
71
- assertEquals('n7', nobile[1]);
72
- assertEquals('i2', nobile[2]);
73
- assertEquals('n4', nobile[3]);
74
- };
75
-
76
- FontApiParserTest.prototype.testTypoBildInsteadOfBold = function() {
77
- var fontFamilies = [ 'Nobile:bild' ];
78
- var fontApiParser = new webfont.FontApiParser(fontFamilies);
79
-
80
- fontApiParser.parse();
81
-
82
- var parsedFontFamilies = fontApiParser.getFontFamilies();
83
- assertEquals(1, parsedFontFamilies.length);
84
- assertEquals('Nobile', parsedFontFamilies[0]);
85
-
86
- var variations = fontApiParser.getVariations();
87
- var nobile = variations['Nobile'];
88
- assertEquals(1, nobile.length);
89
- assertEquals('n4', nobile[0]);
90
- };
91
-
92
- FontApiParserTest.prototype.testNonSense = function() {
93
- var fontFamilies = [ 'Nobile:dwe,^%^%fewf,$9940@#!@#$%^&*()_+}POIBJ{}{' ];
94
- var fontApiParser = new webfont.FontApiParser(fontFamilies);
95
-
96
- fontApiParser.parse();
97
- var parsedFontFamilies = fontApiParser.getFontFamilies();
98
-
99
- assertEquals(1, parsedFontFamilies.length);
100
- assertEquals('Nobile', parsedFontFamilies[0]);
101
-
102
- var variations = fontApiParser.getVariations();
103
- var nobile = variations['Nobile'];
104
- assertEquals(1, nobile.length);
105
- assertEquals('n4', nobile[0]);
106
- };
107
-
108
- FontApiParserTest.prototype.testNoWeightOneSubsetDefined = function() {
109
- var fontFamilies = [ 'Cantarell::greek' ];
110
- var fontApiParser = new webfont.FontApiParser(fontFamilies);
111
-
112
- fontApiParser.parse();
113
-
114
- var parsedFontFamilies = fontApiParser.getFontFamilies();
115
- assertEquals(1, parsedFontFamilies.length);
116
- assertEquals('Cantarell', parsedFontFamilies[0]);
117
-
118
- var variations = fontApiParser.getVariations();
119
- var cantarellVariations = variations['Cantarell'];
120
- assertEquals(1, cantarellVariations.length);
121
- assertEquals('n4', cantarellVariations[0]);
122
-
123
- var testStrings = fontApiParser.getFontTestStrings();
124
- var cantarellTestStrings = testStrings['Cantarell'];
125
- assertNotUndefined(cantarellTestStrings);
126
- assertEquals(webfont.FontApiParser.INT_FONTS['greek'],
127
- cantarellTestStrings);
128
- };
129
-
130
-
131
- FontApiParserTest.prototype.testNoWeightMultipleSubsetsDefined = function() {
132
- var fontFamilies = [ 'Cantarell::cyrillic,greek,latin' ];
133
- var fontApiParser = new webfont.FontApiParser(fontFamilies);
134
-
135
- fontApiParser.parse();
136
-
137
- var parsedFontFamilies = fontApiParser.getFontFamilies();
138
- assertEquals(1, parsedFontFamilies.length);
139
- assertEquals('Cantarell', parsedFontFamilies[0]);
140
-
141
- var variations = fontApiParser.getVariations();
142
- var cantarellVariations = variations['Cantarell'];
143
- assertEquals(1, cantarellVariations.length);
144
- assertEquals('n4', cantarellVariations[0]);
145
-
146
- var testStrings = fontApiParser.getFontTestStrings();
147
- var cantarellTestStrings = testStrings['Cantarell'];
148
- assertNotUndefined(cantarellTestStrings);
149
- assertEquals(webfont.FontApiParser.INT_FONTS['cyrillic'],
150
- cantarellTestStrings);
151
- };
152
-
153
-
154
- FontApiParserTest.prototype.testWeightAndMultipleSubsetsDefined = function() {
155
- var fontFamilies = [ 'Cantarell:regular,bold:cyrillic,greek,latin' ];
156
- var fontApiParser = new webfont.FontApiParser(fontFamilies);
157
-
158
- fontApiParser.parse();
159
-
160
- var parsedFontFamilies = fontApiParser.getFontFamilies();
161
- assertEquals(1, parsedFontFamilies.length);
162
- assertEquals('Cantarell', parsedFontFamilies[0]);
163
-
164
- var variations = fontApiParser.getVariations();
165
- var cantarellVariations = variations['Cantarell'];
166
- assertEquals(2, cantarellVariations.length);
167
- assertEquals('n4', cantarellVariations[0]);
168
- assertEquals('n7', cantarellVariations[1]);
169
-
170
- var testStrings = fontApiParser.getFontTestStrings();
171
- var cantarellTestStrings = testStrings['Cantarell'];
172
- assertNotUndefined(cantarellTestStrings);
173
- assertEquals(webfont.FontApiParser.INT_FONTS['cyrillic'],
174
- cantarellTestStrings);
175
- };
176
-
177
-
178
- FontApiParserTest.prototype.testHanumanIsBackwardCompatible = function() {
179
- var fontFamilies = [ 'Hanuman' ];
180
- var fontApiParser = new webfont.FontApiParser(fontFamilies);
181
-
182
- fontApiParser.parse();
183
-
184
- var parsedFontFamilies = fontApiParser.getFontFamilies();
185
- assertEquals(1, parsedFontFamilies.length);
186
- assertEquals('Hanuman', parsedFontFamilies[0]);
187
-
188
- var variations = fontApiParser.getVariations();
189
- var hanumanVariations = variations['Hanuman'];
190
- assertEquals(1, hanumanVariations.length);
191
- assertEquals('n4', hanumanVariations[0]);
192
-
193
- var testStrings = fontApiParser.getFontTestStrings();
194
- var hanumanTestStrings = testStrings['Hanuman'];
195
- assertNotUndefined(hanumanTestStrings);
196
- assertEquals(webfont.FontApiParser.INT_FONTS['Hanuman'],
197
- hanumanTestStrings);
198
- };
199
-
200
-
201
- FontApiParserTest.prototype.testHanumanIsForwardCompatible = function() {
202
- var fontFamilies = [ 'Hanuman::khmer' ];
203
- var fontApiParser = new webfont.FontApiParser(fontFamilies);
204
-
205
- fontApiParser.parse();
206
-
207
- var parsedFontFamilies = fontApiParser.getFontFamilies();
208
- assertEquals(1, parsedFontFamilies.length);
209
- assertEquals('Hanuman', parsedFontFamilies[0]);
210
-
211
- var variations = fontApiParser.getVariations();
212
- var hanumanVariations = variations['Hanuman'];
213
- assertEquals(1, hanumanVariations.length);
214
- assertEquals('n4', hanumanVariations[0]);
215
-
216
- var testStrings = fontApiParser.getFontTestStrings();
217
- var hanumanTestStrings = testStrings['Hanuman'];
218
- assertNotUndefined(hanumanTestStrings);
219
- assertEquals(webfont.FontApiParser.INT_FONTS['khmer'],
220
- hanumanTestStrings);
221
- };
222
-
223
- FontApiParserTest.prototype.testPlusReplacedWithSpace = function() {
224
- var fontFamilies = [ 'Erica+One', 'Droid+Serif::latin',
225
- 'Yanone+Kaffeesatz:400,700:latin'];
226
- var fontApiParser = new webfont.FontApiParser(fontFamilies);
227
-
228
- fontApiParser.parse();
229
- var parsedFontFamilies = fontApiParser.getFontFamilies();
230
-
231
- assertEquals(3, parsedFontFamilies.length);
232
- assertEquals('Erica One', parsedFontFamilies[0]);
233
- assertEquals('Droid Serif', parsedFontFamilies[1]);
234
- assertEquals('Yanone Kaffeesatz', parsedFontFamilies[2]);
235
- var variations = fontApiParser.getVariations();
236
-
237
- var ericaOne = variations['Erica One'];
238
- assertNotNull(ericaOne);
239
- assertEquals(1, ericaOne.length);
240
- assertEquals('n4', ericaOne[0]);
241
-
242
- var droidSerif = variations['Droid Serif'];
243
- assertNotNull(droidSerif);
244
- assertEquals(1, droidSerif.length);
245
- assertEquals('n4', droidSerif[0]);
246
-
247
- var yanoneKaffeesatz = variations['Yanone Kaffeesatz'];
248
- assertNotNull(yanoneKaffeesatz);
249
- assertEquals(2, yanoneKaffeesatz.length);
250
- assertEquals('n4', yanoneKaffeesatz[0]);
251
- assertEquals('n7', yanoneKaffeesatz[1]);
252
- };
@@ -1,71 +0,0 @@
1
- var FontApiUrlBuilderTest = TestCase('FontApiUrlBuilderTest');
2
-
3
- FontApiUrlBuilderTest.prototype.testThrowsExceptionIfNoFontFamilies =
4
- function() {
5
- var fontApiUrlBuilder = new webfont.FontApiUrlBuilder("http://moo", "http:");
6
-
7
- try {
8
- fontApiUrlBuilder.build();
9
- fail('build should have thrown an exception.');
10
- } catch (e) {
11
- // success
12
- }
13
- };
14
-
15
- FontApiUrlBuilderTest.prototype.testBuildProperUrl = function() {
16
- var fontApiUrlBuilder = new webfont.FontApiUrlBuilder("http://moo", "http:");
17
-
18
- fontApiUrlBuilder.setFontFamilies([ 'Font1', 'Font2' ]);
19
- assertEquals('http://moo?family=Font1%7CFont2', fontApiUrlBuilder.build());
20
- };
21
-
22
- FontApiUrlBuilderTest.prototype.testBuildProperDefaultUrl = function() {
23
- var fontApiUrlBuilder = new webfont.FontApiUrlBuilder(undefined, "http:");
24
-
25
- fontApiUrlBuilder.setFontFamilies([ 'Font1', 'Font2' ]);
26
- assertEquals("http:" + webfont.FontApiUrlBuilder.DEFAULT_API_URL +
27
- '?family=Font1%7CFont2', fontApiUrlBuilder.build());
28
- };
29
-
30
-
31
- FontApiUrlBuilderTest.prototype.testBuildProperUrlWithSubsets = function() {
32
- var fontApiUrlBuilder = new webfont.FontApiUrlBuilder(undefined, "http:");
33
-
34
- fontApiUrlBuilder.setFontFamilies([ 'Font1:bold:greek,cyrillic',
35
- 'Font2:italic', 'Font3' ]);
36
- assertEquals("http:" + webfont.FontApiUrlBuilder.DEFAULT_API_URL +
37
- '?family=Font1:bold%7CFont2:italic%7CFont3' +
38
- '&subset=greek,cyrillic', fontApiUrlBuilder.build());
39
- };
40
-
41
- FontApiUrlBuilderTest.prototype.testBuildProperUrlWithSubsetsNoVariations =
42
- function() {
43
- var fontApiUrlBuilder = new webfont.FontApiUrlBuilder(undefined, "http:");
44
-
45
- fontApiUrlBuilder.setFontFamilies([ 'Font1:bold,italic:greek,cyrillic',
46
- 'Font2:italic', 'Font3::latin' ]);
47
- assertEquals("http:" + webfont.FontApiUrlBuilder.DEFAULT_API_URL +
48
- '?family=Font1:bold,italic%7CFont2:italic%7CFont3' +
49
- '&subset=greek,cyrillic,latin', fontApiUrlBuilder.build());
50
- };
51
-
52
-
53
- FontApiUrlBuilderTest.prototype.testBuildProperUrlWithText = function() {
54
- var fontApiUrlBuilder = new webfont.FontApiUrlBuilder(undefined, "http:", "lorem ipsum");
55
-
56
- fontApiUrlBuilder.setFontFamilies([ 'Font1', 'Font2' ]);
57
- assertEquals("http:" + webfont.FontApiUrlBuilder.DEFAULT_API_URL +
58
- '?family=Font1%7CFont2' +
59
- '&text=lorem%20ipsum', fontApiUrlBuilder.build());
60
- };
61
-
62
-
63
- FontApiUrlBuilderTest.prototype.testBuildProperUrlWithEmptyText = function() {
64
- var fontApiUrlBuilder = new webfont.FontApiUrlBuilder(undefined, "http:", "");
65
-
66
- fontApiUrlBuilder.setFontFamilies([ 'Font1:bold:greek,cyrillic',
67
- 'Font2:italic', 'Font3' ]);
68
- assertEquals("http:" + webfont.FontApiUrlBuilder.DEFAULT_API_URL +
69
- '?family=Font1:bold%7CFont2:italic%7CFont3' +
70
- '&subset=greek,cyrillic', fontApiUrlBuilder.build());
71
- };